@nice2dev/ui 1.2.0 → 1.2.2

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.
Files changed (229) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
  3. package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
  4. package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
  5. package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
  6. package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
  7. package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
  8. package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
  9. package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
  10. package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
  11. package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
  12. package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
  13. package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
  14. package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
  15. package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
  16. package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
  17. package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
  18. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
  19. package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
  20. package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
  21. package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
  22. package/dist/NiceButton-3AcJJ15c.cjs +1 -0
  23. package/dist/NiceButton-vkI07DP0.js +88 -0
  24. package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
  25. package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
  26. package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
  27. package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
  28. package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
  29. package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
  30. package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
  31. package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
  32. package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
  33. package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
  34. package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
  35. package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
  36. package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
  37. package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
  38. package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
  39. package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
  40. package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
  41. package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
  42. package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
  43. package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
  44. package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
  45. package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
  46. package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
  47. package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
  48. package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
  49. package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
  50. package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
  51. package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
  52. package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
  53. package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
  54. package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
  55. package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
  56. package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
  57. package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
  58. package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
  59. package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
  60. package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
  61. package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
  62. package/dist/NiceForm-BcN4p2kG.cjs +1 -0
  63. package/dist/NiceForm-CISJyzoW.cjs +1 -0
  64. package/dist/NiceForm-DmH6k1b_.js +4775 -0
  65. package/dist/NiceForm-tIXS-M6b.js +4770 -0
  66. package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
  67. package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
  68. package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
  69. package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
  70. package/dist/NiceGantt-CX3jVNaF.js +330 -0
  71. package/dist/NiceGantt-Dao7pN9z.js +328 -0
  72. package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
  73. package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
  74. package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
  75. package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
  76. package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
  77. package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
  78. package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
  79. package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
  80. package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
  81. package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
  82. package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
  83. package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
  84. package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
  85. package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
  86. package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
  87. package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
  88. package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
  89. package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
  90. package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
  91. package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
  92. package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
  93. package/dist/NiceLoginForm-DQe77Isv.js +747 -0
  94. package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
  95. package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
  96. package/dist/NiceLoginForm.css +1 -1
  97. package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
  98. package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
  99. package/dist/NiceMention--3P3vO-W.cjs +430 -0
  100. package/dist/NiceMention-Co2cqkVM.js +11316 -0
  101. package/dist/NiceMention-DKhk3xdM.js +11321 -0
  102. package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
  103. package/dist/NiceMention.css +1 -1
  104. package/dist/NiceModal-BbQwiEOp.cjs +1 -0
  105. package/dist/NiceModal-DQEfTcnZ.js +85 -0
  106. package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
  107. package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
  108. package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
  109. package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
  110. package/dist/NiceModuleLifecyclePanel.css +1 -1
  111. package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
  112. package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
  113. package/dist/NicePagination-B3nZDZem.js +165 -0
  114. package/dist/NicePagination-B8rg1Y67.cjs +1 -0
  115. package/dist/NicePagination-BFGt1v0a.js +165 -0
  116. package/dist/NicePagination-DltL3-Sz.cjs +1 -0
  117. package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
  118. package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
  119. package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
  120. package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
  121. package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
  122. package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
  123. package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
  124. package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
  125. package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
  126. package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
  127. package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
  128. package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
  129. package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
  130. package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
  131. package/dist/NiceSavedQueryPanel.css +1 -1
  132. package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
  133. package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
  134. package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
  135. package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
  136. package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
  137. package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
  138. package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
  139. package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
  140. package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
  141. package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
  142. package/dist/NiceSelect-CZR8Zu_k.js +420 -0
  143. package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
  144. package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
  145. package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
  146. package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
  147. package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
  148. package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
  149. package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
  150. package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
  151. package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
  152. package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
  153. package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
  154. package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
  155. package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
  156. package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
  157. package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
  158. package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
  159. package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
  160. package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
  161. package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
  162. package/dist/NiceWindow-CWN8OCHF.js +2109 -0
  163. package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
  164. package/dist/NiceWindow.css +1 -1
  165. package/dist/charts-Bo2WAI5T.cjs +768 -0
  166. package/dist/charts-BpELGDXh.cjs +768 -0
  167. package/dist/charts-ByrdMeQP.js +4767 -0
  168. package/dist/charts-M6LuVI7F.js +4776 -0
  169. package/dist/charts.cjs +1 -1
  170. package/dist/charts.css +1 -1
  171. package/dist/charts.d.ts +28 -46
  172. package/dist/charts.mjs +1 -1
  173. package/dist/core-B8eBUE4m.js +438 -0
  174. package/dist/core-lBFqvT0V.cjs +1 -0
  175. package/dist/core-lazy-Bh2yg4Et.js +351 -0
  176. package/dist/core-lazy-CkWKjfc6.cjs +1 -0
  177. package/dist/core-lazy-Ctin_LwS.cjs +1 -0
  178. package/dist/core-lazy-iDiropM6.js +351 -0
  179. package/dist/data-branching-BgIAw01q.cjs +1 -0
  180. package/dist/data-branching-Dak1_ZKR.cjs +1 -0
  181. package/dist/data-branching-DiLAO4Qt.js +6386 -0
  182. package/dist/data-branching-bvB9K6KS.js +6386 -0
  183. package/dist/data-branching.cjs +1 -1
  184. package/dist/data-branching.mjs +1 -1
  185. package/dist/data.cjs +1 -1
  186. package/dist/data.d.ts +22 -18
  187. package/dist/data.mjs +3 -3
  188. package/dist/devops-Bp-_aA-9.js +8682 -0
  189. package/dist/devops-CXBSjnyX.cjs +17 -0
  190. package/dist/devops-DkVluHBp.cjs +17 -0
  191. package/dist/devops-zsMUueTd.js +8648 -0
  192. package/dist/devops.cjs +1 -1
  193. package/dist/devops.d.ts +3 -3
  194. package/dist/devops.mjs +1 -1
  195. package/dist/editors.cjs +1 -1
  196. package/dist/editors.d.ts +100 -38
  197. package/dist/editors.mjs +8 -8
  198. package/dist/feedback.cjs +1 -1
  199. package/dist/feedback.d.ts +71 -2
  200. package/dist/feedback.mjs +10 -9
  201. package/dist/index.cjs +263 -263
  202. package/dist/index.css +1 -1
  203. package/dist/index.d.ts +641 -253
  204. package/dist/index.mjs +26438 -26260
  205. package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
  206. package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
  207. package/dist/lazy.cjs +1 -1
  208. package/dist/lazy.d.ts +9 -7
  209. package/dist/lazy.mjs +51 -51
  210. package/dist/navigation.cjs +1 -1
  211. package/dist/navigation.css +1 -0
  212. package/dist/navigation.d.ts +99 -43
  213. package/dist/navigation.mjs +504 -547
  214. package/dist/no-code-BNFk_BDO.js +8275 -0
  215. package/dist/no-code-CFdTp543.cjs +331 -0
  216. package/dist/no-code-DiTEnuRv.js +8288 -0
  217. package/dist/no-code-wG9c0z_T.cjs +331 -0
  218. package/dist/no-code.cjs +1 -1
  219. package/dist/no-code.css +1 -1
  220. package/dist/no-code.mjs +1 -1
  221. package/dist/overlays.cjs +1 -1
  222. package/dist/overlays.d.ts +12 -6
  223. package/dist/overlays.mjs +1 -1
  224. package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
  225. package/dist/pickerCommons-CMxFt9SW.js +548 -0
  226. package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
  227. package/dist/pickerCommons-DkumQ3KE.js +548 -0
  228. package/dist/style.css +12 -9
  229. package/package.json +3 -3
@@ -0,0 +1,17 @@
1
+ "use strict";const e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),n=require("react"),Pe={info:e.jsx(i.NiceIcon,{name:"info",size:28}),warning:e.jsx(i.NiceIcon,{name:"warning",size:28}),error:e.jsx(i.NiceIcon,{name:"error",size:28}),success:e.jsx(i.NiceIcon,{name:"success",size:28})},be=({visible:d,message:j,header:C,icon:I,variant:E="warning",acceptLabel:F,rejectLabel:L,onAccept:A,onReject:M,closeOnOverlay:N=!1,closeOnEscape:T=!0,showReject:W=!0,size:b="md",className:w,style:y})=>{const{t:k}=i.useNiceTranslation();if(n.useEffect(()=>{if(!d||!T)return;const P=Z=>{Z.key==="Escape"&&M()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[d,T,M]),n.useEffect(()=>(d?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[d]),!d)return null;const v=I??Pe[E],_=F??k("confirm.accept","Yes"),a=L??k("confirm.reject","No");return e.jsx("div",{className:"nice-modal-overlay",role:"presentation",onClick:N?M:void 0,onKeyDown:P=>{P.key!=="Escape"&&P.stopPropagation()},children:e.jsxs("div",{className:`nice-confirm nice-confirm--${E} nice-confirm--${b} ${w||""}`,style:y,role:"alertdialog","aria-modal":"true","aria-label":C,"aria-describedby":"nice-confirm-message",onClick:P=>P.stopPropagation(),children:[C&&e.jsx("div",{className:"nice-confirm__header",children:e.jsx("h3",{className:"nice-confirm__title",children:C})}),e.jsxs("div",{className:"nice-confirm__body",children:[v&&e.jsx("div",{className:`nice-confirm__icon nice-confirm__icon--${E}`,children:v}),e.jsx("div",{id:"nice-confirm-message",className:"nice-confirm__message",children:j})]}),e.jsxs("div",{className:"nice-confirm__footer",children:[W&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--md",onClick:M,children:a}),e.jsx("button",{type:"button",className:`nice-btn nice-btn--${E==="error"?"error":"primary"} nice-btn--md`,onClick:A,autoFocus:!0,children:_})]})]})})},ve=new Set,De=(d,j)=>{if(Object.is(d,j))return!0;try{return JSON.stringify(d)===JSON.stringify(j)}catch{return!1}};function ye(d,j,C,I,E,F="on its own the prop is only the initial value"){const L=n.useRef(I);if(process.env.NODE_ENV==="production"||E){L.current=I;return}const A=`${d}.${j}`;I!==void 0&&!ve.has(A)&&!De(I,L.current)&&(ve.add(A),console.warn(`[Nice2Dev] <${d}> \`${j}\` changed after mount without \`${C}\`, so the change is ignored: ${F}. Pass \`${C}\` to control it.`)),L.current=I}const ue=[],ge=["var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-accent, #8b5cf6)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #6366f1)","var(--nice-success, #84cc16)"],he=24,je=40,ke=28,$e=6,We=4;function Oe(d,j,C,I){const E=[],F=[],L=new Map;d.forEach((b,w)=>L.set(b.hash,w));const A=new Map,M=[],N=new Map;let T=0;const W=new Map;if(j.forEach(b=>{if(!b.lastCommit)return;const w=W.get(b.lastCommit)||[];w.push({type:b.isRemote?"remote":"branch",name:b.name,commit:b.lastCommit,color:b.isHead?"var(--nice-color-success, #22c55e)":b.isRemote?"var(--nice-text-muted, #6b7280)":"var(--nice-color-primary, #3b82f6)"}),W.set(b.lastCommit,w)}),C.forEach(b=>{const w=W.get(b.commit)||[];w.push({type:"tag",name:b.name,commit:b.commit,color:"var(--nice-color-warning, #f59e0b)"}),W.set(b.commit,w)}),I){const b=W.get(I)||[];b.push({type:"head",name:"HEAD",commit:I,color:"var(--nice-color-error, #ef4444)"}),W.set(I,b)}return d.forEach((b,w)=>{let y=M.findIndex(v=>v===b.hash);y===-1&&(y=M.findIndex(v=>v===null),y===-1&&(y=M.length,M.push(null))),N.has(y)||(N.set(y,ge[T%ge.length]),T++),A.set(b.hash,y);const k=N.get(y)||ge[0];E.push({commit:b,x:y,y:w,color:k,refs:W.get(b.hash)||[]}),b.parents.forEach((v,_)=>{const a=L.get(v);if(a!==void 0){let P=A.get(v);P===void 0&&(_===0?(P=y,M[y]=v):(P=M.findIndex(R=>R===null),P===-1?(P=M.length,M.push(v)):M[P]=v),A.set(v,P));const Z=N.get(P)||k;F.push({from:b.hash,to:v,fromX:y,fromY:w,toX:P,toY:a,color:_===0?k:Z,type:_===0?y===P?"straight":"branch":"merge"})}}),(b.parents.length===0||!d.slice(w+1).some(v=>v.parents.includes(b.hash)))&&(M[y]=null)}),{nodes:E,edges:F}}const He=({nodes:d,edges:j,selectedHash:C,compact:I,onNodeClick:E,onNodeDoubleClick:F})=>{const L=I?ke:je,A=I?We:$e,N=(Math.max(...d.map(w=>w.x),0)+2)*he,T=(d.length+1)*L,W=w=>he/2+w*he,b=w=>L/2+w*L;return e.jsxs("svg",{width:N,height:T,style:{minWidth:N,minHeight:T,display:"block"},children:[j.map((w,y)=>{const k=W(w.fromX),v=b(w.fromY),_=W(w.toX),a=b(w.toY);if(w.type==="straight")return e.jsx("line",{x1:k,y1:v,x2:_,y2:a,stroke:w.color,strokeWidth:2},y);const P=(v+a)/2,Z=`M ${k} ${v} C ${k} ${P}, ${_} ${P}, ${_} ${a}`;return e.jsx("path",{d:Z,fill:"none",stroke:w.color,strokeWidth:2,strokeDasharray:w.type==="merge"?"4,2":void 0},y)}),d.map(w=>{const y=W(w.x),k=b(w.y),v=w.commit.hash===C,_=w.commit.isMerge;return e.jsxs("g",{onClick:()=>E(w.commit.hash),onDoubleClick:()=>F(w.commit.hash),style:{cursor:"pointer"},children:[v&&e.jsx("circle",{cx:y,cy:k,r:A+4,fill:"none",stroke:"var(--nice-bg, #fff)",strokeWidth:2}),e.jsx("circle",{cx:y,cy:k,r:A,fill:_?"var(--nice-bg-elevated, #1e1e1e)":w.color,stroke:w.color,strokeWidth:_?2:0}),w.refs.length>0&&!I&&e.jsx("foreignObject",{x:y+10,y:k-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:w.refs.map((a,P)=>e.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:`${a.color}22`,color:a.color,border:`1px solid ${a.color}44`},children:[a.type==="tag"?e.jsx(i.NiceIcon,{name:"tag",size:10}):a.type==="head"?e.jsx(i.NiceIcon,{name:"cursor",size:10}):null,(a.type==="tag"||a.type==="head")&&" ",a.name]},P))})})]},w.commit.hash)})]})},Se=({commits:d=ue,branches:j=ue,tags:C=ue,head:I,selectedCommit:E,branchFilter:F,authorFilter:L,dateRange:A,searchQuery:M,maxCommits:N=100,showRemotes:T=!0,showTags:W=!0,compact:b=!1,onCommitSelect:w,onCommitDoubleClick:y,onBranchCheckout:k,onBranchCreate:v,onTagCreate:_,onCherryPick:a,onRevert:P,onReset:Z,onCompare:R,onViewDiff:ee,className:q,style:H,"data-testid":u})=>{const{t:x}=i.useNiceTranslation(),[Y,D]=n.useState(E),[G,re]=n.useState(null),[J,V]=n.useState(!1),[ie,g]=n.useState(null),l=n.useRef(null),h=E??Y,z=n.useMemo(()=>{let p=d;if(F&&F.length>0){const O=new Set;j.filter(Q=>F.includes(Q.name)).forEach(Q=>{Q.lastCommit&&O.add(Q.lastCommit)}),p=p.filter(Q=>O.has(Q.hash))}if(L&&L.length>0&&(p=p.filter(O=>L.some(Q=>O.author.name.toLowerCase().includes(Q.toLowerCase())||O.author.email.toLowerCase().includes(Q.toLowerCase())))),A&&(A.from&&(p=p.filter(O=>O.date>=A.from)),A.to&&(p=p.filter(O=>O.date<=A.to))),M&&M.trim()){const O=M.toLowerCase();p=p.filter(Q=>Q.hash.toLowerCase().includes(O)||Q.shortHash.toLowerCase().includes(O)||Q.message.toLowerCase().includes(O)||Q.author.name.toLowerCase().includes(O))}return p.slice(0,N)},[d,F,L,A,M,N,j]),{nodes:f,edges:B}=n.useMemo(()=>Oe(z,T?j:j.filter(p=>!p.isRemote),W?C:[],I),[z,j,C,I,T,W]),$=n.useMemo(()=>z.find(p=>p.hash===h),[z,h]),o=n.useCallback(p=>{if(J&&ie)R?.(ie,p),V(!1),g(null);else if(J)g(p);else{D(p);const O=z.find(Q=>Q.hash===p);O&&w?.(O)}},[J,ie,z,w,R]),r=n.useCallback(p=>{const O=z.find(Q=>Q.hash===p);O&&(y?.(O),ee?.(p))},[z,y,ee]),t=n.useCallback((p,O)=>{p.preventDefault(),re({x:p.clientX,y:p.clientY,commit:O})},[]),m=n.useCallback(()=>re(null),[]),S=p=>{const Q=new Date().getTime()-p.getTime(),te=Math.floor(Q/(1e3*60*60*24));return te===0?"Today":te===1?"Yesterday":te<7?`${te} days ago`:p.toLocaleDateString()},K=b?ke:je;return e.jsxs("div",{className:`nice-git-graph ${q||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...H},"data-testid":u,onClick:m,children:[e.jsxs("div",{ref:l,style:{flex:1,overflow:"auto",display:"flex"},children:[e.jsx("div",{style:{flexShrink:0,borderRight:"1px solid var(--nice-border-color, #333)"},children:e.jsx(He,{nodes:f,edges:B,selectedHash:h,compact:b,onNodeClick:o,onNodeDoubleClick:r})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[f.map(p=>e.jsxs("div",{onClick:()=>o(p.commit.hash),onDoubleClick:()=>r(p.commit.hash),onContextMenu:O=>t(O,p.commit),style:{height:K,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:p.commit.hash===h?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderBottom:"1px solid var(--nice-bg-secondary, #2a2a2a)"},children:[p.commit.author.avatar?e.jsx("img",{src:p.commit.author.avatar,alt:"",style:{width:b?20:24,height:b?20:24,borderRadius:"50%",flexShrink:0}}):e.jsx("div",{style:{width:b?20:24,height:b?20:24,borderRadius:"50%",background:p.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:b?10:12,color:"var(--nice-color-white, #fff)",fontWeight:600,flexShrink:0},children:p.commit.author.name.charAt(0).toUpperCase()}),e.jsx("div",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:b?12:13},children:p.commit.message}),p.commit.stats&&!b&&e.jsxs("div",{style:{display:"flex",gap:8,fontSize:11,color:"var(--nice-text-muted, #888)",flexShrink:0},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",p.commit.stats.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",p.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:b?10:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace",flexShrink:0},children:p.commit.shortHash}),!b&&e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",flexShrink:0,width:100},children:p.commit.author.name}),e.jsx("span",{style:{fontSize:b?10:11,color:"var(--nice-text-muted, #666)",flexShrink:0,width:b?60:80,textAlign:"right"},children:S(p.commit.date)})]},p.commit.hash)),z.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:x("gitGraph.noCommitsMatchTheFilters","No commits match the filters")})]})]}),$&&!b&&e.jsxs("div",{style:{width:320,borderLeft:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[$.author.avatar?e.jsx("img",{src:$.author.avatar,alt:"",style:{width:32,height:32,borderRadius:"50%"}}):e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"var(--nice-color-primary, #3b82f6)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-on-primary, #fff)",fontWeight:600},children:$.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:$.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:$.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace"},children:$.hash})]}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,marginBottom:8},children:$.message}),$.body&&e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #aaa)",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:$.body})]}),$.stats&&e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:20,fontWeight:600},children:$.stats.filesChanged}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"files changed"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",$.stats.additions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"additions"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",$.stats.deletions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"deletions"})]})]}),e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>ee?.($.hash),style:{padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:x("gitGraph.viewChanges","View Changes")}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>a?.($.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.cherryPick","Cherry Pick")}),e.jsx("button",{onClick:()=>P?.($.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.revert","Revert")})]}),e.jsx("button",{onClick:()=>v?.($.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.createBranchHere","Create Branch Here")}),e.jsx("button",{onClick:()=>_?.($.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.createTagHere","Create Tag Here")}),e.jsx("button",{onClick:()=>{V(!0),g($.hash)},style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.compareWith","Compare with...")})]})]}),J&&e.jsxs("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",borderRadius:4,fontSize:12,fontWeight:500},children:[ie?`Select commit to compare with ${ie.slice(0,7)}`:"Select first commit",e.jsx("button",{onClick:()=>{V(!1),g(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(--nice-color-white, #fff)",cursor:"pointer",fontSize:11},children:x("gitGraph.cancel","Cancel")})]}),G&&e.jsx("div",{style:{position:"fixed",left:G.x,top:G.y,background:"var(--nice-bg-elevated, #252525)",border:"1px solid var(--nice-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:()=>ee?.(G.commit.hash)},{label:"Cherry Pick",onClick:()=>a?.(G.commit.hash)},{label:"Revert",onClick:()=>P?.(G.commit.hash)},{divider:!0},{label:"Create Branch",onClick:()=>v?.(G.commit.hash)},{label:"Create Tag",onClick:()=>_?.(G.commit.hash)},{divider:!0},{label:"Reset Soft",onClick:()=>Z?.(G.commit.hash,"soft")},{label:"Reset Mixed",onClick:()=>Z?.(G.commit.hash,"mixed")},{label:"Reset Hard",onClick:()=>Z?.(G.commit.hash,"hard"),danger:!0}].map((p,O)=>"divider"in p?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},O):e.jsx("button",{onClick:()=>{p.onClick?.(),m()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in p&&p.danger?"var(--nice-color-error, #ef4444)":"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:Q=>{Q.currentTarget.style.background="var(--nice-bg-tertiary, #333)"},onMouseOut:Q=>{Q.currentTarget.style.background="transparent"},children:p.label},O))})]})},Le=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:Se},Symbol.toStringTag,{value:"Module"})),me=({open:d,onSubmit:j,onCancel:C,title:I,message:E,defaultValue:F="",placeholder:L,inputType:A="text",confirmLabel:M,cancelLabel:N,className:T="",style:W})=>{const{t:b}=i.useNiceTranslation(),[w,y]=n.useState(F),k=n.useRef(null);return n.useEffect(()=>{if(d){y(F);const v=setTimeout(()=>k.current?.focus(),0);return()=>clearTimeout(v)}},[d,F]),n.useEffect(()=>{if(!d)return;const v=_=>{_.key==="Escape"&&C()};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[d,C]),d?e.jsx("div",{className:`nice-prompt-dialog ${T}`,style:W,role:"presentation",onClick:v=>{v.target===v.currentTarget&&C()},onKeyDown:v=>{v.key!=="Escape"&&v.stopPropagation()},children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"nice-prompt-title",className:"nice-prompt-dialog__panel",children:[e.jsx("h2",{id:"nice-prompt-title",className:"nice-prompt-dialog__title",children:I}),E&&e.jsx("p",{className:"nice-prompt-dialog__message",children:E}),e.jsx("input",{ref:k,type:A,value:w,placeholder:L,className:"nice-prompt-dialog__input",onChange:v=>y(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),j(w))}}),e.jsxs("div",{className:"nice-prompt-dialog__actions",children:[e.jsx("button",{type:"button",className:"nice-prompt-dialog__btn nice-prompt-dialog__btn--cancel",onClick:C,children:N??b("cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-prompt-dialog__btn nice-prompt-dialog__btn--confirm",onClick:()=>j(w),children:M??b("ok","OK")})]})]})}):null};process.env.NODE_ENV!=="production"&&(me.displayName="NicePromptDialog");function Ce(){const[d,j]=n.useState(null),C=n.useRef(null),I=n.useCallback(N=>{const T=C.current;T&&(T.kind==="prompt"?T.resolve(null):T.resolve(!1)),C.current=N,j(N)},[]),E=n.useCallback(()=>{C.current=null,j(null)},[]),F=n.useCallback(N=>new Promise(T=>I({kind:"prompt",request:N,resolve:T})),[I]),L=n.useCallback(N=>new Promise(T=>I({kind:"confirm",request:N,resolve:T})),[I]),A=n.useCallback(N=>new Promise(T=>I({kind:"alert",request:N,resolve:()=>T()})),[I]);let M=null;if(d?.kind==="prompt"){const{resolve:N,request:T}=d;M=e.jsx(me,{open:!0,...T,onSubmit:W=>{E(),N(W)},onCancel:()=>{E(),N(null)}})}else if(d){const{resolve:N,request:T,kind:W}=d;M=e.jsx(be,{visible:!0,...T,variant:T.variant??(W==="alert"?"info":"warning"),showReject:W!=="alert",onAccept:()=>{E(),N(!0)},onReject:()=>{E(),N(!1)}})}return{prompt:F,confirm:L,alert:A,element:M}}const Fe=[],we=({branches:d=Fe,currentBranch:j,defaultBranch:C="main",protectionRules:I=[],showRemotes:E=!0,selectedBranch:F,onBranchSelect:L,onCheckout:A,onCreateBranch:M,onDeleteBranch:N,onRenameBranch:T,onMerge:W,onRebase:b,onSetUpstream:w,onPush:y,onPull:k,onCompare:v,onProtectionChange:_,className:a,style:P,"data-testid":Z})=>{const{t:R}=i.useNiceTranslation(),ee=Ce(),[q,H]=n.useState(""),[u,x]=n.useState("all"),[Y,D]=n.useState(),[G,re]=n.useState(!1),[J,V]=n.useState(!1),[ie,g]=n.useState(!1),[l,h]=n.useState(""),[z,f]=n.useState(j||C),[B,$]=n.useState(""),[o,r]=n.useState(j||C),[t,m]=n.useState(null),S=F??Y,K=n.useMemo(()=>{let c=d;if(u==="local"?c=c.filter(s=>!s.isRemote):u==="remote"?c=c.filter(s=>s.isRemote):E||(c=c.filter(s=>!s.isRemote)),q.trim()){const s=q.toLowerCase();c=c.filter(U=>U.name.toLowerCase().includes(s))}return c.sort((s,U)=>s.isHead?-1:U.isHead?1:s.name===C?-1:U.name===C?1:s.isRemote!==U.isRemote?s.isRemote?1:-1:s.name.localeCompare(U.name))},[d,u,E,q,C]),p=n.useMemo(()=>{const c=K.filter(U=>!U.isRemote),s=K.filter(U=>U.isRemote);return{local:c,remote:s}},[K]),O=n.useCallback(c=>{D(c),L?.(c)},[L]),Q=n.useCallback((c,s)=>{c.preventDefault(),m({x:c.clientX,y:c.clientY,branch:s})},[]),te=n.useCallback(()=>m(null),[]),ce=n.useCallback(()=>{l.trim()&&(M?.(l.trim(),z),h(""),re(!1))},[l,z,M]),fe=n.useCallback(()=>{B&&o&&B!==o&&(W?.(B,o),V(!1))},[B,o,W]),de=c=>{if(!c)return"-";const U=new Date().getTime()-c.getTime(),ne=Math.floor(U/(1e3*60*60*24));return ne===0?"Today":ne===1?"Yesterday":ne<7?`${ne} days ago`:ne<30?`${Math.floor(ne/7)} weeks ago`:c.toLocaleDateString()},X=n.useMemo(()=>d.find(c=>c.name===S),[d,S]),se=n.useCallback(c=>I.some(s=>new RegExp(s.pattern.replace(/\*/g,".*")).test(c)),[I]),ae=p.local,le=c=>{const s=c.name===S,U=c.isHead,ne=c.name===C,_e=se(c.name);return e.jsxs("div",{onClick:()=>O(c.name),onDoubleClick:()=>A?.(c.name),onContextMenu:Ae=>Q(Ae,c),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))":U?"color-mix(in srgb, var(--nice-color-success, #22c55e) 8%, transparent)":"transparent",borderLeft:U?"3px solid var(--nice-success, #22c55e)":"3px solid transparent"},children:[e.jsx(i.NiceIcon,{name:c.isRemote?"cloud":U?"map-pin":"box",size:16}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:U?600:400,color:U?"var(--nice-color-success, #22c55e)":"var(--nice-text-primary, #e0e0e0)"},children:c.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[ne&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-primary-tint-15, #3b82f622)",color:"var(--nice-color-primary, #3b82f6)",border:"1px solid color-mix(in srgb, var(--nice-color-primary, #3b82f6) 27%, transparent)"},children:"default"}),_e&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-warning-tint-15, #f59e0b22)",color:"var(--nice-color-warning, #f59e0b)",border:"1px solid color-mix(in srgb, var(--nice-color-warning, #f59e0b) 27%, transparent)"},children:[e.jsx(i.NiceIcon,{name:"lock",size:10})," protected"]})]}),c.upstream&&(c.ahead||c.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"var(--nice-text-muted, #888)"},children:[c.ahead?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(i.NiceIcon,{name:"arrow-up",size:10}),c.ahead]}):null,c.behind?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(i.NiceIcon,{name:"arrow-down",size:10}),c.behind]}):null]}),c.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"var(--nice-text-muted, #666)",width:80,textAlign:"right"},children:de(c.lastCommit.date)})]},c.name)};return e.jsxs("div",{className:`nice-branch-manager ${a||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...P},"data-testid":Z,onClick:te,children:[ee.element,e.jsxs("div",{style:{width:350,display:"flex",flexDirection:"column",borderRight:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx(i.NiceIcon,{name:"box",size:18}),e.jsx("span",{style:{fontWeight:600,fontSize:14},children:R("branchManager.branches","Branches")}),e.jsxs("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:[d.filter(c=>!c.isRemote).length," local"]})]}),e.jsx("input",{type:"text",placeholder:R("branchManager.searchBranches","Search branches..."),value:q,onChange:c=>H(c.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",fontSize:12,marginBottom:8}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","local","remote"].map(c=>e.jsx("button",{onClick:()=>x(c),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:u===c?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:u===c?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:c},c))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>re(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"plus",size:14})," ",R("branchManager.newBranch","New Branch")]}),e.jsxs("button",{onClick:()=>V(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:14})," ",R("branchManager.merge","Merge")]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[p.local.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--nice-text-muted, #888)",textTransform:"uppercase",background:"var(--nice-bg-elevated, #252525)"},children:["Local (",p.local.length,")"]}),p.local.map(le)]}),E&&p.remote.length>0&&u!=="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--nice-text-muted, #888)",textTransform:"uppercase",background:"var(--nice-bg-elevated, #252525)",marginTop:8},children:["Remote (",p.remote.length,")"]}),p.remote.map(le)]}),K.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:12},children:R("branchManager.noBranchesMatchTheFilter","No branches match the filter")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:X?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:X.isRemote?"cloud":X.isHead?"map-pin":"box",size:24}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:X.name}),X.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:X.description})]}),X.isHead&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 12px",borderRadius:4,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--nice-color-success, #22c55e)",fontSize:12,fontWeight:500},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",R("branchManager.current","Current")]})]})}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-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(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.upstream","Upstream")}),e.jsx("div",{style:{fontSize:13},children:X.upstream||e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:R("branchManager.notSet","Not set")})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.syncStatus","Sync Status")}),e.jsx("div",{style:{display:"flex",gap:8,fontSize:13},children:X.upstream?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(i.NiceIcon,{name:"arrow-up",size:13})," ",X.ahead||0," ","ahead"]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(i.NiceIcon,{name:"arrow-down",size:13})," ",X.behind||0," ","behind"]})]}):e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"-"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.lastCommit","Last Commit")}),e.jsx("div",{style:{fontSize:13},children:X.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #aaa)"},children:X.lastCommit.hash.slice(0,7)})," ",de(X.lastCommit.date)]}):e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"-"})})]})]}),X.lastCommit&&e.jsxs("div",{style:{marginTop:16,padding:12,background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:6,fontSize:12},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:4},children:X.lastCommit.message}),e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:["by ",X.lastCommit.author]})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!X.isHead&&e.jsxs("button",{onClick:()=>A?.(X.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"map-pin",size:14})," ",R("branchManager.checkout","Checkout")]}),X.upstream&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>k?.(X.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"arrow-down",size:14})," ",R("branchManager.pull","Pull")]}),e.jsxs("button",{onClick:()=>y?.(X.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"arrow-up",size:14})," ",R("branchManager.push","Push")]})]}),!X.upstream&&!X.isRemote&&e.jsx("button",{onClick:()=>w?.(X.name,`origin/${X.name}`),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:R("branchManager.setUpstream","Set Upstream")}),e.jsxs("button",{onClick:()=>{$(X.name),r(j||C),V(!0)},style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:14})," ",R("branchManager.mergeInto","Merge into...")]}),e.jsxs("button",{onClick:()=>v?.(C,X.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:14})," ",R("branchManager.compare","Compare")]}),!X.isHead&&!X.isRemote&&!se(X.name)&&e.jsxs("button",{onClick:()=>N?.(X.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"trash",size:14})," ",R("branchManager.delete","Delete")]})]})})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:R("branchManager.selectABranchToView","Select a branch to view details")})}),G&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>re(!1),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:24},onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:R("branchManager.createNewBranch","Create New Branch")}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.branchName","Branch Name")}),e.jsx("input",{type:"text",placeholder:R("branchManager.featureMyFeature","feature/my-feature"),value:l,onChange:c=>h(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},autoFocus:!0})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.basedOn","Based on")}),e.jsx("select",{value:z,onChange:c=>f(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},children:ae.map(c=>e.jsxs("option",{value:c.name,children:[c.name," ",c.isHead?"(current)":""]},c.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>re(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:R("branchManager.cancel","Cancel")}),e.jsx("button",{onClick:ce,disabled:!l.trim(),style:{padding:"10px 20px",borderRadius:6,border:"none",background:l.trim()?"var(--nice-color-success, #22c55e)":"var(--nice-bg-tertiary, #333)",color:l.trim()?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:l.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:R("branchManager.createBranch","Create Branch")})]})]})}),J&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>V(!1),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:24},onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:R("branchManager.mergeBranches","Merge Branches")}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.mergeFrom","Merge from")}),e.jsxs("select",{value:B,onChange:c=>$(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:R("branchManager.selectBranch","Select branch...")}),ae.map(c=>e.jsx("option",{value:c.name,children:c.name},c.name))]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 0",color:"var(--nice-text-muted, #888)"},children:[e.jsx(i.NiceIcon,{name:"arrow-down",size:14})," into ",e.jsx(i.NiceIcon,{name:"arrow-down",size:14})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:R("branchManager.mergeInto2","Merge into")}),e.jsx("select",{value:o,onChange:c=>r(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},children:ae.map(c=>e.jsxs("option",{value:c.name,children:[c.name," ",c.isHead?"(current)":""]},c.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>V(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:R("branchManager.cancel","Cancel")}),e.jsx("button",{onClick:fe,disabled:!B||!o||B===o,style:{padding:"10px 20px",borderRadius:6,border:"none",background:B&&o&&B!==o?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:B&&o&&B!==o?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:B&&o&&B!==o?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:R("branchManager.merge","Merge")})]})]})}),t&&e.jsx("div",{style:{position:"fixed",left:t.x,top:t.y,background:"var(--nice-bg-elevated, #252525)",border:"1px solid var(--nice-border-color, #444)",borderRadius:6,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:160,zIndex:1e3},children:[!t.branch.isHead&&{label:"Checkout",onClick:()=>A?.(t.branch.name)},{label:"Compare",onClick:()=>v?.(C,t.branch.name)},{label:"Merge into current",onClick:()=>W?.(t.branch.name,j||C)},{divider:!0},!t.branch.isRemote&&{label:"Rename",onClick:()=>{const c=t.branch.name;ee.prompt({title:R("branchManager.renamePrompt","New branch name"),defaultValue:c}).then(s=>{s&&T?.(c,s)})}},!t.branch.isHead&&!t.branch.isRemote&&!se(t.branch.name)&&{label:"Delete",onClick:()=>N?.(t.branch.name),danger:!0}].filter(Boolean).map((c,s)=>c?"divider"in c?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},s):e.jsx("button",{onClick:()=>{c.onClick?.(),te()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in c&&c.danger?"var(--nice-color-error, #ef4444)":"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:U=>U.currentTarget.style.background="var(--nice-bg-tertiary, #333)",onMouseOut:U=>U.currentTarget.style.background="transparent",children:c.label},s):null)})]})},qe=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:we},Symbol.toStringTag,{value:"Module"})),Ge=[],Ve=[{target:".nice-merge-request-builder",titleKey:"tutorial.mergeRequestBuilder.intro.title",title:"Merge request builder",contentKey:"tutorial.mergeRequestBuilder.intro.content",content:"Pick source and target branches, write the title and description, add reviewers, labels and linked issues, then preview and submit.",placement:"auto"}],ze=({branches:d=Ge,users:j=[],labels:C=[],issues:I=[],templates:E=[],diff:F,currentBranch:L,defaultTargetBranch:A="main",initialSourceBranch:M,platform:N="github",onSubmit:T,onCancel:W,onBranchChange:b,onPreview:w,tutorial:y,className:k,style:v,"data-testid":_})=>{const{t:a}=i.useNiceTranslation(),[P,Z]=n.useState(""),[R,ee]=n.useState(""),[q,H]=n.useState(M||L||""),[u,x]=n.useState(A),[Y,D]=n.useState(!1),[G,re]=n.useState([]),[J,V]=n.useState([]),[ie,g]=n.useState([]),[l,h]=n.useState([]),[z,f]=n.useState(!1),[B,$]=n.useState(!0),[o,r]=n.useState(!1),[t,m]=n.useState(!1),[S,K]=n.useState(!1),[p,O]=n.useState(!1),Q=n.useMemo(()=>q?q.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,U=>U.toUpperCase()):"",[q]),te=n.useMemo(()=>d.filter(s=>!s.isRemote),[d]),ce=n.useCallback((s,U)=>{H(s),x(U),b?.(s,U)},[b]),fe=n.useCallback(()=>{if(!q||!u||!P.trim())return;const s={title:P.trim(),description:R.trim(),sourceBranch:q,targetBranch:u,isDraft:Y,labels:G,reviewers:J,assignees:ie,linkedIssues:l,squashCommits:z,deleteSourceBranch:B};T?.(s)},[P,R,q,u,Y,G,J,ie,l,z,B,T]),de=s=>{ee(s.content),O(!1)},X=s=>{re(U=>U.includes(s)?U.filter(ne=>ne!==s):[...U,s])},se=s=>{V(U=>U.includes(s)?U.filter(ne=>ne!==s):[...U,s])},ae=s=>{h(U=>U.includes(s)?U.filter(ne=>ne!==s):[...U,s])},le={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"}},c=q&&u&&q!==u&&P.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${k||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",position:"relative",...v},"data-testid":_,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(i.NiceTutorialButton,{steps:i.resolveTutorial(y,Ve)})}),e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:24}),e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:[Y?"Draft ":"",le[N].title]}),e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:N==="gitlab"?a("mergeRequestBuilder.createMergeRequest","Create a new merge request"):a("mergeRequestBuilder.createPullRequest","Create a new pull request")})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[e.jsxs("div",{style:{background:"var(--nice-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(--nice-text-muted, #888)",marginBottom:4},children:a("mergeRequestBuilder.from","From")}),e.jsxs("select",{value:q,onChange:s=>ce(s.target.value,u),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:a("mergeRequestBuilder.selectSourceBranch","Select source branch...")}),te.map(s=>e.jsx("option",{value:s.name,children:s.name},s.name))]})]}),e.jsx("div",{style:{padding:"20px 0 0"},children:e.jsx("span",{style:{fontSize:20,color:"var(--nice-text-muted, #888)"},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:20})})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"var(--nice-text-muted, #888)",marginBottom:4},children:a("mergeRequestBuilder.into","Into")}),e.jsx("select",{value:u,onChange:s=>ce(q,s.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13},children:te.map(s=>e.jsx("option",{value:s.name,children:s.name},s.name))})]})]}),F&&e.jsxs("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:6,display:"flex",gap:16,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",F.additions," additions"]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",F.deletions," deletions"]}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #888)"},children:[F.changedFiles," files changed"]})]}),q===u&&q&&e.jsx("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--nice-danger-tint-15, #ef444422)",color:"var(--nice-color-error, #ef4444)",borderRadius:6,fontSize:12},children:a("mergeRequestBuilder.sourceAndTargetBranchesCannot","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(--nice-text-muted, #888)",marginBottom:6},children:a("mergeRequestBuilder.title","Title")}),e.jsx("input",{type:"text",value:P,onChange:s=>Z(s.target.value),placeholder:Q||"Enter a title...",style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",fontSize:14}}),!P&&Q&&e.jsxs("button",{onClick:()=>Z(Q),style:{marginTop:4,padding:0,background:"none",border:"none",color:"var(--nice-color-primary, #3b82f6)",fontSize:11,cursor:"pointer"},children:['Use suggested: "',Q,'"']})]}),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(--nice-text-muted, #888)"},children:a("mergeRequestBuilder.description","Description")}),E.length>0&&e.jsxs("button",{onClick:()=>O(!p),style:{padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-muted, #888)",fontSize:11,cursor:"pointer"},children:[e.jsx(i.NiceIcon,{name:"edit",size:14})," ",a("mergeRequestBuilder.templates","Templates")]})]}),e.jsx("textarea",{value:R,onChange:s=>ee(s.target.value),placeholder:a("mergeRequestBuilder.describeYourChanges","Describe your changes..."),rows:8,style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",fontSize:13,resize:"vertical",fontFamily:"inherit"}})]}),p&&E.length>0&&e.jsxs("div",{style:{marginBottom:16,padding:12,background:"var(--nice-bg-elevated, #252525)",borderRadius:6,border:"1px solid var(--nice-border-color, #444)"},children:[e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:8},children:a("mergeRequestBuilder.selectTemplate","Select Template")}),E.map(s=>e.jsxs("button",{onClick:()=>de(s),style:{display:"block",width:"100%",padding:"8px 12px",marginBottom:4,borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-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(--nice-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:()=>r(!o),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"tag",size:14})," ",a("mergeRequestBuilder.labels","Labels")]}),G.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:["(",G.length,")"]})]})}),o&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:C.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:G.includes(s.id),onChange:()=>X(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:()=>m(!t),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"users",size:14})," ",a("mergeRequestBuilder.reviewers","Reviewers")]}),J.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["(",J.length,")"]})]})}),t&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:j.map(s=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:J.includes(s.id),onChange:()=>se(s.id)}),s.avatar?e.jsx("img",{src:s.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-bg-tertiary, #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:()=>K(!S),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"link",size:14})," ",a("mergeRequestBuilder.linkedIssues","Linked Issues")]}),l.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-accent, #8b5cf6)"},children:["(",l.length,")"]})]})}),S&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:I.filter(s=>s.state==="open").map(s=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.includes(s.id),onChange:()=>ae(s.id)}),e.jsxs("span",{style:{fontSize:12,color:"var(--nice-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(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:Y,onChange:s=>D(s.target.checked)}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"edit",size:14})," ",a("mergeRequestBuilder.createAsDraft","Create as Draft")]})]})})]}),e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:16,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:12},children:a("mergeRequestBuilder.mergeOptions","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:z,onChange:s=>f(s.target.checked)}),a("mergeRequestBuilder.squashCommitsOnMerge","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:B,onChange:s=>$(s.target.checked)}),a("mergeRequestBuilder.deleteSourceBranchAfterMerge","Delete source branch after merge")]})]})]}),F&&F.files.length>0&&e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:16},children:[e.jsxs("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:12},children:["Changed Files (",F.changedFiles,")"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto"},children:F.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(--nice-color-success, #22c55e)":s.status==="deleted"?"var(--nice-color-error, #ef4444)":s.status==="renamed"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-warning, #f59e0b)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,color:"var(--nice-color-white, #fff)"},children:s.status==="added"?"+":s.status==="deleted"?"-":s.status==="renamed"?"R":"M"}),e.jsx("span",{style:{flex:1,fontFamily:"monospace",fontSize:11},children:s.path}),e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)",fontSize:11},children:["+",s.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)",fontSize:11},children:["-",s.deletions]})]},s.path))})]})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:W,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:13},children:a("mergeRequestBuilder.cancel","Cancel")}),e.jsx("button",{onClick:()=>w?.({title:P,description:R,sourceBranch:q,targetBranch:u,isDraft:Y,labels:G,reviewers:J,assignees:ie,linkedIssues:l,squashCommits:z,deleteSourceBranch:B}),disabled:!c,style:{padding:"10px 20px",borderRadius:6,border:"none",background:c?"var(--nice-bg-tertiary, #333)":"var(--nice-bg-elevated, #222)",color:c?"var(--nice-text-primary, #fff)":"var(--nice-text-muted, #666)",cursor:c?"pointer":"not-allowed",fontSize:13},children:a("mergeRequestBuilder.preview","Preview")}),e.jsx("button",{onClick:fe,disabled:!c,style:{padding:"10px 24px",borderRadius:6,border:"none",background:c?"var(--nice-color-success, #22c55e)":"var(--nice-bg-elevated, #222)",color:c?"var(--nice-color-white, #fff)":"var(--nice-text-muted, #666)",cursor:c?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:Y?"Create Draft":le[N].btn})]})]})},Ue=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:ze},Symbol.toStringTag,{value:"Module"})),Ye=[],Re=({files:d=Ye,viewMode:j,showWhitespace:C,comments:I=[],selectedFile:E,showFileTree:F=!0,contextLines:L=3,baseRef:A,headRef:M,onFileSelect:N,onViewModeChange:T,onAddComment:W,onResolveComment:b,onExpandChunk:w,className:y,style:k,"data-testid":v})=>{const{t:_}=i.useNiceTranslation(),[a,P]=n.useState("split"),[Z,R]=n.useState(!1),[ee,q]=n.useState(void 0),[H,u]=n.useState(new Set),[x,Y]=n.useState(null),D=j??a,G=C??Z,re=E??ee??d[0]?.path,J=n.useMemo(()=>d.find(o=>o.path===re),[d,re]),V=n.useMemo(()=>({additions:d.reduce((o,r)=>o+r.additions,0),deletions:d.reduce((o,r)=>o+r.deletions,0)}),[d]),ie=n.useCallback(o=>{q(o),N?.(o)},[N]),g=n.useCallback(o=>{P(o),T?.(o)},[T]),l=n.useCallback((o,r)=>{const t=`${o}:${r}`;u(m=>{const S=new Set(m);return S.has(t)?S.delete(t):S.add(t),S}),w?.(o,r)},[w]),h=n.useMemo(()=>I.filter(o=>o.filePath===re),[I,re]),z=o=>{switch(o){case"added":return{icon:"+",color:"var(--nice-color-success, #22c55e)"};case"deleted":return{icon:"-",color:"var(--nice-color-error, #ef4444)"};case"modified":return{icon:"M",color:"var(--nice-color-warning, #f59e0b)"};case"renamed":return{icon:"R",color:"var(--nice-color-primary, #3b82f6)"};case"copied":return{icon:"C",color:"var(--nice-color-accent, #8b5cf6)"}}},f=(o,r,t)=>{const m=o.type==="addition"?"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))":o.type==="deletion"?"var(--nice-danger-tint-10, rgba(239, 68, 68, 0.1))":o.type==="header"?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent",S=o.type==="addition"?"var(--nice-success-text, #4ade80)":o.type==="deletion"?"var(--nice-danger-text, #f87171)":o.type==="header"?"var(--nice-info-text, #60a5fa)":"var(--nice-text-primary, #e0e0e0)",K=t==="old"?o.lineNumberOld:t==="new"?o.lineNumberNew:void 0,p=G?o.content.replace(/ /g,"·").replace(/\t/g,"→ "):o.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:m,minHeight:20,fontSize:12,fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:[K!==void 0&&e.jsx("div",{style:{minWidth:50,padding:"0 8px",textAlign:"right",color:"var(--nice-text-muted, #666)",background:"var(--nice-overlay-20, rgba(0, 0, 0, 0.2))",userSelect:"none",borderRight:"1px solid var(--nice-border-color, #333)"},children:K}),D==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:S,fontWeight:600},children:o.type==="addition"?"+":o.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:S,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:p||" "}),W&&K&&o.type!=="header"&&e.jsx("button",{onClick:()=>Y({filePath:re,line:K,side:t||"new",body:""}),style:{width:24,border:"none",background:"transparent",color:"var(--nice-color-primary, #3b82f6)",cursor:"pointer",opacity:.3,transition:"opacity 0.2s"},onMouseEnter:O=>O.currentTarget.style.opacity="1",onMouseLeave:O=>O.currentTarget.style.opacity="0.3","aria-label":_("gitDiffViewer.addComment","Add comment"),children:e.jsx(i.NiceIcon,{name:"message",size:14})})]},`${r}-${t||"unified"}`)},B=o=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:o.chunks.map((r,t)=>{const m=`${o.path}:${t}`;return H.has(m),e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>l(o.path,t),style:{padding:"6px 12px",background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderBottom:"1px solid var(--nice-border-color, #333)",fontSize:11,color:"var(--nice-color-primary-light, #60a5fa)",cursor:"pointer",fontFamily:"monospace"},children:["@@ -",r.oldStart,",",r.oldLines," +",r.newStart,",",r.newLines," @@"," ",r.header||""]}),r.lines.map((S,K)=>f(S,K))]},t)})}),$=o=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:o.chunks.map((r,t)=>{const m=[],S=[];for(const p of r.lines)(p.type==="deletion"||p.type==="context")&&m.push(p),(p.type==="addition"||p.type==="context")&&S.push(p);const K=Math.max(m.length,S.length);for(;m.length<K;)m.push({content:"",type:"context"});for(;S.length<K;)S.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(--nice-border-color, #333)",fontSize:11,color:"var(--nice-color-primary-light, #60a5fa)",fontFamily:"monospace"},children:["@@ -",r.oldStart,",",r.oldLines," +",r.newStart,",",r.newLines," @@"," ",r.header||""]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flex:1,borderRight:"1px solid var(--nice-border-color, #444)"},children:m.map((p,O)=>f(p,O,"old"))}),e.jsx("div",{style:{flex:1},children:S.map((p,O)=>f(p,O,"new"))})]})]},t)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${y||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...k},"data-testid":v,children:[F&&e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx(i.NiceIcon,{name:"folder",size:16}),e.jsx("span",{style:{fontWeight:600,fontSize:13},children:_("gitDiffViewer.changedFiles","Changed Files")}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:d.length})]}),(A||M)&&e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:[A&&e.jsx("span",{children:A}),A&&M&&e.jsx("span",{style:{margin:"0 4px"},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:12})}),M&&e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:M})]})]}),e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:12,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",V.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",V.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:d.map(o=>{const r=z(o.status),t=o.path===re;return e.jsxs("div",{onClick:()=>ie(o.path),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",background:t?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:t?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:2,background:r.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-color-white, #fff)",fontWeight:600},children:r.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[o.additions>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",o.additions]}),o.deletions>0&&e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",o.deletions]})]})]},o.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(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",gap:16},children:[J&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:J.oldPath&&J.oldPath!==J.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:J.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"var(--nice-text-muted, #888)"},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:12})}),e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:J.path})]}):J.path}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>g("unified"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:D==="unified"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:D==="unified"?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:_("gitDiffViewer.unified","Unified")}),e.jsx("button",{onClick:()=>g("split"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:D==="split"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:D==="split"?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:_("gitDiffViewer.split","Split")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--nice-text-muted, #888)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:G,onChange:o=>R(o.target.checked)}),_("gitDiffViewer.showWhitespace","Show whitespace")]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:J?J.binary?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #888)"},children:[e.jsx(i.NiceIcon,{name:"box",size:48}),e.jsx("p",{children:_("gitDiffViewer.binaryFileCannotBeDisplayed","Binary file cannot be displayed")})]}):D==="split"?$(J):B(J):e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #666)"},children:_("gitDiffViewer.selectAFileToView","Select a file to view changes")})}),h.length>0&&e.jsxs("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",maxHeight:200,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,borderBottom:"1px solid var(--nice-border-color, #333)"},children:["Comments (",h.length,")"]}),h.map(o=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)",opacity:o.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[o.author.avatar?e.jsx("img",{src:o.author.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-bg-tertiary, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:o.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:o.author.name}),e.jsx("span",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:(o.side==="old"?_("gitDiffViewer.lineOld","Line {line} (old)"):_("gitDiffViewer.lineNew","Line {line} (new)")).replace("{line}",String(o.line))}),o.resolved&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--nice-color-success, #22c55e)"},children:_("gitDiffViewer.resolved","Resolved")}),b&&!o.resolved&&e.jsx("button",{onClick:()=>b(o.id),style:{marginLeft:"auto",padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:10},children:_("gitDiffViewer.resolve","Resolve")})]}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-secondary, #ccc)"},children:o.body})]},o.id))]}),x&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>Y(null),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:20},onClick:o=>o.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 12px",fontSize:14},children:_("gitDiffViewer.addCommentOnLine","Add comment on line {line}").replace("{line}",String(x.line))}),e.jsx("textarea",{value:x.body,onChange:o=>Y({...x,body:o.target.value}),placeholder:_("gitDiffViewer.writeAComment","Write a comment..."),rows:4,style:{width:"100%",padding:12,borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:13,resize:"vertical"},autoFocus:!0}),e.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>Y(null),style:{padding:"8px 16px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:_("gitDiffViewer.cancel","Cancel")}),e.jsx("button",{onClick:()=>{x.body.trim()&&(W?.(x.filePath,x.line,x.side,x.body.trim()),Y(null))},disabled:!x.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:x.body.trim()?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:x.body.trim()?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:x.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:_("gitDiffViewer.addComment2","Add Comment")})]})]})})]})]})},Je=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:Re},Symbol.toStringTag,{value:"Module"})),Ke=(d,j)=>{const I=new Date().getTime()-d.getTime(),E=Math.floor(I/(1e3*60*60*24));return E===0?"today":E===1?"yesterday":E<7?`${E} days ago`:E<30?`${Math.floor(E/7)} weeks ago`:E<365?`${Math.floor(E/30)} months ago`:`${Math.floor(E/365)} years ago`},Xe=d=>{const C=new Date().getTime()-d.getTime(),I=Math.floor(C/(1e3*60*60*24));return I<7?"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))":I<30?"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))":I<90?"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))":I<365?"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))":"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))"},oe=d=>{const j=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-info, #06b6d4)","var(--nice-color-accent-pink, #ec4899)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--nice-color-accent, #6366f1)"];let C=0;for(let I=0;I<d.length;I++)C=(C<<5)-C+d.charCodeAt(I),C=C&C;return j[Math.abs(C)%j.length]},Ie=({file:d,viewMode:j="inline",showAgeHeatmap:C=!0,showAvatars:I=!0,groupHunks:E=!0,highlightOnHover:F=!0,timeZone:L,dateRange:A,authorFilter:M,selectedLine:N,syntaxTheme:T="dark",onLineClick:W,onCommitClick:b,onAuthorClick:w,onBlameParent:y,className:k,style:v,"data-testid":_="nice-git-blame"})=>{const{t:a}=i.useNiceTranslation(),[P,Z]=n.useState(null),[R,ee]=n.useState(null),[q,H]=n.useState(null),u=n.useMemo(()=>{const l=[];return d.hunks.forEach(h=>{h.lines.forEach(z=>{l.push(z)})}),l.sort((h,z)=>h.lineNumber-z.lineNumber)},[d.hunks]),x=n.useMemo(()=>u.filter(l=>!(A?.from&&l.commit.timestamp<A.from||A?.to&&l.commit.timestamp>A.to||M&&M.length>0&&!M.includes(l.commit.author.id))),[u,A,M]),Y=n.useMemo(()=>{if(!E)return x.map(f=>({startLine:f.lineNumber,endLine:f.lineNumber,commit:f.commit,lines:[f],isFirstOfCommit:!0}));const l=[];let h=null;const z=new Set;return x.forEach(f=>{if(!h||h.commit.id!==f.commit.id){const B=!z.has(f.commit.id);z.add(f.commit.id),h={startLine:f.lineNumber,endLine:f.lineNumber,commit:f.commit,lines:[f],isFirstOfCommit:B},l.push(h)}else h.endLine=f.lineNumber,h.lines.push(f)}),l},[x,E]),D=n.useMemo(()=>{const l=new Map;return u.forEach(h=>{l.has(h.commit.author.id)||l.set(h.commit.author.id,h.commit.author)}),Array.from(l.values())},[u]),G=n.useMemo(()=>{const l=new Map;return u.forEach(h=>{l.has(h.commit.id)||l.set(h.commit.id,h.commit)}),Array.from(l.values()).sort((h,z)=>z.timestamp.getTime()-h.timestamp.getTime())},[u]),re=n.useCallback(l=>{W?.(l)},[W]),J=n.useCallback((l,h)=>{h.stopPropagation(),R===l.id?ee(null):ee(l.id),b?.(l)},[R,b]),V=(l,h)=>{const z=h===0,f=l.commit,B=F&&P===f.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:j==="inline"?280:40,background:B?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":C?Xe(f.timestamp):"transparent",borderRight:`3px solid ${oe(f.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>Z(f.id),onMouseLeave:()=>Z(null),onClick:$=>J(f,$),children:[z&&j==="inline"&&e.jsxs(e.Fragment,{children:[I&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(f.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"var(--nice-text-primary, #0f172a)",fontWeight:500,flexShrink:0},title:f.author.name,children:f.author.avatar?e.jsx("img",{src:f.author.avatar,alt:f.author.name,style:{width:"100%",height:"100%",borderRadius:"50%"}}):f.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(--nice-text-muted, #6b7280)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.shortId}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #9ca3af)",whiteSpace:"nowrap"},children:Ke(f.timestamp)})]})]}),j==="gutter"&&z&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(f.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-text-primary, #0f172a)"},title:`${f.author.name} - ${f.shortId}
2
+ ${f.message}`,children:f.author.name[0].toUpperCase()})]})},ie=l=>{if(q!==l.lineNumber||j!=="tooltip")return null;const h=l.commit;return e.jsxs("div",{style:{position:"absolute",left:60,top:-8,zIndex:100,background:"var(--nice-bg-elevated, #ffffff)",border:"1px solid var(--nice-border-color, #e2e8f0)",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(h.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-primary, #0f172a)",fontWeight:500},children:h.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--nice-text-secondary, #475569)"},children:h.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #9ca3af)"},children:h.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:4},children:h.shortId}),e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #475569)",marginBottom:8},children:h.message}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:h.timestamp.toLocaleString()}),h.parents&&h.parents.length>0&&y&&e.jsxs("button",{onClick:()=>y(h),style:{marginTop:8,padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-secondary, #475569)",fontSize:11,cursor:"pointer"},children:[e.jsx(i.NiceIcon,{name:"arrow-up",size:11})," ",a("gitBlame.blameParent","Blame parent")]})]})},g=l=>R!==l.id?null:e.jsx("div",{style:{background:"var(--nice-bg-elevated, #ffffff)",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",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(l.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-primary, #0f172a)",fontSize:20,fontWeight:500,flexShrink:0},children:l.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--nice-text-secondary, #475569)"},children:l.author.name}),e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:l.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:8},children:l.id}),e.jsx("div",{style:{fontSize:14,color:"var(--nice-text-secondary, #475569)",marginBottom:8,lineHeight:1.5},children:l.message}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,fontSize:12,color:"var(--nice-text-muted, #9ca3af)"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(i.NiceIcon,{name:"calendar",size:12})," ",l.timestamp.toLocaleString()]}),l.parents&&l.parents.length>0&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(i.NiceIcon,{name:"cursor",size:12})," ",l.parents.length," parent(s)"]})]}),y&&l.parents&&l.parents.length>0&&e.jsxs("button",{onClick:()=>y(l),style:{marginTop:12,padding:"6px 12px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer"},children:[e.jsx(i.NiceIcon,{name:"arrow-up",size:12})," ",a("gitBlame.blameInParentCommit","Blame in parent commit")]})]})]})});return e.jsxs("div",{className:`nice-git-blame ${k||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:T==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:T==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #ffffff)",fontFamily:"system-ui, sans-serif",...v},"data-testid":_,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:T==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:"clipboard",size:16}),e.jsx("span",{style:{fontWeight:500},children:d.path}),e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:["at ",d.revision.substring(0,7)]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:[G.length," commits by ",D.length," author(s)"]})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:T==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",flexWrap:"wrap"},children:[D.slice(0,10).map(l=>e.jsxs("div",{onClick:()=>w?.(l),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:oe(l.id)}}),e.jsx("span",{style:{fontSize:12},children:l.name})]},l.id)),D.length>10&&e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:["+",D.length-10," more"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:Y.map((l,h)=>e.jsxs(n.Fragment,{children:[l.isFirstOfCommit&&R===l.commit.id&&g(l.commit),l.lines.map((z,f)=>e.jsxs("div",{onClick:()=>re(z),onMouseEnter:()=>H(z.lineNumber),onMouseLeave:()=>H(null),style:{display:"flex",alignItems:"stretch",background:N===z.lineNumber?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":F&&P===l.commit.id?"var(--nice-primary-tint-8, rgba(59, 130, 246, 0.08))":"transparent",borderLeft:N===z.lineNumber?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",position:"relative"},children:[V(l,f),e.jsx("div",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:50,userSelect:"none",background:T==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-secondary, #f6f8fa)",borderRight:"1px solid var(--nice-border, #30363d)"},children:z.lineNumber}),e.jsx("div",{style:{flex:1,padding:"0 16px",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:z.content}),j==="tooltip"&&ie(z)]},z.lineNumber))]},`${l.commit.id}-${l.startLine}`))}),C&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:T==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:11,color:"var(--nice-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"})]})]})]})},Ze=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:Ie},Symbol.toStringTag,{value:"Module"})),Qe=d=>{if(!d.resolved)return[];switch(d.resolution){case"ours":return d.oursContent;case"theirs":return d.theirsContent;case"both":return[...d.oursContent,...d.theirsContent];case"custom":return d.customContent||[];default:return[]}},Ne=({file:d,context:j,viewMode:C="split",showLineNumbers:I=!0,showBase:E=!1,currentConflictIndex:F,syntaxTheme:L="dark",onResolve:A,onResolveAll:M,onNavigateConflict:N,onSave:T,onCancel:W,className:b,style:w,"data-testid":y="nice-git-conflict-resolver"})=>{const{t:k}=i.useNiceTranslation(),[v,_]=n.useState(d.conflicts),[a,P]=n.useState(F??0),[Z,R]=n.useState(null),[ee,q]=n.useState(""),H=n.useMemo(()=>v.filter(f=>!f.resolved).length,[v]),u=n.useMemo(()=>v.filter(f=>f.resolved).length,[v]),x=v[a],Y=n.useCallback((f,B,$)=>{_(r=>r.map(t=>t.id===f?{...t,resolved:!0,resolution:B,customContent:$}:t)),R(null),A?.(f,B,$);const o=v.findIndex((r,t)=>t>a&&!r.resolved);o!==-1&&(P(o),N?.(o))},[v,a,A,N]),D=n.useCallback(f=>{_(B=>B.map($=>$.resolved?$:{...$,resolved:!0,resolution:f})),M?.(f)},[M]),G=n.useCallback(f=>{const B=f==="prev"?Math.max(0,a-1):Math.min(v.length-1,a+1);P(B),N?.(B)},[a,v.length,N]),re=n.useCallback(()=>{x&&(R(x.id),q(x.oursContent.join(`
3
+ `)))},[x]),J=n.useCallback(()=>{Z&&Y(Z,"custom",ee.split(`
4
+ `))},[Z,ee,Y]),V=n.useCallback(()=>{const f=d.content.split(`
5
+ `);let B=[],$=0;v.forEach(o=>{B=[...B,...f.slice($,o.startLine-1)],B=[...B,...Qe(o)],$=o.endLine}),B=[...B,...f.slice($)],T?.(B.join(`
6
+ `))},[d.content,v,T]),ie=(f,B,$,o)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${$}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${$}20`,borderBottom:"1px solid var(--nice-border, #30363d)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:$},children:f}),o&&e.jsx("button",{onClick:o,style:{padding:"4px 10px",background:$,border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.accept","Accept")})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:B.map((r,t)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:L==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #fff)"},children:[I&&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:t+1}),e.jsx("span",{style:{padding:"0 12px",whiteSpace:"pre"},children:r||" "})]},t))})]}),g=()=>x?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(--nice-color-success, #22c55e)",fontWeight:500},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",j?.oursCommit.branch||"HEAD")]}),e.jsx("button",{onClick:()=>Y(x.id,"ours"),style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.acceptOurs","Accept Ours")})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:x.oursContent.join(`
7
+ `)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--nice-bg-elevated, #ffffff)"},children:[e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-border-color, #e2e8f0)"}}),e.jsx("span",{style:{color:"var(--nice-text-muted, #9ca3af)",fontSize:11},children:"VS"}),e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-border-color, #e2e8f0)"}})]}),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(--nice-color-primary, #3b82f6)",fontWeight:500},children:[e.jsx(i.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",j?.theirsCommit.branch||"incoming")]}),e.jsx("button",{onClick:()=>Y(x.id,"theirs"),style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.acceptTheirs","Accept Theirs")})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:x.theirsContent.join(`
8
+ `)})]})]}):null,l=()=>x?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[ie(e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",j?.oursCommit.branch||"HEAD")]}),x.oursContent,"var(--nice-color-success, #22c55e)",()=>Y(x.id,"ours")),E&&ie(k("gitConflictResolver.baseAncestor","Base (ancestor)"),x.baseContent,"var(--nice-text-muted, #6b7280)"),ie(e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",j?.theirsCommit.branch||"incoming")]}),x.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>Y(x.id,"theirs"))]}):null,h=()=>x?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[ie(e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",j?.oursCommit.branch||"HEAD")]}),x.oursContent,"var(--nice-color-success, #22c55e)",()=>Y(x.id,"ours")),ie(k("gitConflictResolver.base","Base"),x.baseContent,"var(--nice-text-muted, #6b7280)"),ie(e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",j?.theirsCommit.branch||"incoming")]}),x.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>Y(x.id,"theirs"))]}):null,z=()=>Z!==x?.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(--nice-bg-elevated, #ffffff)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:500},children:[e.jsx(i.NiceIcon,{name:"edit",size:14})," ",k("gitConflictResolver.editResolution","Edit Resolution")]}),e.jsx("button",{onClick:()=>R(null),"aria-label":k("gitConflictResolver.closeEditor","Close editor"),style:{background:"transparent",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:18},children:e.jsx(i.NiceIcon,{name:"close",size:18})})]}),e.jsx("textarea",{value:ee,onChange:f=>q(f.target.value),style:{width:"100%",height:300,padding:16,fontFamily:"monospace",fontSize:13,background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",border:"none",resize:"none"}}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>R(null),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:k("gitConflictResolver.cancel","Cancel")}),e.jsx("button",{onClick:J,style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:k("gitConflictResolver.saveChanges","Save Changes")})]})]})});return e.jsxs("div",{className:`nice-git-conflict-resolver ${b||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:L==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:L==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #ffffff)",fontFamily:"system-ui, sans-serif",position:"relative",...w},"data-testid":y,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:L==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:"warning",size:18}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:d.path}),e.jsxs("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:[v.length," conflict(s) • ",u," resolved • ",H," ","remaining"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:W,style:{padding:"6px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:k("gitConflictResolver.cancel","Cancel")}),e.jsxs("button",{onClick:V,disabled:H>0,style:{padding:"6px 12px",background:H>0?"var(--nice-bg-tertiary, #e2e8f0)":"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:H>0?"var(--nice-text-muted, #94a3b8)":"var(--nice-color-white, #fff)",cursor:H>0?"not-allowed":"pointer",opacity:H>0?.5:1,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.saveResolved","Save Resolved")]})]})]}),j&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:L==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursLabel","Ours:")]}),e.jsx("span",{children:j.oursCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",j.oursCommit.shortId,")"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:[e.jsx(i.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsLabel","Theirs:")]}),e.jsx("span",{children:j.theirsCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",j.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:L==="dark"?"var(--nice-bg-elevated, #ffffff)":"var(--nice-bg-secondary, #f0f0f0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("button",{onClick:()=>G("prev"),disabled:a===0,style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:a===0?"not-allowed":"pointer",opacity:a===0?.5:1},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.prev","Prev")]}),e.jsxs("span",{style:{padding:"0 8px"},children:[k("gitConflictResolver.conflictOf","Conflict {current} of {total}").replace("{current}",String(a+1)).replace("{total}",String(v.length)),x?.resolved&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:8,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.resolved","Resolved")]})]}),e.jsxs("button",{onClick:()=>G("next"),disabled:a===v.length-1,style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:a===v.length-1?"not-allowed":"pointer",opacity:a===v.length-1?.5:1},children:[k("gitConflictResolver.next","Next")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>D("ours"),disabled:H===0,style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:H===0?"not-allowed":"pointer",opacity:H===0?.5:1},children:k("gitConflictResolver.acceptAllOurs","Accept All Ours")}),e.jsx("button",{onClick:()=>D("theirs"),disabled:H===0,style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:H===0?"not-allowed":"pointer",opacity:H===0?.5:1},children:k("gitConflictResolver.acceptAllTheirs","Accept All Theirs")})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[x&&!x.resolved&&e.jsxs(e.Fragment,{children:[C==="inline"&&g(),C==="split"&&l(),C==="three-way"&&h()]}),x?.resolved&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(i.NiceIcon,{name:"check",size:48}),e.jsx("span",{style:{fontSize:18},children:k("gitConflictResolver.conflictResolved","Conflict Resolved")}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontSize:13},children:["Resolution: ",x.resolution]}),e.jsxs("button",{onClick:()=>_(f=>f.map(B=>B.id===x.id?{...B,resolved:!1,resolution:void 0}:B)),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"reply",size:14})," ",k("gitConflictResolver.reResolve","Re-resolve")]})]})]}),x&&!x.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:L==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("button",{onClick:()=>Y(x.id,"ours"),style:{padding:"8px 20px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.acceptOurs","Accept Ours")]}),e.jsxs("button",{onClick:()=>Y(x.id,"theirs"),style:{padding:"8px 20px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.acceptTheirs","Accept Theirs")]}),e.jsxs("button",{onClick:()=>Y(x.id,"both"),style:{padding:"8px 20px",background:"var(--nice-color-accent, #8b5cf6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:14})," ",k("gitConflictResolver.acceptBoth","Accept Both")]}),e.jsxs("button",{onClick:re,style:{padding:"8px 20px",background:"var(--nice-color-warning, #f59e0b)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"edit",size:14})," ",k("gitConflictResolver.editManually","Edit Manually")]})]}),z()]})},er=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:Ne},Symbol.toStringTag,{value:"Module"})),pe={"pre-commit":{title:"Pre-commit",description:"Runs before commit is created. Good for linting and formatting.",icon:"check"},"prepare-commit-msg":{title:"Prepare Commit Message",description:"Runs before commit message editor opens. Can modify default message.",icon:"edit"},"commit-msg":{title:"Commit Message",description:"Validates commit message format (e.g., conventional commits).",icon:"message"},"post-commit":{title:"Post-commit",description:"Runs after commit is created. Good for notifications.",icon:"upload"},"pre-push":{title:"Pre-push",description:"Runs before push. Good for running tests.",icon:"rocket"},"pre-rebase":{title:"Pre-rebase",description:"Runs before rebase starts.",icon:"shuffle"},"post-merge":{title:"Post-merge",description:"Runs after merge completes. Good for dependency updates.",icon:"link"},"post-checkout":{title:"Post-checkout",description:"Runs after checkout completes.",icon:"download"},"pre-auto-gc":{title:"Pre-auto GC",description:"Runs before automatic garbage collection.",icon:"trash"}},rr=[{id:"eslint-staged",name:"ESLint (staged files)",description:"Run ESLint on staged JavaScript/TypeScript files",icon:"search",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:"edit",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:"flask",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:"book",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:"clipboard",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:"lock",category:"security",hook:"pre-commit",actions:[{type:"custom",name:"Detect Secrets",command:"npx secretlint",runOn:"staged",enabled:!0,failOnError:!0}]}],Be=({hooks:d,defaultHooks:j,templates:C=rr,manager:I="husky",repoPath:E,selectedHook:F,onHookChange:L,onHooksChange:A,onHookToggle:M,onActionAdd:N,onActionRemove:T,onActionUpdate:W,onInstall:b,onUninstall:w,onExport:y,className:k,style:v,"data-testid":_="nice-git-hooks"})=>{const{t:a}=i.useNiceTranslation(),P=d!==void 0&&A!==void 0,Z=n.useRef([]),R=n.useCallback(r=>{const t=Z.current;Z.current=r,L&&r.filter(m=>!t.includes(m)).forEach(m=>L(m)),A?.(r)},[L,A]),[ee,q]=i.useControllableState({value:P?d:void 0,defaultValue:P?j:j??d,fallbackValue:[],onChange:R,componentName:"NiceGitHooks"});Z.current=ee,ye("NiceGitHooks","hooks","onHooksChange",d,P);const[H,u]=n.useState(F||null),[x,Y]=n.useState(!1),[D,G]=n.useState(null),[re,J]=n.useState(!1),V=n.useMemo(()=>ee.find(r=>r.type===H),[ee,H]),ie=n.useCallback((r,t)=>{q(m=>m.map(S=>S.type===r?{...S,enabled:t}:S)),M?.(r,t)},[M,q]),g=n.useCallback(r=>{if(!H)return;const t=r?r.actions.map((m,S)=>({...m,id:i.createId(),order:(V?.actions.length||0)+S})):[{id:i.createId(),type:"custom",name:"New Action",command:'echo "Hello"',order:V?.actions.length||0,enabled:!0,failOnError:!0}];q(m=>m.map(S=>S.type===H?{...S,actions:[...S.actions,...t]}:S)),t.forEach(m=>N?.(H,m)),Y(!1)},[H,V,N,q]),l=n.useCallback(r=>{H&&(q(t=>t.map(m=>m.type===H?{...m,actions:m.actions.filter(S=>S.id!==r)}:m)),T?.(H,r))},[H,T,q]),h=n.useCallback(r=>{H&&(q(t=>t.map(m=>m.type===H?{...m,actions:m.actions.map(S=>S.id===r.id?r:S)}:m)),G(null),W?.(H,r))},[H,W,q]),z=n.useCallback((r,t)=>{if(!V)return;const m=[...V.actions],S=m.findIndex(p=>p.id===r);if(S===-1)return;const K=t==="up"?S-1:S+1;K<0||K>=m.length||([m[S],m[K]]=[m[K],m[S]],m.forEach((p,O)=>p.order=O),q(p=>p.map(O=>O.type===H?{...O,actions:m}:O)))},[V,H,q]),f=n.useCallback(r=>{const t=["#!/bin/sh",""];return r.verbose&&t.push("set -x"),t.push("# Generated by NiceGitHooks",`# Hook: ${r.type}`,""),r.actions.forEach(m=>{if(!m.enabled){t.push(`# [DISABLED] ${m.name}`);return}if(t.push(`# ${m.name}`),m.condition){const{type:K,operator:p,value:O}=m.condition;K==="branch"?(t.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),p==="equals"?t.push(`if [ "$BRANCH" != "${O}" ]; then exit 0; fi`):p==="matches"&&t.push(`if ! echo "$BRANCH" | grep -q "${O}"; then exit 0; fi`)):K==="env"&&t.push(`if [ -z "$${O}" ]; then exit 0; fi`)}let S=m.command;m.runOn==="staged"&&m.filePatterns?.length&&(m.filePatterns.map(K=>`'${K}'`).join(" "),S=`git diff --cached --name-only --diff-filter=ACM | grep -E "${m.filePatterns.join("|")}" | xargs ${S}`),t.push(S),m.failOnError&&(t.push("if [ $? -ne 0 ]; then"),t.push(` echo "❌ ${m.name} failed""`),t.push(" exit 1"),t.push("fi")),t.push("")}),t.push("exit 0"),t.join(`
9
+ `)},[]),B=r=>({lint:"search",test:"flask",format:"edit",typecheck:"book",build:"settings",custom:"settings"})[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(--nice-bg-elevated, #ffffff)",borderRadius:12,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"edit",size:16})," ",a("gitHooks.editAction","Edit Action")]}),e.jsx("button",{onClick:()=>G(null),"aria-label":a("gitHooks.close","Close"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(i.NiceIcon,{name:"close",size:18})})]}),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(--nice-text-muted, #9ca3af)",marginBottom:4},children:a("gitHooks.name","Name")}),e.jsx("input",{type:"text",value:D.name,onChange:r=>G({...D,name:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:a("gitHooks.type","Type")}),e.jsxs("select",{value:D.type,onChange:r=>G({...D,type:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"},children:[e.jsx("option",{value:"lint",children:a("gitHooks.lint","Lint")}),e.jsx("option",{value:"test",children:a("gitHooks.test","Test")}),e.jsx("option",{value:"format",children:a("gitHooks.format","Format")}),e.jsx("option",{value:"typecheck",children:a("gitHooks.typecheck","Typecheck")}),e.jsx("option",{value:"build",children:a("gitHooks.build","Build")}),e.jsx("option",{value:"custom",children:a("gitHooks.custom","Custom")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:a("gitHooks.command","Command")}),e.jsx("textarea",{value:D.command,onChange:r=>G({...D,command:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",fontFamily:"monospace",minHeight:80,resize:"vertical"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:a("gitHooks.runOn","Run On")}),e.jsxs("select",{value:D.runOn||"all",onChange:r=>G({...D,runOn:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"},children:[e.jsx("option",{value:"all",children:a("gitHooks.allFiles","All files")}),e.jsx("option",{value:"staged",children:a("gitHooks.stagedFilesOnly","Staged files only")}),e.jsx("option",{value:"changed",children:a("gitHooks.changedFiles","Changed files")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"File Patterns (comma-separated)"}),e.jsx("input",{type:"text",value:D.filePatterns?.join(", ")||"",onChange:r=>G({...D,filePatterns:r.target.value.split(",").map(t=>t.trim()).filter(Boolean)}),placeholder:a("gitHooks.tsTsxJs","*.ts, *.tsx, *.js"),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"}})]}),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:r=>G({...D,enabled:r.target.checked})}),e.jsx("span",{style:{fontSize:13},children:a("gitHooks.enabled","Enabled")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.failOnError,onChange:r=>G({...D,failOnError:r.target.checked})}),e.jsx("span",{style:{fontSize:13},children:a("gitHooks.failOnError","Fail on error")})]})]})]}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>G(null),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:a("gitHooks.cancel","Cancel")}),e.jsx("button",{onClick:()=>h(D),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:a("gitHooks.save","Save")})]})]})}):null,o=()=>{if(!re||!V)return null;const r=f(V);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(--nice-bg-elevated, #ffffff)",borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"file",size:16})," Script Preview: ",V.type]}),e.jsx("button",{onClick:()=>J(!1),"aria-label":a("gitHooks.close","Close"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(i.NiceIcon,{name:"close",size:18})})]}),e.jsx("pre",{style:{flex:1,margin:0,padding:20,background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",fontFamily:"monospace",fontSize:13,overflow:"auto"},children:r}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(r)},style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"clipboard",size:14})," ",a("gitHooks.copy","Copy")]}),e.jsx("button",{onClick:()=>J(!1),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:a("gitHooks.close","Close")})]})]})})};return e.jsxs("div",{className:`nice-git-hooks ${k||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",fontFamily:"system-ui, sans-serif",...v},"data-testid":_,children:[e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--nice-border, #30363d)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",fontWeight:500,display:"flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"link",size:16})," ",a("gitHooks.gitHooks","Git Hooks")]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:Object.entries(pe).map(([r,t])=>{const m=ee.find(p=>p.type===r),S=H===r,K=m?.actions.length||0;return e.jsxs("div",{onClick:()=>u(r),style:{padding:"12px 16px",cursor:"pointer",background:S?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:S?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:t.icon,size:18}),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(--nice-text-muted, #8b949e)"},children:[K," action",K!==1?"s":""]})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),ie(r,!m?.enabled)},style:{width:36,height:20,borderRadius:10,background:m?.enabled?"var(--nice-color-success, #22c55e)":"var(--nice-bg-tertiary, #cbd5e1)",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:m?.enabled?18:2,width:16,height:16,borderRadius:"50%",background:"var(--nice-bg-primary, #fff)",transition:"left 0.2s"}})})]},r)})}),e.jsx("div",{style:{padding:12,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:e.jsx("button",{onClick:()=>y?.(ee,"husky"),style:{flex:1,padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",fontSize:12,cursor:"pointer"},children:a("gitHooks.export","Export")})})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:V?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border, #30363d)",background:"var(--nice-bg-elevated, #161b22)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx(i.NiceIcon,{name:pe[V.type].icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:pe[V.type].title}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:pe[V.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsxs("button",{onClick:()=>J(!0),style:{padding:"6px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"file",size:14})," ",a("gitHooks.previewScript","Preview Script")]}),e.jsxs("button",{onClick:()=>b?.(V.type),style:{padding:"6px 12px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"download",size:14})," ",a("gitHooks.install","Install")]}),e.jsxs("button",{onClick:()=>w?.(V.type),style:{padding:"6px 12px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"close",size:14})," ",a("gitHooks.uninstall","Uninstall")]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:V.actions.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:40,color:"var(--nice-text-muted, #8b949e)"},children:[e.jsx(i.NiceIcon,{name:"box",size:48}),e.jsx("span",{style:{marginTop:16},children:a("gitHooks.noActionsConfigured","No actions configured")}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:a("gitHooks.addAnActionFromTemplates","Add an action from templates or create a custom one")})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:V.actions.sort((r,t)=>r.order-t.order).map((r,t)=>e.jsxs("div",{style:{padding:16,background:"var(--nice-bg-elevated, #161b22)",borderRadius:8,border:"1px solid var(--nice-border, #30363d)",opacity:r.enabled?1:.5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:B(r.type),size:20}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)",background:"var(--nice-bg-canvas, #0d1117)",padding:"2px 6px",borderRadius:4},children:r.command})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>z(r.id,"up"),disabled:t===0,"aria-label":a("gitHooks.moveUp","Move up"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:t===0?"not-allowed":"pointer",opacity:t===0?.5:1},children:e.jsx(i.NiceIcon,{name:"arrow-up",size:14})}),e.jsx("button",{onClick:()=>z(r.id,"down"),disabled:t===V.actions.length-1,"aria-label":a("gitHooks.moveDown","Move down"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:t===V.actions.length-1?"not-allowed":"pointer",opacity:t===V.actions.length-1?.5:1},children:e.jsx(i.NiceIcon,{name:"arrow-down",size:14})}),e.jsx("button",{onClick:()=>G(r),"aria-label":a("gitHooks.editAction2","Edit action"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:e.jsx(i.NiceIcon,{name:"edit",size:14})}),e.jsx("button",{onClick:()=>l(r.id),"aria-label":a("gitHooks.removeAction","Remove action"),style:{padding:"4px 8px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:e.jsx(i.NiceIcon,{name:"trash",size:14})})]})]}),r.filePatterns&&r.filePatterns.length>0&&e.jsxs("div",{style:{marginTop:8,fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:["Files: ",r.filePatterns.join(", ")]}),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[r.runOn&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-primary-active, #1d4ed8)",borderRadius:4},children:r.runOn}),r.failOnError&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-error, #b91c1c)",borderRadius:4},children:"fail on error"})]})]},r.id))})}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>Y(!x),style:{padding:"10px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"plus",size:14})," ",a("gitHooks.addFromTemplate","Add from Template")]}),e.jsxs("button",{onClick:()=>g(),style:{padding:"10px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"settings",size:14})," ",a("gitHooks.customAction","Custom Action")]})]}),x&&e.jsxs("div",{style:{position:"absolute",bottom:70,left:300,width:400,maxHeight:300,overflow:"auto",background:"var(--nice-bg-elevated, #ffffff)",border:"1px solid var(--nice-border-color, #e2e8f0)",borderRadius:8,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",zIndex:50},children:[C.filter(r=>r.hook===H).map(r=>e.jsxs("div",{onClick:()=>g(r),style:{padding:12,cursor:"pointer",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",alignItems:"center",gap:12},children:[e.jsx(i.NiceIcon,{name:r.icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:r.description})]})]},r.id)),C.filter(r=>r.hook===H).length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:"var(--nice-text-muted, #8b949e)"},children:a("gitHooks.noTemplatesForThisHook","No templates for this hook type")})]})]}):e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #8b949e)"},children:[e.jsx(i.NiceIcon,{name:"link",size:64}),e.jsx("span",{style:{fontSize:18,marginTop:16},children:a("gitHooks.selectAHookToConfigure","Select a hook to configure")}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:a("gitHooks.clickOnAHookFrom","Click on a hook from the list to start editing")})]})}),$(),o()]})},ir=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:Be},Symbol.toStringTag,{value:"Module"})),Me=Object.assign(n.forwardRef(({menubar:d,toolbar:j,sidebar:C,sidebarWidth:I=220,rightSidebar:E,rightSidebarWidth:F=280,children:L,bottomPanel:A,bottomPanelHeight:M,statusBar:N,height:T="100%",flush:W=!1,className:b,style:w,id:y,"data-testid":k},v)=>{const _=`nice-app-shell__sidebar${W?" nice-app-shell__sidebar--flush":""}`;return e.jsxs("div",{ref:v,id:y,"data-testid":k,className:`nice-app-shell${b?` ${b}`:""}`,style:{height:T,...w},children:[d!=null&&e.jsx("div",{className:`nice-app-shell__menubar${W?" nice-app-shell__chrome--flush":""}`,children:d}),j!=null&&e.jsx("div",{className:`nice-app-shell__toolbar${W?" nice-app-shell__chrome--flush":""}`,children:j}),e.jsxs("div",{className:"nice-app-shell__body",children:[C!=null&&e.jsx("aside",{className:_,style:W?void 0:{width:I},children:C}),e.jsx("main",{className:"nice-app-shell__content",children:L}),E!=null&&e.jsx("aside",{className:`${_} nice-app-shell__sidebar--right`,style:W?void 0:{width:F},children:E})]}),A!=null&&e.jsx("div",{className:`nice-app-shell__bottom${W?" nice-app-shell__bottom--flush":""}`,style:M!=null?{height:M}:void 0,children:A}),N!=null&&e.jsx("div",{className:"nice-app-shell__status",children:N})]})}),{displayName:"NiceAppShell"}),nr=[],tr=[],or={id:"",name:"",repository:"",triggers:[],stages:[],variables:[],secrets:[],isEnabled:!0,createdAt:new Date(0),updatedAt:new Date(0)},sr=[],ar=[{target:".nice-pipeline-editor",titleKey:"tutorial.pipelineEditor.intro.title",title:"Pipeline editor",contentKey:"tutorial.pipelineEditor.intro.content",content:"Build a CI/CD pipeline from stages, jobs and steps; set triggers, variables and secrets; then validate, save and run it.",placement:"auto"}],lr={push:"upload",pull_request:"shuffle",schedule:"clock",manual:"cursor",tag:"tag",workflow_dispatch:"zap"},cr={script:"file",action:"settings",checkout:"download",upload_artifact:"upload",download_artifact:"download",docker:"box",deploy:"rocket"},Te=({pipeline:d,defaultPipeline:j,templates:C=nr,runners:I=sr,environments:E=tr,onPipelineChange:F,onStageAdd:L,onStageRemove:A,onStageMove:M,onJobAdd:N,onJobRemove:T,onStepAdd:W,onStepRemove:b,onVariableAdd:w,onVariableRemove:y,onSecretAdd:k,onSecretRemove:v,onTemplateApply:_,onSave:a,onRun:P,onValidate:Z,tutorial:R,className:ee,style:q,"data-testid":H})=>{const{t:u}=i.useNiceTranslation(),[x,Y]=i.useControllableState({value:d,defaultValue:j,fallbackValue:or,onChange:F,componentName:"NicePipelineEditor"}),[D,G]=n.useState("visual"),[re,J]=n.useState(null),[V,ie]=n.useState(null),[g,l]=n.useState(!1),h=x.stages.find(r=>r.id===re),z=h?.jobs.find(r=>r.id===V),f=n.useMemo(()=>{const r=[];return r.push(`name: ${x.name}`),r.push(""),r.push("on:"),x.triggers.forEach(t=>{r.push(` ${t}:`),(t==="push"||t==="pull_request")&&(r.push(" branches:"),r.push(` - ${x.branch||"main"}`))}),r.push(""),x.variables.length>0&&(r.push("env:"),x.variables.filter(t=>!t.isSecret).forEach(t=>{r.push(` ${t.name}: ${t.value}`)}),r.push("")),r.push("jobs:"),x.stages.forEach(t=>{t.jobs.forEach(m=>{r.push(` ${t.name.toLowerCase().replace(/\s+/g,"-")}-${m.name.toLowerCase().replace(/\s+/g,"-")}:`),r.push(` name: ${m.name}`),m.runner&&r.push(` runs-on: ${m.runner}`),t.dependsOn?.length&&r.push(` needs: [${t.dependsOn.join(", ")}]`),r.push(" steps:"),m.steps.forEach(S=>{S.type==="checkout"?r.push(" - uses: actions/checkout@v4"):S.type==="action"&&S.action?(r.push(` - uses: ${S.action}${S.actionVersion?`@${S.actionVersion}`:""}`),S.with&&Object.keys(S.with).length>0&&(r.push(" with:"),Object.entries(S.with).forEach(([K,p])=>{r.push(` ${K}: ${p}`)}))):S.type==="script"&&S.script&&(r.push(` - name: ${S.name}`),r.push(" run: |"),S.script.split(`
10
+ `).forEach(K=>{r.push(` ${K}`)}))})})}),r.join(`
11
+ `)},[x]),B=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(i.NiceIcon,{name:"settings",size:20}),e.jsx("input",{type:"text",value:x.name,onChange:r=>Y({...x,name:r.target.value}),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:"14px",fontWeight:500,width:"250px"}})]}),e.jsx("div",{style:{flex:1}}),e.jsx(i.NiceTutorialButton,{steps:i.resolveTutorial(R,ar)}),e.jsx("button",{onClick:()=>l(!0),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"clipboard",size:14})," ",u("pipelineEditor.templates","Templates")]})}),e.jsx("button",{onClick:Z,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",u("pipelineEditor.validate","Validate")]})}),e.jsx("button",{onClick:a,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"save",size:14})," ",u("pipelineEditor.save","Save")]})}),e.jsx("button",{onClick:P,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"play",size:14})," ",u("pipelineEditor.runPipeline","Run Pipeline")]})})]}),$=e.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #1e1e1e)"},children:[{id:"visual",icon:"palette",label:"Visual Editor"},{id:"yaml",icon:"edit",label:"YAML"},{id:"triggers",icon:"zap",label:"Triggers"},{id:"variables",icon:"settings",label:"Variables"}].map(r=>e.jsx("button",{onClick:()=>G(r.id),style:{padding:"10px 20px",border:"none",background:D===r.id?"var(--nice-bg-elevated, #1e1e1e)":"transparent",color:D===r.id?"var(--nice-text-primary, #fff)":"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:D===r.id?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:r.icon,size:14})," ",r.label]})},r.id))}),o=e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",height:"100%"},children:[D==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{width:"300px",borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:u("pipelineEditor.stages","Stages")}),e.jsx("button",{onClick:L,style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Stage"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:[x.stages.map((r,t)=>e.jsxs("div",{children:[t>0&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px",color:"var(--nice-text-primary, #444)"},children:e.jsx(i.NiceIcon,{name:"arrow-down",size:14})}),e.jsxs("div",{onClick:()=>{J(r.id),ie(null)},style:{padding:"12px",background:re===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:re===r.id?"1px solid var(--nice-primary, #3b82f6)":"1px solid var(--nice-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:[t>0&&e.jsx("button",{"aria-label":u("pipelineEditor.moveStageUp","Move stage up"),onClick:m=>{m.stopPropagation(),M(r.id,"up")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(i.NiceIcon,{name:"arrow-up",size:12})}),t<x.stages.length-1&&e.jsx("button",{"aria-label":u("pipelineEditor.moveStageDown","Move stage down"),onClick:m=>{m.stopPropagation(),M(r.id,"down")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(i.NiceIcon,{name:"arrow-down",size:12})}),e.jsx("button",{"aria-label":u("pipelineEditor.removeStage","Remove stage"),onClick:m=>{m.stopPropagation(),A(r.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(i.NiceIcon,{name:"close",size:12})})]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-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(--nice-text-muted, #666)",padding:"24px",fontSize:"12px"},children:u("pipelineEditor.noStagesYetAddA","No stages yet. Add a stage to get started.")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("span",{style:{fontWeight:500},children:["Stage: ",h.name]}),e.jsx("button",{onClick:()=>N(h.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-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(--nice-border-color, #333)",overflow:"auto",padding:"8px"},children:h.jobs.map(r=>e.jsxs("div",{onClick:()=>ie(r.id),style:{padding:"10px",marginBottom:"4px",background:V===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"6px",cursor:"pointer",border:V===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",{"aria-label":u("pipelineEditor.removeJob","Remove job"),onClick:t=>{t.stopPropagation(),T(h.id,r.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"9px"},children:e.jsx(i.NiceIcon,{name:"close",size:11})})]}),e.jsxs("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)",marginTop:"4px"},children:[r.steps.length," steps"]})]},r.id))}),z?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: ",z.name]}),e.jsx("button",{onClick:()=>W(h.id,z.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-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(--nice-bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)",display:"block",marginBottom:"4px"},children:u("pipelineEditor.runner","Runner")}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:u("pipelineEditor.selectRunner","Select runner...")}),I.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(--nice-text-muted, #888)",display:"block",marginBottom:"4px"},children:u("pipelineEditor.environment","Environment")}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:u("pipelineEditor.noEnvironment","No environment")}),E.map(r=>e.jsxs("option",{value:r.id,children:[r.name,r.protection?" (protected)":""]},r.id))]})]})]}),z.steps.map((r,t)=>e.jsxs("div",{style:{marginBottom:"8px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx(i.NiceIcon,{name:cr[r.type],size:16}),e.jsx("span",{style:{fontSize:"12px",fontWeight:500,flex:1},children:r.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)",padding:"2px 6px",background:"var(--nice-bg-tertiary, #333)",borderRadius:"4px"},children:r.type}),e.jsx("button",{"aria-label":u("pipelineEditor.removeStep","Remove step"),onClick:()=>b(h.id,z.id,r.id),style:{padding:"2px 6px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"4px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(i.NiceIcon,{name:"close",size:12})})]}),r.type==="script"&&r.script&&e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--nice-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(--nice-text-muted, #888)"},children:["uses: ",r.action,r.actionVersion&&`@${r.actionVersion}`]})]},r.id)),z.steps.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--nice-text-muted, #666)",padding:"24px",fontSize:"12px"},children:u("pipelineEditor.noStepsYetAddA","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(--nice-text-muted, #666)"},children:u("pipelineEditor.selectAJobToEdit","Select a job to edit its steps")})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)"},children:u("pipelineEditor.selectAStageToView","Select a stage to view its jobs")})})]}),D==="yaml"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("pre",{style:{margin:0,padding:"16px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:f})}),D==="triggers"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:u("pipelineEditor.pipelineTriggers","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(--nice-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:t=>{const m=t.target.checked?[...x.triggers,r]:x.triggers.filter(S=>S!==r);Y({...x,triggers:m})}}),e.jsx(i.NiceIcon,{name:lr[r],size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:r.replace("_"," ")}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-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))})]}),D==="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:w,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Variable"}),e.jsx("button",{onClick:k,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"lock",size:12})," ",u("pipelineEditor.addSecret","Add Secret")]})})]})]}),e.jsxs("div",{style:{background:"var(--nice-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(--nice-bg-elevated, #1e1e1e)"},children:[e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:u("pipelineEditor.name","Name")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:u("pipelineEditor.value","Value")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontWeight:500},children:u("pipelineEditor.type","Type")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"right",fontWeight:500},children:u("pipelineEditor.actions","Actions")})]})}),e.jsx("tbody",{children:x.variables.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",fontFamily:"monospace"},children:r.name}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:r.isSecret?"••••••••":r.value}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",textAlign:"center"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"4px",background:r.isSecret?"var(--nice-warning-tint-15, #f59e0b22)":"var(--nice-primary-tint-15, #3b82f622)",color:r.isSecret?"var(--nice-color-warning, #f59e0b)":"var(--nice-color-primary, #3b82f6)",fontSize:"10px"},children:[r.isSecret&&e.jsx(i.NiceIcon,{name:"lock",size:10}),r.isSecret?"Secret":"Variable"]})}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",textAlign:"right"},children:e.jsx("button",{onClick:()=>y(r.name),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:u("pipelineEditor.remove","Remove")})})]},r.name))})]}),x.variables.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:u("pipelineEditor.noVariablesDefined","No variables defined")})]})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:`nice-pipeline-editor ${ee||""}`,style:{background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...q},flush:!0,menubar:B,toolbar:$,"data-testid":H,children:o}),g&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"var(--nice-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(--nice-border-color, #333)"},children:[e.jsx("span",{style:{fontWeight:600},children:u("pipelineEditor.pipelineTemplates","Pipeline Templates")}),e.jsx("button",{"aria-label":u("pipelineEditor.closeTemplates","Close templates"),onClick:()=>l(!1),style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:e.jsx(i.NiceIcon,{name:"close",size:18})})]}),e.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px"},children:C.map(r=>e.jsxs("div",{onClick:()=>{_(r),l(!1)},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",marginBottom:"8px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx(i.NiceIcon,{name:r.icon,size:32}),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(--nice-text-muted, #888)"},children:r.description}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",marginTop:"4px"},children:r.category})]})]},r.id))})]})})]})},dr=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:Te},Symbol.toStringTag,{value:"Module"})),pr=[],xe={queued:{color:"var(--nice-text-muted, #6b7280)",icon:"clock",label:"Queued"},pending:{color:"var(--nice-text-muted, #6b7280)",icon:"clock",label:"Pending"},waiting:{color:"var(--nice-color-warning, #f59e0b)",icon:"pause",label:"Waiting"},in_progress:{color:"var(--nice-color-primary, #3b82f6)",icon:"refresh",label:"In Progress"},running:{color:"var(--nice-color-primary, #3b82f6)",icon:"refresh",label:"Running"},completed:{color:"var(--nice-color-success, #22c55e)",icon:"check",label:"Completed"},success:{color:"var(--nice-color-success, #22c55e)",icon:"check",label:"Success"},failed:{color:"var(--nice-color-error, #ef4444)",icon:"close",label:"Failed"},failure:{color:"var(--nice-color-error, #ef4444)",icon:"close",label:"Failed"},cancelled:{color:"var(--nice-text-muted, #6b7280)",icon:"close",label:"Cancelled"},skipped:{color:"var(--nice-text-muted, #6b7280)",icon:"skip-forward",label:"Skipped"}},Ee=({runs:d=pr,stats:j,selectedRunId:C,onRunSelect:I,onCancel:E,onRerun:F,onRerunFromStage:L,onDownloadArtifact:A,onDownloadLogs:M,onApprove:N,onReject:T,className:W,style:b,"data-testid":w})=>{const{t:y}=i.useNiceTranslation(),[k,v]=n.useState("all"),[_,a]=n.useState("all"),[P,Z]=n.useState(new Set),[R,ee]=n.useState(new Set),[q,H]=n.useState(null),u=d.find(g=>g.id===C),x=n.useMemo(()=>d.filter(g=>!(k!=="all"&&g.status!==k||_!=="all"&&g.branch!==_)),[d,k,_]),Y=n.useMemo(()=>[...new Set(d.map(g=>g.branch))],[d]),D=g=>{if(!g)return"-";const l=Math.floor(g/1e3);if(l<60)return`${l}s`;const h=Math.floor(l/60),z=l%60;if(h<60)return`${h}m ${z}s`;const f=Math.floor(h/60),B=h%60;return`${f}h ${B}m`},G=g=>g?new Date(g).toLocaleString():"-",re=g=>g<1024?`${g} B`:g<1024*1024?`${(g/1024).toFixed(1)} KB`:`${(g/(1024*1024)).toFixed(1)} MB`,J=g=>{Z(l=>{const h=new Set(l);return h.has(g)?h.delete(g):h.add(g),h})},V=g=>{ee(l=>{const h=new Set(l);return h.has(g)?h.delete(g):h.add(g),h})},ie=()=>{if(!q||!u)return[];for(const g of u.stages)for(const l of g.jobs)if(l.id===q.jobId)return l.steps.find(z=>z.id===q.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${W||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...b},"data-testid":w,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[j&&e.jsx("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-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(--nice-color-primary, #3b82f6)"},children:j.totalRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:y("pipelineMonitor.totalRuns","Total Runs")})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:[j.successRate.toFixed(0),"%"]}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:y("pipelineMonitor.successRate","Success Rate")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:D(j.avgDuration)}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:y("pipelineMonitor.avgDuration","Avg Duration")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:j.failedRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:y("pipelineMonitor.failed","Failed")})]})]})}),e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:"8px"},children:[e.jsxs("select",{value:k,onChange:g=>v(g.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:y("pipelineMonitor.allStatus","All Status")}),e.jsx("option",{value:"in_progress",children:y("pipelineMonitor.inProgress","In Progress")}),e.jsx("option",{value:"completed",children:y("pipelineMonitor.completed","Completed")}),e.jsx("option",{value:"failed",children:y("pipelineMonitor.failed","Failed")}),e.jsx("option",{value:"cancelled",children:y("pipelineMonitor.cancelled","Cancelled")})]}),e.jsxs("select",{value:_,onChange:g=>a(g.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:y("pipelineMonitor.allBranches","All Branches")}),Y.map(g=>e.jsx("option",{value:g,children:g},g))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[x.map(g=>{const l=xe[g.status];return e.jsxs("div",{onClick:()=>I(g.id),style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",cursor:"pointer",background:C===g.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:{display:"inline-flex",color:l.color,animation:g.status==="in_progress"?"spin 1s linear infinite":"none"},children:e.jsx(i.NiceIcon,{name:l.icon,size:16})}),e.jsxs("span",{style:{flex:1,fontWeight:500,fontSize:"13px"},children:[g.pipelineName," #",g.runNumber]}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:`${l.color}22`,color:l.color,fontSize:"10px"},children:l.label})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:12})," ",g.branch]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:g.commit.sha.slice(0,7)}),e.jsx("span",{children:"•"}),e.jsx("span",{children:D(g.duration)})]}),e.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"var(--nice-text-muted, #666)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.commit.message})]},g.id)}),x.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:y("pipelineMonitor.noPipelineRunsMatchThe","No pipeline runs match the filters")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:u?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-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:[u.pipelineName," #",u.runNumber]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"12px",color:"var(--nice-text-muted, #888)"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[u.commit.authorAvatar&&e.jsx("img",{src:u.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),u.commit.author]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:12})," ",u.branch]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(i.NiceIcon,{name:"edit",size:12})," ",u.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(u.status==="in_progress"||u.status==="queued"||u.status==="waiting")&&e.jsx("button",{onClick:()=>E(u.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:y("pipelineMonitor.cancel","Cancel")}),e.jsx("button",{onClick:()=>F(u.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:y("pipelineMonitor.reRun","Re-run")}),e.jsxs("button",{onClick:()=>M(u.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"11px",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(i.NiceIcon,{name:"download",size:14})," ",y("pipelineMonitor.logs","Logs")]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px"},children:[e.jsxs("span",{children:["Started: ",G(u.startedAt)]}),u.completedAt&&e.jsxs("span",{children:["Completed: ",G(u.completedAt)]}),e.jsxs("span",{children:["Duration: ",D(u.duration)]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:u.stages.map((g,l)=>{const h=xe[g.status],z=P.has(g.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>J(g.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:`2px solid ${h.color}44`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(i.NiceIcon,{name:z?"chevron-down":"chevron-right",size:14})}),e.jsx("span",{style:{display:"inline-flex",color:h.color},children:e.jsx(i.NiceIcon,{name:h.icon,size:16})}),e.jsx("span",{style:{flex:1,fontWeight:500},children:g.name}),e.jsx("span",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:D(g.duration)}),g.status==="waiting"&&N&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:f=>{f.stopPropagation(),N(u.id,g.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:y("pipelineMonitor.approve","Approve")}),e.jsx("button",{onClick:f=>{f.stopPropagation(),T?.(u.id,g.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:y("pipelineMonitor.reject","Reject")})]}),e.jsx("button",{onClick:f=>{f.stopPropagation(),L(u.id,g.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:y("pipelineMonitor.reRunFromHere","Re-run from here")})]}),z&&e.jsx("div",{style:{marginLeft:"32px",marginTop:"8px"},children:g.jobs.map(f=>{const B=xe[f.status],$=R.has(f.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>V(f.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${B.color}`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(i.NiceIcon,{name:$?"chevron-down":"chevron-right",size:12})}),e.jsx("span",{style:{display:"inline-flex",color:B.color},children:e.jsx(i.NiceIcon,{name:B.icon,size:14})}),e.jsx("span",{style:{flex:1,fontSize:"12px"},children:f.name}),f.runner&&e.jsxs("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(i.NiceIcon,{name:"monitor",size:12})," ",f.runner]}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:D(f.duration)})]}),$&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:f.steps.map(o=>{const r=xe[o.status];return e.jsxs("div",{onClick:()=>H({jobId:f.id,stepId:o.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:o.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{display:"inline-flex",color:r.color},children:e.jsx(i.NiceIcon,{name:r.icon,size:12})}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:o.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:D(o.duration)}),o.logs?.length?e.jsx("span",{style:{display:"inline-flex",color:"var(--nice-text-muted, #666)"},children:e.jsx(i.NiceIcon,{name:"file",size:10})}):null]},o.id)})})]},f.id)})}),l<u.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"var(--nice-text-primary, #444)",display:"flex"},children:e.jsx(i.NiceIcon,{name:"arrow-down",size:14})})]},g.id)})}),u.artifacts.length>0&&e.jsxs("div",{style:{marginTop:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"var(--nice-text-muted, #888)"},children:y("pipelineMonitor.artifacts","Artifacts")}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"8px"},children:u.artifacts.map(g=>e.jsxs("div",{onClick:()=>A(g),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{display:"inline-flex"},children:e.jsx(i.NiceIcon,{name:"box",size:24})}),e.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.name}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:re(g.size)})]}),e.jsx("span",{style:{display:"inline-flex"},children:e.jsx(i.NiceIcon,{name:"download",size:16})})]},g.id))})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)"},children:y("pipelineMonitor.selectAPipelineRunTo","Select a pipeline run to view details")})}),q&&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(--nice-bg-elevated, #1e1e1e)",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500},children:y("pipelineMonitor.stepLogs","Step Logs")}),e.jsx("button",{onClick:()=>H(null),"aria-label":y("pipelineMonitor.closeLogs","Close logs"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",display:"inline-flex",alignItems:"center"},children:e.jsx(i.NiceIcon,{name:"close",size:18})})]}),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(--nice-text-secondary, #d4d4d4)"},children:ie().join(`
12
+ `)||"No logs available"})})]})}),e.jsx("style",{children:`
13
+ @keyframes spin {
14
+ from { transform: rotate(0deg); }
15
+ to { transform: rotate(360deg); }
16
+ }
17
+ `})]})},xr=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:Ee},Symbol.toStringTag,{value:"Module"}));exports.NiceAppShell=Me;exports.NiceBranchManager=we;exports.NiceBranchManager$1=qe;exports.NiceConfirmDialog=be;exports.NiceGitBlame=Ie;exports.NiceGitBlame$1=Ze;exports.NiceGitConflictResolver=Ne;exports.NiceGitConflictResolver$1=er;exports.NiceGitDiffViewer=Re;exports.NiceGitDiffViewer$1=Je;exports.NiceGitGraph=Se;exports.NiceGitGraph$1=Le;exports.NiceGitHooks=Be;exports.NiceGitHooks$1=ir;exports.NiceMergeRequestBuilder=ze;exports.NiceMergeRequestBuilder$1=Ue;exports.NicePipelineEditor=Te;exports.NicePipelineEditor$1=dr;exports.NicePipelineMonitor=Ee;exports.NicePipelineMonitor$1=xr;exports.NicePromptDialog=me;exports.useIgnoredPropChangeWarning=ye;exports.useNiceDialogs=Ce;