@nice2dev/ui 1.1.10 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +183 -0
- package/README.md +12 -20
- package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
- package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
- package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
- package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
- package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
- package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
- package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
- package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
- package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
- package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
- package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
- package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
- package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
- package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
- package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
- package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
- package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
- package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
- package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
- package/dist/NiceButton-3AcJJ15c.cjs +1 -0
- package/dist/NiceButton-5tWvfXKl.cjs +1 -0
- package/dist/NiceButton-DHSgQT1_.js +112 -0
- package/dist/NiceButton-vkI07DP0.js +88 -0
- package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
- package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
- package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
- package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
- package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
- package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
- package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
- package/dist/NiceColorPicker-DK30kJgy.js +486 -0
- package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
- package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
- package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
- package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
- package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
- package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
- package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
- package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
- package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
- package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
- package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
- package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
- package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
- package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
- package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
- package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
- package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
- package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
- package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
- package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
- package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
- package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
- package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
- package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
- package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
- package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
- package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
- package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
- package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
- package/dist/NiceForm-BCEXovJR.cjs +1 -0
- package/dist/NiceForm-BcN4p2kG.cjs +1 -0
- package/dist/NiceForm-D7oyWHXg.js +4820 -0
- package/dist/NiceForm-DUhxXArr.js +4817 -0
- package/dist/NiceForm-tIXS-M6b.js +4770 -0
- package/dist/NiceForm-uCeVmTrD.cjs +1 -0
- package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
- package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
- package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
- package/dist/NiceGantt-Dao7pN9z.js +328 -0
- package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
- package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
- package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
- package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
- package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
- package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
- package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
- package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
- package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
- package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
- package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
- package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
- package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
- package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
- package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
- package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
- package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
- package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
- package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
- package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
- package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
- package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
- package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
- package/dist/NiceLoginForm-DQe77Isv.js +747 -0
- package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
- package/dist/NiceLoginForm.css +1 -0
- package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
- package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
- package/dist/NiceMention--3P3vO-W.cjs +430 -0
- package/dist/NiceMention-CA7CL5BI.js +11263 -0
- package/dist/NiceMention-CHcKRl-L.cjs +430 -0
- package/dist/NiceMention-Co2cqkVM.js +11316 -0
- package/dist/NiceMention-DJD0BLcp.js +11269 -0
- package/dist/NiceMention-DcaUEMSg.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-C4p8a82e.cjs +1 -0
- package/dist/NiceModal-TNlkaL_i.js +85 -0
- package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
- package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
- package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
- package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
- package/dist/NicePagination-8XsBbMNx.js +165 -0
- package/dist/NicePagination-B3nZDZem.js +165 -0
- package/dist/NicePagination-B8rg1Y67.cjs +1 -0
- package/dist/NicePagination-CkOoXf0f.js +165 -0
- package/dist/NicePagination-D7lek1G7.cjs +1 -0
- package/dist/NicePagination-OjTEfZJE.cjs +1 -0
- package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
- package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
- package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
- package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
- package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
- package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
- package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
- package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
- package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
- package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
- package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
- package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
- package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
- package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
- package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
- package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
- package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
- package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
- package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
- package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
- package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
- package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
- package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
- package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
- package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
- package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
- package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
- package/dist/NiceSelect-CZR8Zu_k.js +420 -0
- package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
- package/dist/NiceSelect-DZB1Rs9x.js +435 -0
- package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
- package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
- package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
- package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
- package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
- package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
- package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
- package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
- package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
- package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
- package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
- package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
- package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
- package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
- package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
- package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
- package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
- package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
- package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
- package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
- package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
- package/dist/NiceWindow-BEov3s9F.js +2094 -0
- package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
- package/dist/NiceWindow-CWN8OCHF.js +2109 -0
- package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-Bo2WAI5T.cjs +768 -0
- package/dist/charts-ByrdMeQP.js +4767 -0
- package/dist/charts-C047IMVn.cjs +768 -0
- package/dist/charts-CCXSb3xk.js +4752 -0
- package/dist/charts-CqETcUhH.js +4752 -0
- package/dist/charts-DouiiHOT.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.d.ts +28 -18
- package/dist/charts.mjs +1 -1
- package/dist/core-B8eBUE4m.js +438 -0
- package/dist/core-BL-KmGYC.js +795 -0
- package/dist/core-Chg-oYCr.cjs +1 -0
- package/dist/core-CxBnKAhs.cjs +1 -0
- package/dist/core-D_LRh59n.js +795 -0
- package/dist/core-lBFqvT0V.cjs +1 -0
- package/dist/core-lazy-Bh2yg4Et.js +351 -0
- package/dist/core-lazy-CkWKjfc6.cjs +1 -0
- package/dist/data-branching-Dak1_ZKR.cjs +1 -0
- package/dist/data-branching-DiLAO4Qt.js +6386 -0
- package/dist/data-branching-Km4lc8P_.cjs +1 -0
- package/dist/data-branching-YQtJJEtn.js +6273 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +22 -69
- package/dist/data.mjs +3 -3
- package/dist/devops-D5yIDM3e.js +8312 -0
- package/dist/devops-DkVluHBp.cjs +17 -0
- package/dist/devops-rVpB0ZAX.cjs +17 -0
- package/dist/devops-zsMUueTd.js +8648 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +3 -3
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +106 -63
- package/dist/editors.mjs +55 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +76 -2
- package/dist/feedback.mjs +10 -9
- package/dist/index.cjs +261 -261
- package/dist/index.css +1 -1
- package/dist/index.d.ts +831 -433
- package/dist/index.mjs +27339 -26540
- package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
- package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +9 -7
- package/dist/lazy.mjs +55 -55
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.css +1 -0
- package/dist/navigation.d.ts +99 -43
- package/dist/navigation.mjs +504 -547
- package/dist/no-code-6WyYb3hL.cjs +331 -0
- package/dist/no-code-BH5oVFC6.js +8186 -0
- package/dist/no-code-CnHG5_Vn.js +8186 -0
- package/dist/no-code-DMKlg1Zl.cjs +331 -0
- package/dist/no-code-DiTEnuRv.js +8288 -0
- package/dist/no-code-wG9c0z_T.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.d.ts +25 -18
- package/dist/no-code.mjs +3 -3
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +36 -30
- package/dist/overlays.mjs +24 -490
- package/dist/pickerCommons-0vyK1Knv.js +547 -0
- package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
- package/dist/pickerCommons-BFbItm8o.cjs +1 -0
- package/dist/pickerCommons-BHirHJyn.js +548 -0
- package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
- package/dist/pickerCommons-DkumQ3KE.js +548 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +15 -9
- package/package.json +4 -6
- package/css/legacy-bg-text-aliases.css +0 -87
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),s=require("@nice2dev/ui-core"),x=require("react");function ge(f=new Date){const N=new Date().getTime()-f.getTime(),w=Math.floor(N/1e3),R=Math.floor(w/60),E=Math.floor(R/60),G=Math.floor(E/24);let W;return w<60?W="just now":R<60?W=`${R} minute${R>1?"s":""} ago`:E<24?W=`${E} hour${E>1?"s":""} ago`:G<30?W=`${G} day${G>1?"s":""} ago`:W=f.toLocaleDateString(),{date:f,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,relative:W}}function he(f){return f.substring(0,7)}function fe(f){const B=f||s.createId();return{id:B,shortId:he(B)}}const Z=["development","testing","uat","staging","production"],T={development:"var(--nice-success, #22c55e)",testing:"var(--nice-primary, #3b82f6)",uat:"var(--nice-warning, #f59e0b)",staging:"var(--nice-accent, #8b5cf6)",production:"var(--nice-danger, #ef4444)"},H={development:"settings",testing:"flask",uat:"users",staging:"rocket",production:"building"};function ne(f){return Z.indexOf(f)}function ae(f,B){return ne(f)<ne(B)}const ye=[{name:"customers",displayName:"Customers",recordCount:15420,sizeBytes:256e5,module:"CRM"},{name:"products",displayName:"Products",recordCount:3200,sizeBytes:85e5,module:"Inventory"},{name:"orders",displayName:"Orders",recordCount:48500,sizeBytes:125e6,module:"Sales"},{name:"order_items",displayName:"Order Items",recordCount:156e3,sizeBytes:45e6,module:"Sales",hasForeignKeys:!0},{name:"invoices",displayName:"Invoices",recordCount:42e3,sizeBytes:85e6,module:"Finance"},{name:"employees",displayName:"Employees",recordCount:450,sizeBytes:25e5,module:"HR"},{name:"config",displayName:"Configuration",recordCount:1200,sizeBytes:5e5,module:"System"}],me=[{id:"prod-1",shortId:"prod-1",name:"production",displayName:"Production",description:"Live production environment",isDefault:!0,isProtected:!0,createdBy:{id:"system",name:"System"},createdAt:{date:new Date("2024-01-01"),relative:"1 year ago"},lastActivity:{date:new Date,relative:"just now"},status:"active",type:"data",environment:"production",tenant:"tenant-1",size:{records:265770,bytes:2921e5}},{id:"uat-1",shortId:"uat-1",name:"uat",displayName:"UAT",description:"User Acceptance Testing",isDefault:!1,isProtected:!0,createdBy:{id:"admin",name:"Admin"},createdAt:{date:new Date("2025-01-15"),relative:"3 months ago"},lastActivity:{date:new Date,relative:"2 days ago"},upstream:"prod-1",status:"active",type:"data",environment:"uat",tenant:"tenant-1",sourceSnapshot:"snapshot-prod-20250115",size:{records:265e3,bytes:29e7}},{id:"dev-1",shortId:"dev-1",name:"development",displayName:"Development",description:"Development environment",isDefault:!1,isProtected:!1,createdBy:{id:"dev-1",name:"Developer"},createdAt:{date:new Date("2025-03-01"),relative:"1 month ago"},lastActivity:{date:new Date,relative:"1 hour ago"},upstream:"uat-1",status:"active",type:"data",environment:"development",tenant:"tenant-1",tables:["customers","products","orders"],size:{records:67120,bytes:1591e5}}],de=({tenant:f,branches:B,currentUser:N={id:"user-1",name:"Current User"},availableTables:w=ye,readOnly:R=!1,onCreateBranch:E,onDeleteBranch:G,onSwitchBranch:W,onCloneBranch:Q,onSyncBranch:Y,onProtectBranch:c,onScheduleSync:S,className:h,style:C,"data-testid":b})=>{const{t:g}=s.useNiceTranslation(),[K,v=""]=g("dataBranchManager.confirmDeleteEnvironment","Are you sure you want to delete {name}?").split("{name}"),[$,M]=x.useState(B??me),[L,F]=x.useState(null),[O,k]=x.useState(null),[u,j]=x.useState("development"),[y,A]=x.useState(""),[_,d]=x.useState([]),[D,U]=x.useState(!0),[z,r]=x.useState({requireApproval:!0,approversCount:1,requireBackup:!0,allowDirectChanges:!1}),[t,n]=x.useState({enabled:!1,frequency:"daily",direction:"pull"}),i=x.useMemo(()=>$.find(o=>o.id===L),[$,L]),m=x.useMemo(()=>{const o={production:[],staging:[],uat:[],testing:[],development:[]};return $.forEach(I=>{o[I.environment].push(I)}),o},[$]),V=o=>o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:o<1024*1024*1024?`${(o/(1024*1024)).toFixed(1)} MB`:`${(o/(1024*1024*1024)).toFixed(1)} GB`,q=x.useCallback(()=>{const o={...fe(),name:y||`${u}-${Date.now()}`,displayName:y||u,isDefault:!1,isProtected:!1,createdBy:N,createdAt:ge(),status:"active",type:"data",environment:u,tenant:f,sourceSnapshot:i?.id,upstream:i?.id,tables:D?void 0:_,size:{records:0,bytes:0}};M(I=>[...I,o]),E?.(o),Q?.(i?.id??"",u,D?void 0:_),k(null),P()},[y,u,i,D,_,N,f,E,Q]),P=()=>{A(""),j("development"),d([]),U(!0)},ee=x.useCallback(()=>{i&&(M(o=>o.filter(I=>I.id!==i.id)),G?.(i.id),F(null),k(null))},[i,G]),p=o=>{i&&(Y?.(i.id,o),k(null))},l=()=>{i&&(M(o=>o.map(I=>I.id===i.id?{...I,isProtected:!0}:I)),c?.(i.id,z),k(null))},a={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"};return e.jsxs("div",{className:`nice-data-branch-manager ${h||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:a.bg,color:a.text,fontFamily:"system-ui, sans-serif",...C},"data-testid":b,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${a.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(s.NiceIcon,{name:"database",size:16})," ",g("dataBranchManager.dataEnvironments","Data Environments")]}),e.jsxs("span",{style:{fontSize:12,color:a.textMuted},children:["Tenant: ",f," • ",$.length," environments"]})]}),!R&&e.jsx("button",{onClick:()=>{F($.find(o=>o.isDefault)?.id??null),k("clone")},style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"+ New Environment"})]}),e.jsx("div",{style:{padding:16,borderBottom:`1px solid ${a.border}`,display:"flex",alignItems:"center",gap:8,overflowX:"auto"},children:Z.map((o,I)=>{const X=m[o],J=X.length>0;return e.jsxs(x.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 16px",borderRadius:6,background:J?T[o]+"20":a.cardBg,border:`2px solid ${J?T[o]:a.border}`,opacity:J?1:.5,cursor:J?"pointer":"default"},onClick:()=>J&&F(X[0].id),children:[e.jsx(s.NiceIcon,{name:H[o],size:18}),e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase"},children:o}),J&&e.jsxs("div",{style:{fontSize:10,color:a.textMuted},children:[X.length," branch",X.length>1?"es":""]})]}),I<Z.length-1&&e.jsx("div",{style:{color:a.textMuted,fontSize:20},children:e.jsx(s.NiceIcon,{name:"arrow-right",size:20})})]},o)})}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:300,borderRight:`1px solid ${a.border}`,overflow:"auto"},children:[e.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${a.border}`,fontSize:11,color:a.textMuted},children:g("dataBranchManager.allEnvironments","All Environments")}),$.map(o=>e.jsxs("div",{onClick:()=>F(o.id),style:{padding:"12px 16px",borderBottom:`1px solid ${a.border}`,background:L===o.id?a.cardBg:"transparent",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(s.NiceIcon,{name:H[o.environment],size:16}),e.jsx("span",{style:{fontWeight:500},children:o.displayName}),o.isProtected&&e.jsx("span",{style:{fontSize:12},children:e.jsx(s.NiceIcon,{name:"lock",size:12})}),o.isDefault&&e.jsx("span",{style:{padding:"2px 6px",background:T[o.environment],borderRadius:4,fontSize:9,fontWeight:600},children:g("dataBranchManager.default","DEFAULT")})]}),e.jsxs("div",{style:{fontSize:11,color:a.textMuted,marginTop:4},children:[o.size?.records.toLocaleString()," records •"," ",V(o.size?.bytes??0)]}),e.jsx("div",{style:{fontSize:10,color:a.textMuted,marginTop:2},children:o.lastActivity?.relative})]},o.id))]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx(s.NiceIcon,{name:H[i.environment],size:32}),e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20},children:i.displayName}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:T[i.environment],borderRadius:4,fontSize:10,fontWeight:600,marginTop:4},children:i.environment.toUpperCase()})]})]}),i.description&&e.jsx("p",{style:{color:a.textMuted,margin:"8px 0"},children:i.description})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[{label:"Records",value:i.size?.records.toLocaleString()??"0"},{label:"Size",value:V(i.size?.bytes??0)},{label:"Tables",value:i.tables?.length.toString()??"All"},{label:"Status",value:i.status}].map(o=>e.jsxs("div",{style:{padding:12,background:a.cardBg,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:18,fontWeight:600},children:o.value}),e.jsx("div",{style:{fontSize:11,color:a.textMuted},children:o.label})]},o.label))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:g("dataBranchManager.details","Details")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:a.textMuted},children:g("dataBranchManager.createdBy","Created by")}),e.jsx("span",{children:i.createdBy.name}),e.jsx("span",{style:{color:a.textMuted},children:g("dataBranchManager.createdAt","Created at")}),e.jsx("span",{children:i.createdAt.date?.toLocaleString()}),e.jsx("span",{style:{color:a.textMuted},children:g("dataBranchManager.lastActivity","Last activity")}),e.jsx("span",{children:i.lastActivity?.relative}),i.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:a.textMuted},children:g("dataBranchManager.source","Source")}),e.jsx("span",{children:$.find(o=>o.id===i.upstream)?.displayName??"Unknown"})]}),i.sourceSnapshot&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:a.textMuted},children:g("dataBranchManager.snapshot","Snapshot")}),e.jsx("span",{children:i.sourceSnapshot})]})]})]}),i.tables&&e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:["Included Tables (",i.tables.length,")"]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:i.tables.map(o=>e.jsxs("span",{style:{padding:"4px 10px",background:a.cardBg,borderRadius:4,fontSize:12},children:[e.jsx(s.NiceIcon,{name:"database",size:14})," ",o]},o))})]}),!R&&e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{onClick:()=>W?.(i.id),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"zap",size:14})," ",g("dataBranchManager.switchToThisEnvironment","Switch to this environment")]}),e.jsxs("button",{onClick:()=>k("clone"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"clipboard",size:14})," ",g("dataBranchManager.clone","Clone")]}),e.jsxs("button",{onClick:()=>k("sync"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"refresh",size:14})," ",g("dataBranchManager.sync","Sync")]}),!i.isProtected&&e.jsxs("button",{onClick:()=>k("protect"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"lock",size:14})," ",g("dataBranchManager.protect","Protect")]}),!i.isDefault&&!i.isProtected&&e.jsxs("button",{onClick:()=>k("delete"),style:{padding:"8px 16px",borderRadius:6,border:"1px solid var(--nice-danger, #ef4444)",background:"transparent",color:"var(--nice-color-error, #ef4444)",cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"trash",size:14})," ",g("dataBranchManager.delete","Delete")]})]})]}):e.jsxs("div",{style:{padding:32,textAlign:"center",color:a.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(s.NiceIcon,{name:"database",size:48})}),e.jsx("div",{children:g("dataBranchManager.selectAnEnvironmentToView","Select an environment to view details")})]})})]}),O==="clone"&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(null),children:e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:a.cardBg,borderRadius:12,padding:24,width:500,maxHeight:"80vh",overflow:"auto"},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(s.NiceIcon,{name:"clipboard",size:14})," ",g("dataBranchManager.cloneEnvironment","Clone Environment")]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:a.textMuted},children:g("dataBranchManager.sourceEnvironment","Source Environment")}),e.jsxs("div",{style:{padding:12,background:a.bg,borderRadius:6,display:"flex",alignItems:"center",gap:8},children:[e.jsx(s.NiceIcon,{name:H[i?.environment??"production"],size:14}),e.jsx("span",{children:i?.displayName??"Production"})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:a.textMuted},children:g("dataBranchManager.targetEnvironment","Target Environment")}),e.jsx("select",{value:u,onChange:o=>j(o.target.value),style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${a.border}`,background:a.bg,color:a.text,fontSize:13},children:Z.filter(o=>ae(i?.environment??"production",o)||o==="development"||o==="testing").map(o=>e.jsx("option",{value:o,children:o.charAt(0).toUpperCase()+o.slice(1)},o))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:a.textMuted},children:g("dataBranchManager.environmentName","Environment Name")}),e.jsx("input",{type:"text",value:y,onChange:o=>A(o.target.value),placeholder:`${u}-${new Date().toISOString().split("T")[0]}`,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${a.border}`,background:a.bg,color:a.text,fontSize:13}})]}),e.jsx("div",{style:{marginBottom:16},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D,onChange:o=>U(o.target.checked)}),e.jsx("span",{style:{fontSize:13},children:g("dataBranchManager.includeAllTables","Include all tables")})]})}),!D&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("label",{style:{display:"block",marginBottom:6,fontSize:12,color:a.textMuted},children:["Select Tables (",_.length," selected)"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto",border:`1px solid ${a.border}`,borderRadius:6},children:w.map(o=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:`1px solid ${a.border}`,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:_.includes(o.name),onChange:I=>{I.target.checked?d(X=>[...X,o.name]):d(X=>X.filter(J=>J!==o.name))}}),e.jsx("span",{style:{flex:1,fontSize:13},children:o.displayName}),e.jsxs("span",{style:{fontSize:11,color:a.textMuted},children:[o.recordCount.toLocaleString()," rows"]})]},o.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>k(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:13},children:g("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:q,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:g("dataBranchManager.cloneEnvironment","Clone Environment")})]})]})}),O==="sync"&&i&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(null),children:e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:a.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(s.NiceIcon,{name:"refresh",size:14})," ",g("dataBranchManager.syncEnvironment","Sync Environment")]}),e.jsx("p",{style:{color:a.textMuted,fontSize:13,marginBottom:16},children:g("dataBranchManager.synchronizeDataBetween","Synchronize data between {name} and its source.").replace("{name}",i.displayName??i.name)}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16},children:[e.jsxs("button",{onClick:()=>p("pull"),style:{flex:1,padding:"16px",borderRadius:8,border:`2px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:e.jsx(s.NiceIcon,{name:"arrow-down",size:24})}),e.jsx("div",{style:{fontWeight:500},children:g("dataBranchManager.pull","Pull")}),e.jsx("div",{style:{fontSize:11,color:a.textMuted},children:g("dataBranchManager.getChangesFromSource","Get changes from source")})]}),e.jsxs("button",{onClick:()=>p("push"),disabled:i.environment==="production",style:{flex:1,padding:"16px",borderRadius:8,border:`2px solid ${a.border}`,background:"transparent",color:i.environment==="production"?a.textMuted:a.text,cursor:i.environment==="production"?"not-allowed":"pointer",textAlign:"center",opacity:i.environment==="production"?.5:1},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:e.jsx(s.NiceIcon,{name:"arrow-up",size:24})}),e.jsx("div",{style:{fontWeight:500},children:g("dataBranchManager.push","Push")}),e.jsx("div",{style:{fontSize:11,color:a.textMuted},children:g("dataBranchManager.sendChangesToSource","Send changes to source")})]})]}),e.jsx("button",{onClick:()=>k(null),style:{width:"100%",padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:13},children:g("dataBranchManager.cancel","Cancel")})]})}),O==="delete"&&i&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(null),children:e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:a.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0",color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(s.NiceIcon,{name:"trash",size:14})," ",g("dataBranchManager.deleteEnvironment","Delete Environment")]}),e.jsxs("p",{style:{color:a.textMuted,fontSize:13,marginBottom:16},children:[K,e.jsx("strong",{children:i.displayName}),v," ",g("dataBranchManager.willRemoveAllRecords","This will remove all {count} records.").replace("{count}",i.size?.records.toLocaleString()??"")]}),e.jsxs("div",{style:{padding:12,background:"var(--nice-danger-tint-15, #ef444420)",border:"1px solid var(--nice-danger, #ef4444)",borderRadius:6,marginBottom:16,fontSize:12},children:[e.jsx(s.NiceIcon,{name:"warning",size:14})," ",g("dataBranchManager.thisActionCannotBeUndone","This action cannot be undone.")]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>k(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:13},children:g("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:ee,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:g("dataBranchManager.deleteEnvironment","Delete Environment")})]})]})}),O==="protect"&&i&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(null),children:e.jsxs("div",{onClick:o=>o.stopPropagation(),style:{background:a.cardBg,borderRadius:12,padding:24,width:450},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(s.NiceIcon,{name:"lock",size:14})," ",g("dataBranchManager.protectEnvironment","Protect Environment")]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,marginBottom:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:z.requireApproval,onChange:o=>r(I=>({...I,requireApproval:o.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:g("dataBranchManager.requireApprovalForChanges","Require approval for changes")})]}),z.requireApproval&&e.jsxs("div",{style:{marginLeft:24},children:[e.jsx("label",{style:{display:"block",marginBottom:4,fontSize:11,color:a.textMuted},children:g("dataBranchManager.minimumApprovers","Minimum approvers")}),e.jsx("input",{type:"number",min:1,max:5,value:z.approversCount,onChange:o=>r(I=>({...I,approversCount:parseInt(o.target.value)||1})),style:{width:80,padding:6,borderRadius:4,border:`1px solid ${a.border}`,background:a.bg,color:a.text}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:z.requireBackup,onChange:o=>r(I=>({...I,requireBackup:o.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:g("dataBranchManager.requireBackupBeforeChanges","Require backup before changes")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!z.allowDirectChanges,onChange:o=>r(I=>({...I,allowDirectChanges:!o.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:"Block direct changes (require merge)"})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>k(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${a.border}`,background:"transparent",color:a.text,cursor:"pointer",fontSize:13},children:g("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:g("dataBranchManager.applyProtection","Apply Protection")})]})]})})]})},be=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchManager:de},Symbol.toStringTag,{value:"Module"})),ve=[{table:"customers",displayName:"Customers",module:"CRM",added:15,modified:42,deleted:3,records:[{id:"CUST-001",changeType:"added",primaryKey:{customer_id:"CUST-001"},fields:[{field:"name",fieldType:"string",oldValue:void 0,newValue:"Acme Corp",changeType:"added"},{field:"email",fieldType:"string",oldValue:void 0,newValue:"info@acme.com",changeType:"added"},{field:"status",fieldType:"string",oldValue:void 0,newValue:"active",changeType:"added"}],changedAt:new Date,changedBy:"admin"},{id:"CUST-042",changeType:"modified",primaryKey:{customer_id:"CUST-042"},fields:[{field:"email",fieldType:"string",oldValue:"old@email.com",newValue:"new@email.com",changeType:"modified"},{field:"phone",fieldType:"string",oldValue:"+1-555-0100",newValue:"+1-555-0199",changeType:"modified"},{field:"updated_at",fieldType:"datetime",oldValue:"2025-01-01",newValue:"2025-04-01",changeType:"modified"}],changedAt:new Date,changedBy:"user1"},{id:"CUST-099",changeType:"deleted",primaryKey:{customer_id:"CUST-099"},fields:[{field:"name",fieldType:"string",oldValue:"Old Customer",newValue:void 0,changeType:"deleted"},{field:"status",fieldType:"string",oldValue:"inactive",newValue:void 0,changeType:"deleted"}],changedAt:new Date,changedBy:"admin"}]},{table:"products",displayName:"Products",module:"Inventory",added:8,modified:25,deleted:0,records:[{id:"PROD-NEW-1",changeType:"added",primaryKey:{product_id:"PROD-NEW-1"},fields:[{field:"name",fieldType:"string",oldValue:void 0,newValue:"New Product",changeType:"added"},{field:"price",fieldType:"decimal",oldValue:void 0,newValue:99.99,changeType:"added"}],changedAt:new Date,changedBy:"inventory_admin"}]},{table:"orders",displayName:"Orders",module:"Sales",added:156,modified:12,deleted:0,records:[]},{table:"config",displayName:"Configuration",module:"System",added:0,modified:3,deleted:0,records:[{id:"CFG-TAX-RATE",changeType:"modified",primaryKey:{config_key:"tax_rate"},fields:[{field:"value",fieldType:"decimal",oldValue:.2,newValue:.21,changeType:"modified"}],changedAt:new Date,changedBy:"admin"}]}],le=({sourceBranch:f,targetBranch:B,branches:N=[],diffItems:w=ve,onCompare:R,onExport:E,onSelectRecord:G,className:W,style:Q,"data-testid":Y})=>{const{t:c}=s.useNiceTranslation(),[S,h]=x.useState("summary"),[C,b]=x.useState("all"),[g,K]=x.useState(null),[v,$]=x.useState(null),[M,L]=x.useState(""),[F,O]=x.useState(!1),[k,u]=x.useState(f?.id??""),[j,y]=x.useState(B?.id??""),A=x.useMemo(()=>w.reduce((n,i)=>({tables:n.tables+1,added:n.added+i.added,modified:n.modified+i.modified,deleted:n.deleted+i.deleted}),{tables:0,added:0,modified:0,deleted:0}),[w]),_=x.useMemo(()=>w.filter(n=>{if(C==="added"&&n.added===0||C==="modified"&&n.modified===0||C==="deleted"&&n.deleted===0)return!1;if(M){const i=M.toLowerCase();return n.table.toLowerCase().includes(i)||n.displayName.toLowerCase().includes(i)||n.module?.toLowerCase().includes(i)}return!0}).sort((n,i)=>i.added+i.modified+i.deleted-(n.added+n.modified+n.deleted)),[w,C,M]),d=x.useMemo(()=>w.find(n=>n.table===g),[w,g]),D=x.useMemo(()=>d?d.records.filter(n=>C==="all"?!0:n.changeType===C):[],[d,C]),U=x.useCallback(()=>{k&&j&&R?.(k,j)},[k,j,R]),z=n=>{switch(n){case"added":return"var(--nice-color-success, #22c55e)";case"modified":return"var(--nice-color-warning, #f59e0b)";case"deleted":return"var(--nice-color-error, #ef4444)";default:return"var(--nice-text-muted, #888)"}},r=n=>{switch(n){case"added":return"+";case"modified":return"~";case"deleted":return"-";default:return" "}},t={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"};return e.jsxs("div",{className:`nice-data-diff-viewer ${W||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",...Q},"data-testid":Y,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(s.NiceIcon,{name:"bar-chart",size:16})," ",c("dataDiffViewer.dataDiffViewer","Data Diff Viewer")]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("select",{value:k,onChange:n=>u(n.target.value),style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:c("dataDiffViewer.selectSource","Select source...")}),N.map(n=>e.jsx("option",{value:n.id,children:n.displayName},n.id))]}),e.jsx("span",{style:{color:t.textMuted},children:e.jsx(s.NiceIcon,{name:"arrow-right",size:12})}),e.jsxs("select",{value:j,onChange:n=>y(n.target.value),style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:c("dataDiffViewer.selectTarget","Select target...")}),N.map(n=>e.jsx("option",{value:n.id,children:n.displayName},n.id))]}),e.jsx("button",{onClick:U,disabled:!k||!j,style:{padding:"6px 12px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:k&&j?"pointer":"not-allowed",fontSize:12,opacity:k&&j?1:.5},children:c("dataDiffViewer.compare","Compare")})]}),e.jsx("div",{style:{flex:1}}),e.jsxs("select",{onChange:n=>{n.target.value&&(E?.(n.target.value),n.target.value="")},style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:c("dataDiffViewer.export","Export...")}),e.jsx("option",{value:"json",children:c("dataDiffViewer.json","JSON")}),e.jsx("option",{value:"csv",children:"CSV"}),e.jsx("option",{value:"sql",children:c("dataDiffViewer.sqlScript","SQL Script")})]})]}),e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:t.textMuted,fontSize:12},children:"Tables:"}),e.jsx("span",{style:{fontWeight:600},children:A.tables})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:z("added")}}),e.jsxs("span",{style:{fontSize:12},children:["+",A.added," added"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:z("modified")}}),e.jsxs("span",{style:{fontSize:12},children:["~",A.modified," modified"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:z("deleted")}}),e.jsxs("span",{style:{fontSize:12},children:["-",A.deleted," deleted"]})]}),e.jsx("div",{style:{flex:1}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","added","modified","deleted"].map(n=>e.jsx("button",{onClick:()=>b(n),style:{padding:"4px 12px",borderRadius:4,border:"none",background:C===n?"var(--nice-color-primary, #3b82f6)":t.cardBg,color:C===n?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:n},n))}),e.jsx("input",{type:"text",value:M,onChange:n=>L(n.target.value),placeholder:c("dataDiffViewer.searchTables","Search tables..."),style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12,width:180}})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:280,borderRight:`1px solid ${t.border}`,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:["Tables (",_.length,")"]}),_.map(n=>e.jsxs("div",{onClick:()=>{K(n.table),$(null),h("table")},style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,background:g===n.table?t.cardBg:"transparent",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontSize:14},children:e.jsx(s.NiceIcon,{name:"database",size:14})}),e.jsx("span",{style:{fontWeight:500,fontSize:13},children:n.displayName})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:11},children:[n.added>0&&e.jsxs("span",{style:{color:z("added")},children:["+",n.added]}),n.modified>0&&e.jsxs("span",{style:{color:z("modified")},children:["~",n.modified]}),n.deleted>0&&e.jsxs("span",{style:{color:z("deleted")},children:["-",n.deleted]})]}),n.module&&e.jsx("div",{style:{fontSize:10,color:t.textMuted,marginTop:4},children:n.module})]},n.table))]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[S==="summary"&&e.jsxs("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(s.NiceIcon,{name:"bar-chart",size:48})}),e.jsx("div",{children:c("dataDiffViewer.selectATableToView","Select a table to view changes")})]}),S==="table"&&d&&e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h4",{style:{margin:0,fontSize:14},children:d.displayName}),e.jsxs("span",{style:{fontSize:11,color:t.textMuted},children:[d.table," • ",d.module]})]}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12},children:[e.jsxs("span",{style:{color:z("added")},children:["+",d.added]}),e.jsxs("span",{style:{color:z("modified")},children:["~",d.modified]}),e.jsxs("span",{style:{color:z("deleted")},children:["-",d.deleted]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:D.length===0?e.jsx("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:c("dataDiffViewer.noRecordsMatchTheCurrent","No records match the current filter")}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:t.cardBg},children:[e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.change","Change")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.recordId","Record ID")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.fieldsChanged","Fields Changed")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.changedBy","Changed By")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.date","Date")})]})}),e.jsx("tbody",{children:D.map(n=>e.jsxs("tr",{onClick:()=>{$(n),h("record")},style:{cursor:"pointer",background:v?.id===n.id?t.cardBg:"transparent"},children:[e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:4,background:z(n.changeType)+"30",color:z(n.changeType),fontWeight:600,fontSize:14},children:r(n.changeType)})}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace"},children:n.id}),e.jsxs("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:[n.fields.length," field",n.fields.length!==1?"s":""]}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:n.changedBy??"-"}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,color:t.textMuted},children:n.changedAt?.toLocaleString()??"-"})]},n.id))})]})})]}),S==="record"&&v&&d&&e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsxs("button",{onClick:()=>h("table"),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataDiffViewer.back","Back")]}),e.jsxs("div",{children:[e.jsxs("h4",{style:{margin:0,fontSize:14},children:[d.displayName," / ",v.id]}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:z(v.changeType)+"30",color:z(v.changeType),borderRadius:4,fontSize:10,fontWeight:600,marginTop:4,textTransform:"uppercase"},children:v.changeType})]})]}),e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,background:t.cardBg},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,marginBottom:4},children:c("dataDiffViewer.primaryKey","Primary Key")}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12},children:Object.entries(v.primaryKey).map(([n,i])=>e.jsxs("span",{style:{marginRight:16},children:[e.jsxs("span",{style:{color:t.textMuted},children:[n,":"]})," ",String(i)]},n))})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:16},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:t.cardBg},children:[e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`,width:30}}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.field","Field")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.type","Type")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.sourceValue","Source Value")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:c("dataDiffViewer.targetValue","Target Value")})]})}),e.jsx("tbody",{children:v.fields.map(n=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`},children:e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:4,background:z(n.changeType)+"30",color:z(n.changeType),fontWeight:600,fontSize:12},children:r(n.changeType)})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontWeight:500},children:n.field}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,color:t.textMuted},children:n.fieldType}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace",background:n.changeType==="deleted"?"var(--nice-danger-tint-15, #ef444420)":"transparent"},children:n.oldValue!==void 0?String(n.oldValue):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:"null"})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace",background:n.changeType==="added"?"var(--nice-success-tint-12, #22c55e20)":n.changeType==="modified"?"var(--nice-warning-tint-15, #f59e0b20)":"transparent"},children:n.newValue!==void 0?String(n.newValue):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:"null"})})]},n.field))})]}),e.jsxs("div",{style:{marginTop:24,padding:16,background:t.cardBg,borderRadius:8},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,marginBottom:8},children:c("dataDiffViewer.changeMetadata","Change Metadata")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 1fr",gap:"8px 16px",fontSize:12},children:[e.jsx("span",{style:{color:t.textMuted},children:c("dataDiffViewer.changedBy2","Changed by")}),e.jsx("span",{children:v.changedBy??"Unknown"}),e.jsx("span",{style:{color:t.textMuted},children:c("dataDiffViewer.changedAt","Changed at")}),e.jsx("span",{children:v.changedAt?.toLocaleString()??"Unknown"})]})]})]})]})]})]})]})},je=Object.freeze(Object.defineProperty({__proto__:null,NiceDataDiffViewer:le},Symbol.toStringTag,{value:"Module"})),Se=[{id:"commit-1",shortId:"c1a2b3c",message:"Initial production snapshot",branch:"production",environment:"production",author:{id:"system",name:"System"},timestamp:new Date("2025-01-01T10:00:00"),parents:[],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:265770,recordsModified:0,recordsDeleted:0},tags:["v1.0.0"]},{id:"commit-2",shortId:"d4e5f6g",message:"Clone to UAT for Q1 testing",branch:"uat",environment:"uat",author:{id:"admin",name:"Admin"},timestamp:new Date("2025-01-15T09:00:00"),parents:["commit-1"],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:265e3,recordsModified:0,recordsDeleted:0}},{id:"commit-3",shortId:"h7i8j9k",message:"Customer data migration",branch:"uat",environment:"uat",author:{id:"user1",name:"Data Engineer"},timestamp:new Date("2025-02-01T14:30:00"),parents:["commit-2"],isMerge:!1,isSnapshot:!1,stats:{tables:1,recordsAdded:500,recordsModified:1200,recordsDeleted:50}},{id:"commit-4",shortId:"l0m1n2o",message:"Clone to development",branch:"development",environment:"development",author:{id:"dev1",name:"Developer"},timestamp:new Date("2025-03-01T08:00:00"),parents:["commit-3"],isMerge:!1,isSnapshot:!0,stats:{tables:15,recordsAdded:67120,recordsModified:0,recordsDeleted:0}},{id:"commit-5",shortId:"p3q4r5s",message:"New product catalog import",branch:"development",environment:"development",author:{id:"dev1",name:"Developer"},timestamp:new Date("2025-03-10T16:45:00"),parents:["commit-4"],isMerge:!1,isSnapshot:!1,stats:{tables:2,recordsAdded:350,recordsModified:0,recordsDeleted:0}},{id:"commit-6",shortId:"t6u7v8w",message:"Tax rate configuration update",branch:"development",environment:"development",author:{id:"dev2",name:"Config Admin"},timestamp:new Date("2025-03-15T11:20:00"),parents:["commit-5"],isMerge:!1,isSnapshot:!1,stats:{tables:1,recordsAdded:0,recordsModified:3,recordsDeleted:0}},{id:"commit-7",shortId:"x9y0z1a",message:"Merge development changes to UAT",branch:"uat",environment:"uat",author:{id:"admin",name:"Admin"},timestamp:new Date("2025-03-20T09:00:00"),parents:["commit-3","commit-6"],isMerge:!0,isSnapshot:!1,stats:{tables:3,recordsAdded:350,recordsModified:3,recordsDeleted:0},tags:["uat-release-1"]},{id:"commit-8",shortId:"b2c3d4e",message:"Production weekly backup",branch:"production",environment:"production",author:{id:"system",name:"System"},timestamp:new Date("2025-03-25T02:00:00"),parents:["commit-1"],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:0,recordsModified:5420,recordsDeleted:120},tags:["backup-2025-03-25"]}],ce=({branches:f=[],commits:B=Se,selectedCommitId:N,viewMode:w,showLanes:R=!0,onSelectCommit:E,onSelectBranch:G,onCompare:W,onRestore:Q,className:Y,style:c,"data-testid":S})=>{const{t:h}=s.useNiceTranslation(),[C,b]=x.useState("graph"),[g,K]=x.useState(null),[v,$]=x.useState(null),[M,L]=x.useState(null),F=w??C,O=N??g,k=x.useRef(null),u=x.useMemo(()=>[...B].sort((r,t)=>t.timestamp.getTime()-r.timestamp.getTime()),[B]),j=x.useMemo(()=>{const r={};return Z.forEach((t,n)=>{r[t]=n}),B.reduce((t,n)=>(t[n.id]=r[n.environment]??0,t),{})},[B]),y=x.useMemo(()=>B.find(r=>r.id===O),[B,O]),A=x.useCallback(r=>{v?(W?.(v,r),$(null)):(K(r),E?.(r))},[v,W,E]),_=r=>{const n=new Date().getTime()-r.getTime(),i=Math.floor(n/(1e3*60*60*24));return i===0?"Today":i===1?"Yesterday":i<7?`${i} days ago`:i<30?`${Math.floor(i/7)} weeks ago`:`${Math.floor(i/30)} months ago`},d={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"},D=140,U=12,z=80;return e.jsxs("div",{className:`nice-data-branch-graph ${Y||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:d.bg,color:d.text,fontFamily:"system-ui, sans-serif",...c},"data-testid":S,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${d.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(s.NiceIcon,{name:"bar-chart",size:16})," ",h("dataBranchGraph.dataHistory","Data History")]}),e.jsx("div",{style:{display:"flex",gap:4},children:["graph","timeline","list"].map(r=>e.jsxs("button",{onClick:()=>b(r),style:{padding:"4px 12px",borderRadius:4,border:"none",background:F===r?"var(--nice-color-primary, #3b82f6)":d.cardBg,color:F===r?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:[e.jsx(s.NiceIcon,{name:r==="graph"?"box":r==="timeline"?"calendar":"clipboard",size:14})," ",r]},r))}),e.jsx("div",{style:{flex:1}}),v?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,color:d.textMuted},children:h("dataBranchGraph.selectTargetToCompareWith","Select target to compare with {commit}").replace("{commit}",B.find(r=>r.id===v)?.shortId??"")}),e.jsx("button",{onClick:()=>$(null),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:11},children:h("dataBranchGraph.cancel","Cancel")})]}):e.jsxs("span",{style:{fontSize:12,color:d.textMuted},children:[u.length," snapshots"]})]}),R&&F==="graph"&&e.jsxs("div",{style:{display:"flex",borderBottom:`1px solid ${d.border}`,background:d.cardBg},children:[Z.map(r=>e.jsxs("div",{style:{width:D,padding:"8px 12px",textAlign:"center",borderRight:`1px solid ${d.border}`},children:[e.jsx(s.NiceIcon,{name:H[r],size:16}),e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:T[r]},children:r})]},r)),e.jsx("div",{style:{flex:1,padding:"8px 12px"},children:e.jsx("div",{style:{fontSize:11,color:d.textMuted},children:h("dataBranchGraph.details","Details")})})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[F==="graph"&&e.jsx("div",{ref:k,style:{flex:1,overflow:"auto"},children:e.jsxs("div",{style:{position:"relative",minHeight:u.length*z},children:[e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:D*Z.length,height:u.length*z,pointerEvents:"none"},children:u.map((r,t)=>{const n=t*z+z/2,i=j[r.id]*D+D/2;return r.parents.map(m=>{const V=u.findIndex(l=>l.id===m);if(V===-1)return null;const q=V*z+z/2,P=j[m]*D+D/2,ee=r.isMerge&&r.parents.indexOf(m)>0,p=i===P?`M ${i} ${n} L ${P} ${q}`:`M ${i} ${n} C ${i} ${(n+q)/2}, ${P} ${(n+q)/2}, ${P} ${q}`;return e.jsx("path",{d:p,fill:"none",stroke:ee?"var(--nice-color-accent, #8b5cf6)":T[r.environment],strokeWidth:2,strokeDasharray:ee?"4,4":void 0,opacity:.6},`${r.id}-${m}`)})})}),u.map((r,t)=>{const n=t*z+z/2,i=j[r.id]*D+D/2,m=r.id===O,V=r.id===M,q=r.id===v;return e.jsxs(x.Fragment,{children:[e.jsx("div",{onClick:()=>A(r.id),onMouseEnter:()=>L(r.id),onMouseLeave:()=>L(null),style:{position:"absolute",left:i-U,top:n-U,width:U*2,height:U*2,borderRadius:r.isMerge?4:"50%",background:m||q?"var(--nice-bg-primary, #fff)":T[r.environment],border:`3px solid ${T[r.environment]}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:m||q?"var(--nice-text-primary, #000)":"var(--nice-text-primary, #fff)",zIndex:V?10:1,transform:V?"scale(1.2)":"scale(1)",transition:"transform 0.1s",boxShadow:m?"0 0 0 3px color-mix(in srgb, var(--nice-color-primary, #3b82f6) 50%, transparent)":"none"},children:r.isSnapshot?e.jsx(s.NiceIcon,{name:"camera",size:12}):r.isMerge?e.jsx(s.NiceIcon,{name:"shuffle",size:12}):null}),e.jsxs("div",{style:{position:"absolute",left:D*Z.length+16,top:n-20,right:16,height:40,display:"flex",alignItems:"center",gap:12,padding:"4px 12px",background:m?d.cardBg:"transparent",borderRadius:6,borderLeft:m?`3px solid ${T[r.environment]}`:"none"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:T[r.environment]},children:r.shortId}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.message}),r.tags?.map(P=>e.jsxs("span",{style:{padding:"2px 6px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:4,fontSize:9},children:[e.jsx(s.NiceIcon,{name:"tag",size:12})," ",P]},P)),e.jsx("span",{style:{fontSize:10,color:d.textMuted,whiteSpace:"nowrap"},children:_(r.timestamp)})]})]},r.id)})]})}),F==="timeline"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:u.map((r,t)=>{const n=r.id===O,i=u[t-1],m=!i||r.timestamp.toDateString()!==i.timestamp.toDateString();return e.jsxs(x.Fragment,{children:[m&&e.jsx("div",{style:{padding:"8px 0",fontSize:11,fontWeight:600,color:d.textMuted,borderBottom:`1px solid ${d.border}`,marginBottom:8},children:r.timestamp.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),e.jsxs("div",{onClick:()=>A(r.id),style:{display:"flex",gap:12,padding:12,marginBottom:8,background:n?d.cardBg:"transparent",borderRadius:8,cursor:"pointer",border:`1px solid ${n?T[r.environment]:"transparent"}`},children:[e.jsx("div",{style:{width:60,textAlign:"right",fontSize:11,color:d.textMuted},children:r.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}),e.jsxs("div",{style:{width:80,padding:"4px 8px",background:T[r.environment]+"30",color:T[r.environment],borderRadius:4,fontSize:10,textAlign:"center",fontWeight:600,textTransform:"uppercase"},children:[e.jsx(s.NiceIcon,{name:H[r.environment],size:14})," ",r.environment.substring(0,4)]}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:d.textMuted},children:r.shortId}),r.isSnapshot&&e.jsx("span",{style:{fontSize:12},children:e.jsx(s.NiceIcon,{name:"camera",size:12})}),r.isMerge&&e.jsx("span",{style:{fontSize:12},children:e.jsx(s.NiceIcon,{name:"shuffle",size:12})}),r.tags?.map(V=>e.jsx("span",{style:{padding:"1px 6px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:3,fontSize:9},children:V},V))]}),e.jsx("div",{style:{fontSize:13,marginTop:4},children:r.message}),e.jsxs("div",{style:{fontSize:11,color:d.textMuted,marginTop:4},children:["by ",r.author.name," •"," ",e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",r.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",r.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",r.stats.recordsDeleted]})]})]})]})]},r.id)})}),F==="list"&&e.jsx("div",{style:{flex:1,overflow:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:d.cardBg},children:[e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${d.border}`},children:"ID"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${d.border}`},children:h("dataBranchGraph.environment","Environment")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${d.border}`},children:h("dataBranchGraph.message","Message")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${d.border}`},children:h("dataBranchGraph.author","Author")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${d.border}`},children:h("dataBranchGraph.date","Date")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"right",borderBottom:`1px solid ${d.border}`},children:h("dataBranchGraph.changes","Changes")})]})}),e.jsx("tbody",{children:u.map(r=>e.jsxs("tr",{onClick:()=>A(r.id),style:{cursor:"pointer",background:r.id===O?d.cardBg:"transparent"},children:[e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`,fontFamily:"monospace"},children:[r.shortId,r.isSnapshot&&e.jsxs(e.Fragment,{children:[" ",e.jsx(s.NiceIcon,{name:"camera",size:12})]}),r.isMerge&&e.jsxs(e.Fragment,{children:[" ",e.jsx(s.NiceIcon,{name:"shuffle",size:12})]})]}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`},children:e.jsx("span",{style:{padding:"2px 8px",background:T[r.environment]+"30",color:T[r.environment],borderRadius:4,fontSize:10,fontWeight:600},children:r.environment})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`},children:r.message}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`,color:d.textMuted},children:r.author.name}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`,color:d.textMuted},children:r.timestamp.toLocaleString()}),e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${d.border}`,textAlign:"right"},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",r.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",r.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",r.stats.recordsDeleted]})]})]},r.id))})]})}),y&&e.jsxs("div",{style:{width:320,borderLeft:`1px solid ${d.border}`,overflow:"auto",padding:16},children:[e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:24},children:e.jsx(s.NiceIcon,{name:y.isSnapshot?"camera":y.isMerge?"shuffle":"edit",size:24})}),e.jsx("span",{style:{padding:"4px 10px",background:T[y.environment]+"30",color:T[y.environment],borderRadius:6,fontSize:11,fontWeight:600,textTransform:"uppercase"},children:y.environment})]}),e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:14},children:y.message}),y.description&&e.jsx("p",{style:{margin:0,fontSize:12,color:d.textMuted},children:y.description})]}),y.tags&&y.tags.length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:d.textMuted,marginBottom:4},children:h("dataBranchGraph.tags","Tags")}),e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:y.tags.map(r=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:4,fontSize:11},children:[e.jsx(s.NiceIcon,{name:"tag",size:12})," ",r]},r))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:d.textMuted,marginBottom:8},children:h("dataBranchGraph.changes","Changes")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[e.jsxs("div",{style:{padding:10,background:d.cardBg,borderRadius:6,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:600},children:y.stats.tables}),e.jsx("div",{style:{fontSize:10,color:d.textMuted},children:h("dataBranchGraph.tables","Tables")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-success-tint-12, #22c55e20)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",y.stats.recordsAdded]}),e.jsx("div",{style:{fontSize:10,color:d.textMuted},children:h("dataBranchGraph.added","Added")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-warning-tint-15, #f59e0b20)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:["~",y.stats.recordsModified]}),e.jsx("div",{style:{fontSize:10,color:d.textMuted},children:h("dataBranchGraph.modified","Modified")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-danger-tint-15, #ef444420)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",y.stats.recordsDeleted]}),e.jsx("div",{style:{fontSize:10,color:d.textMuted},children:h("dataBranchGraph.deleted","Deleted")})]})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:d.textMuted,marginBottom:8},children:h("dataBranchGraph.details","Details")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"6px 12px",fontSize:12},children:[e.jsx("span",{style:{color:d.textMuted},children:"ID"}),e.jsx("span",{style:{fontFamily:"monospace"},children:y.shortId}),e.jsx("span",{style:{color:d.textMuted},children:h("dataBranchGraph.author","Author")}),e.jsx("span",{children:y.author.name}),e.jsx("span",{style:{color:d.textMuted},children:h("dataBranchGraph.date","Date")}),e.jsx("span",{children:y.timestamp.toLocaleString()}),e.jsx("span",{style:{color:d.textMuted},children:h("dataBranchGraph.type","Type")}),e.jsx("span",{children:y.isSnapshot?"Snapshot":y.isMerge?"Merge":"Change"}),y.parents.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:d.textMuted},children:h("dataBranchGraph.parents","Parents")}),e.jsx("span",{style:{fontFamily:"monospace"},children:y.parents.map(r=>B.find(t=>t.id===r)?.shortId??r).join(", ")})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("button",{onClick:()=>$(y.id),style:{padding:"8px 12px",borderRadius:6,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"search",size:14})," ",h("dataBranchGraph.compareWith","Compare with...")]}),y.isSnapshot&&e.jsxs("button",{onClick:()=>Q?.(y.id),style:{padding:"8px 12px",borderRadius:6,border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:[e.jsx(s.NiceIcon,{name:"reply",size:14})," ",h("dataBranchGraph.restoreThisSnapshot","Restore this snapshot")]})]})]})]})]})},ke=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchGraph:ce},Symbol.toStringTag,{value:"Module"})),ze=[{target:".nice-data-merge-builder",titleKey:"tutorial.dataMergeBuilder.intro.title",title:"Data merge",contentKey:"tutorial.dataMergeBuilder.intro.content",content:"Walk through the steps: choose source and target branches, preview changes, resolve conflicts, set options, then confirm the merge.",placement:"auto"}],Be=[{id:"prod-1",shortId:"prod-1",name:"production",displayName:"Production",isDefault:!0,isProtected:!0,createdBy:{id:"system",name:"System"},createdAt:{date:new Date,relative:"1 year ago"},status:"active",type:"data",environment:"production",tenant:"tenant-1",size:{records:265770,bytes:2921e5}},{id:"uat-1",shortId:"uat-1",name:"uat",displayName:"UAT",isDefault:!1,isProtected:!0,createdBy:{id:"admin",name:"Admin"},createdAt:{date:new Date,relative:"3 months ago"},upstream:"prod-1",status:"active",type:"data",environment:"uat",tenant:"tenant-1",size:{records:265e3,bytes:29e7}},{id:"dev-1",shortId:"dev-1",name:"development",displayName:"Development",isDefault:!1,isProtected:!1,createdBy:{id:"dev1",name:"Developer"},createdAt:{date:new Date,relative:"1 month ago"},upstream:"uat-1",status:"active",type:"data",environment:"development",tenant:"tenant-1",size:{records:67120,bytes:1591e5}}],ie={sourceId:"dev-1",targetId:"uat-1",tables:[{table:"customers",displayName:"Customers",module:"CRM",inserts:15,updates:42,deletes:3,conflicts:2,selected:!0},{table:"products",displayName:"Products",module:"Inventory",inserts:350,updates:25,deletes:0,conflicts:0,selected:!0},{table:"config",displayName:"Configuration",module:"System",inserts:0,updates:3,deletes:0,conflicts:1,selected:!0},{table:"orders",displayName:"Orders",module:"Sales",inserts:0,updates:0,deletes:0,conflicts:0,selected:!1}],conflicts:[{id:"conflict-1",table:"customers",recordId:"CUST-042",field:"email",sourceValue:"new@email.com",targetValue:"different@email.com",type:"concurrent-update"},{id:"conflict-2",table:"customers",recordId:"CUST-099",field:"status",sourceValue:"deleted",targetValue:"active",type:"delete-update"},{id:"conflict-3",table:"config",recordId:"CFG-TAX-RATE",field:"value",sourceValue:.21,targetValue:.22,type:"concurrent-update"}],estimatedDuration:45,requiresApproval:!0},pe=({branches:f=Be,sourceBranchId:B,targetBranchId:N,onPreview:w,onMerge:R,onCancel:E,tutorial:G,className:W,style:Q,"data-testid":Y})=>{const{t:c}=s.useNiceTranslation(),[S,h]=x.useState("select"),[C,b]=x.useState(B??""),[g,K]=x.useState(N??""),[v,$]=x.useState(null),[M,L]=x.useState([]),[F,O]=x.useState("keep-source"),[k,u]=x.useState(!0),[j,y]=x.useState(!1),[A,_]=x.useState(null),[d,D]=x.useState({}),[U,z]=x.useState(!1),r=x.useMemo(()=>f.find(l=>l.id===C),[f,C]),t=x.useMemo(()=>f.find(l=>l.id===g),[f,g]),n=x.useMemo(()=>r?f.filter(l=>l.id!==C&&(ae(r.environment,l.environment)||l.environment==="development"||l.environment==="testing")):f,[f,C,r]),i=x.useMemo(()=>v?v.tables.filter(a=>M.includes(a.table)).reduce((a,o)=>({inserts:a.inserts+o.inserts,updates:a.updates+o.updates,deletes:a.deletes+o.deletes,conflicts:a.conflicts+o.conflicts}),{inserts:0,updates:0,deletes:0,conflicts:0}):{inserts:0,updates:0,deletes:0,conflicts:0},[v,M]),m=x.useMemo(()=>v?v.conflicts.filter(l=>!d[l.id]):[],[v,d]),V=x.useCallback(async()=>{z(!0),w?.(C,g),await new Promise(l=>setTimeout(l,1e3)),$(ie),L(ie.tables.filter(l=>l.selected).map(l=>l.table)),z(!1),h("preview")},[C,g,w]),q=x.useCallback(()=>{const l={sourceId:C,targetId:g,strategy:F,tables:M,createBackup:k,dryRun:j,scheduledAt:A??void 0,conflictResolutions:Object.entries(d).reduce((a,[o,I])=>({...a,[o]:{conflictId:o,strategy:I}}),{})};R?.(l)},[C,g,F,M,k,j,A,d,R]),P=(l,a)=>{D(o=>({...o,[l]:a}))},ee=l=>{if(!v)return;const a={};v.conflicts.forEach(o=>{a[o.id]=l}),D(a)},p={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"};return e.jsxs("div",{className:`nice-data-merge-builder ${W||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:p.bg,color:p.text,fontFamily:"system-ui, sans-serif",...Q},"data-testid":Y,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${p.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(s.NiceIcon,{name:"shuffle",size:16})," ",c("dataMergeBuilder.dataMerge","Data Merge")]}),e.jsx("div",{style:{display:"flex",gap:8,marginLeft:"auto"},children:["select","preview","conflicts","options","confirm"].map((l,a)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:S===l?"var(--nice-color-primary, #3b82f6)":["select","preview","conflicts","options","confirm"].indexOf(S)>a?"var(--nice-color-success, #22c55e)":p.cardBg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600},children:["select","preview","conflicts","options","confirm"].indexOf(S)>a?e.jsx(s.NiceIcon,{name:"check",size:14}):a+1}),a<4&&e.jsx("div",{style:{width:24,height:2,background:["select","preview","conflicts","options","confirm"].indexOf(S)>a?"var(--nice-color-success, #22c55e)":p.border}})]},l))}),e.jsx(s.NiceTutorialButton,{steps:s.resolveTutorial(G,ze)})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[S==="select"&&e.jsxs("div",{style:{maxWidth:600,margin:"0 auto"},children:[e.jsx("h4",{style:{marginTop:0},children:c("dataMergeBuilder.selectEnvironments","Select Environments")}),e.jsx("p",{style:{color:p.textMuted,fontSize:13},children:c("dataMergeBuilder.chooseTheSourceAndTarget","Choose the source and target environments for the merge operation.")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:16,alignItems:"center",marginTop:24},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:p.textMuted},children:c("dataMergeBuilder.sourceEnvironment","Source Environment")}),e.jsxs("select",{value:C,onChange:l=>{b(l.target.value),K("")},style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:14},children:[e.jsx("option",{value:"",children:c("dataMergeBuilder.selectSource","Select source...")}),f.map(l=>e.jsx("option",{value:l.id,children:l.displayName},l.id))]}),r&&e.jsxs("div",{style:{marginTop:12,padding:12,background:T[r.environment]+"20",borderRadius:8,border:`1px solid ${T[r.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(s.NiceIcon,{name:H[r.environment],size:20}),e.jsx("span",{style:{fontWeight:600},children:r.displayName})]}),e.jsxs("div",{style:{fontSize:11,color:p.textMuted,marginTop:4},children:[r.size?.records.toLocaleString()," records"]})]})]}),e.jsx("div",{style:{fontSize:24,color:p.textMuted},children:e.jsx(s.NiceIcon,{name:"arrow-right",size:24})}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:p.textMuted},children:c("dataMergeBuilder.targetEnvironment","Target Environment")}),e.jsxs("select",{value:g,onChange:l=>K(l.target.value),disabled:!C,style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:14,opacity:C?1:.5},children:[e.jsx("option",{value:"",children:c("dataMergeBuilder.selectTarget","Select target...")}),n.map(l=>e.jsx("option",{value:l.id,children:l.displayName},l.id))]}),t&&e.jsxs("div",{style:{marginTop:12,padding:12,background:T[t.environment]+"20",borderRadius:8,border:`1px solid ${T[t.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(s.NiceIcon,{name:H[t.environment],size:20}),e.jsx("span",{style:{fontWeight:600},children:t.displayName}),t.isProtected&&e.jsx("span",{children:e.jsx(s.NiceIcon,{name:"lock",size:16})})]}),e.jsxs("div",{style:{fontSize:11,color:p.textMuted,marginTop:4},children:[t.size?.records.toLocaleString()," records"]})]})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:E,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:c("dataMergeBuilder.cancel","Cancel")}),e.jsx("button",{onClick:V,disabled:!C||!g||U,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:C&&g&&!U?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:C&&g&&!U?1:.5},children:U?e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"clock",size:14})," ",c("dataMergeBuilder.loading","Loading...")]}):e.jsxs(e.Fragment,{children:[c("dataMergeBuilder.previewChanges","Preview Changes")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]})})]})]}),S==="preview"&&v&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>h("select"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:c("dataMergeBuilder.previewChanges","Preview Changes")})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[e.jsxs("div",{style:{padding:16,background:"var(--nice-success-tint-12, #22c55e20)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",i.inserts]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.inserts","Inserts")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-warning-tint-15, #f59e0b20)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:["~",i.updates]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.updates","Updates")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-danger-tint-15, #ef444420)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",i.deletes]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.deletes","Deletes")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-accent-tint-12, #8b5cf620)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-accent, #8b5cf6)"},children:[e.jsx(s.NiceIcon,{name:"warning",size:14})," ",i.conflicts]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.conflicts","Conflicts")})]})]}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsxs("span",{style:{fontSize:12,color:p.textMuted},children:["Select tables to merge (",M.length," / ",v.tables.length,")"]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>L(v.tables.map(l=>l.table)),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:11},children:c("dataMergeBuilder.selectAll","Select All")}),e.jsx("button",{onClick:()=>L([]),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:11},children:c("dataMergeBuilder.clear","Clear")})]})]}),e.jsx("div",{style:{border:`1px solid ${p.border}`,borderRadius:8,overflow:"hidden"},children:v.tables.map(l=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:`1px solid ${p.border}`,cursor:"pointer",background:M.includes(l.table)?p.cardBg:"transparent"},children:[e.jsx("input",{type:"checkbox",checked:M.includes(l.table),onChange:a=>{a.target.checked?L(o=>[...o,l.table]):L(o=>o.filter(I=>I!==l.table))}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:l.displayName}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:l.module})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:12},children:[l.inserts>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",l.inserts]}),l.updates>0&&e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",l.updates]}),l.deletes>0&&e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",l.deletes]}),l.conflicts>0&&e.jsxs("span",{style:{color:"var(--nice-color-accent, #8b5cf6)"},children:[e.jsx(s.NiceIcon,{name:"warning",size:14})," ",l.conflicts]})]})]},l.table))})]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>h("select"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>h(i.conflicts>0?"conflicts":"options"),disabled:M.length===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:M.length>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:M.length>0?1:.5},children:[i.conflicts>0?c("dataMergeBuilder.resolveConflicts","Resolve Conflicts"):c("dataMergeBuilder.configureMerge","Configure Merge")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]})]})]}),S==="conflicts"&&v&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>h("preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsxs("h4",{style:{margin:0},children:["Resolve Conflicts (",m.length," remaining)"]})]}),e.jsxs("div",{style:{padding:16,background:p.cardBg,borderRadius:8,marginBottom:24,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:13},children:"Apply to all conflicts:"}),e.jsx("button",{onClick:()=>ee("keep-source"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:c("dataMergeBuilder.keepSource","Keep Source")}),e.jsx("button",{onClick:()=>ee("keep-target"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:c("dataMergeBuilder.keepTarget","Keep Target")})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:v.conflicts.map(l=>{const a=!!d[l.id];return e.jsxs("div",{style:{padding:16,background:p.cardBg,borderRadius:8,border:`1px solid ${a?"var(--nice-color-success, #22c55e)":"var(--nice-color-accent, #8b5cf6)"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("span",{style:{fontSize:16},children:e.jsx(s.NiceIcon,{name:a?"check":"warning",size:16})}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:500},children:[l.table,".",l.field]}),e.jsxs("div",{style:{fontSize:11,color:p.textMuted},children:["Record: ",l.recordId," • ",l.type.replace("-"," ")]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{style:{padding:12,background:d[l.id]==="keep-source"?"var(--nice-success-tint-12, #22c55e20)":p.bg,borderRadius:6,border:`1px solid ${d[l.id]==="keep-source"?"var(--nice-color-success, #22c55e)":p.border}`,cursor:"pointer"},onClick:()=>P(l.id,"keep-source"),children:[e.jsxs("div",{style:{fontSize:10,color:p.textMuted,marginBottom:4},children:["Source (",r?.displayName,")"]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(l.sourceValue)})]}),e.jsxs("div",{style:{padding:12,background:d[l.id]==="keep-target"?"var(--nice-success-tint-12, #22c55e20)":p.bg,borderRadius:6,border:`1px solid ${d[l.id]==="keep-target"?"var(--nice-color-success, #22c55e)":p.border}`,cursor:"pointer"},onClick:()=>P(l.id,"keep-target"),children:[e.jsxs("div",{style:{fontSize:10,color:p.textMuted,marginBottom:4},children:["Target (",t?.displayName,")"]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(l.targetValue)})]})]})]},l.id)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>h("preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>h("options"),disabled:m.length>0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:m.length===0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:m.length===0?1:.5},children:[c("dataMergeBuilder.configureMerge","Configure Merge")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]})]})]}),S==="options"&&e.jsxs("div",{style:{maxWidth:500,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>h(i.conflicts>0?"conflicts":"preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:c("dataMergeBuilder.mergeOptions","Merge Options")})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:k,onChange:l=>u(l.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:c("dataMergeBuilder.createBackupBeforeMerge","Create backup before merge")}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.recommendedForProtectedEnvironments","Recommended for protected environments")})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j,onChange:l=>y(l.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:"Dry run (preview only)"}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:c("dataMergeBuilder.simulateMergeWithoutApplyingChanges","Simulate merge without applying changes")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:p.textMuted},children:"Schedule merge (optional)"}),e.jsx("input",{type:"datetime-local",value:A?.toISOString().slice(0,16)??"",onChange:l=>_(l.target.value?new Date(l.target.value):null),style:{padding:10,borderRadius:6,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:13}})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>h(i.conflicts>0?"conflicts":"preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>h("confirm"),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:[c("dataMergeBuilder.reviewAndConfirm","Review & Confirm")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]})]})]}),S==="confirm"&&v&&e.jsxs("div",{style:{maxWidth:500,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>h("options"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",c("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:c("dataMergeBuilder.confirmMerge","Confirm Merge")})]}),e.jsxs("div",{style:{padding:20,background:p.cardBg,borderRadius:8,marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:16},children:[e.jsxs("div",{style:{padding:"8px 12px",background:T[r?.environment??"development"]+"30",borderRadius:6},children:[e.jsx(s.NiceIcon,{name:H[r?.environment??"development"],size:14})," ",r?.displayName]}),e.jsx("span",{children:e.jsx(s.NiceIcon,{name:"arrow-right",size:12})}),e.jsxs("div",{style:{padding:"8px 12px",background:T[t?.environment??"production"]+"30",borderRadius:6},children:[e.jsx(s.NiceIcon,{name:H[t?.environment??"production"],size:14})," ",t?.displayName]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:p.textMuted},children:c("dataMergeBuilder.tables","Tables")}),e.jsx("span",{children:M.length}),e.jsx("span",{style:{color:p.textMuted},children:c("dataMergeBuilder.recordsAffected","Records affected")}),e.jsx("span",{children:i.inserts+i.updates+i.deletes}),e.jsx("span",{style:{color:p.textMuted},children:c("dataMergeBuilder.backup","Backup")}),e.jsx("span",{children:k?"Yes":"No"}),e.jsx("span",{style:{color:p.textMuted},children:c("dataMergeBuilder.mode","Mode")}),e.jsx("span",{children:j?"Dry run":"Apply changes"}),A&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:p.textMuted},children:c("dataMergeBuilder.scheduled","Scheduled")}),e.jsx("span",{children:A.toLocaleString()})]})]})]}),t?.isProtected&&e.jsxs("div",{style:{padding:12,background:"var(--nice-warning-tint-15, #f59e0b20)",border:"1px solid var(--nice-warning, #f59e0b)",borderRadius:6,marginBottom:24,fontSize:12},children:[e.jsx(s.NiceIcon,{name:"warning",size:14})," Target environment is protected and may require approval."]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:E,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:c("dataMergeBuilder.cancel","Cancel")}),e.jsx("button",{onClick:q,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:j?e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"search",size:14})," ",c("dataMergeBuilder.runDryMerge","Run Dry Merge")]}):A?e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"calendar",size:14})," ",c("dataMergeBuilder.scheduleMerge","Schedule Merge")]}):e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"shuffle",size:14})," ",c("dataMergeBuilder.executeMerge","Execute Merge")]})})]})]})]})]})},Ce=Object.freeze(Object.defineProperty({__proto__:null,NiceDataMergeBuilder:pe},Symbol.toStringTag,{value:"Module"})),Me=[{id:"conflict-1",table:"customers",tableName:"Customers",recordId:"CUST-042",recordLabel:"Acme Corp",type:"concurrent-update",severity:"high",fields:[{field:"email",fieldLabel:"Email Address",dataType:"string",sourceValue:"new.contact@acme.com",targetValue:"old.contact@acme.com",baseValue:"original@acme.com"},{field:"phone",fieldLabel:"Phone Number",dataType:"string",sourceValue:"+1-555-NEW-0000",targetValue:"+1-555-OLD-0000",baseValue:"+1-555-000-0000"},{field:"credit_limit",fieldLabel:"Credit Limit",dataType:"number",sourceValue:75e3,targetValue:5e4,baseValue:25e3}],metadata:{sourceModifiedAt:new Date("2024-01-15T10:30:00"),sourceModifiedBy:"john.dev",targetModifiedAt:new Date("2024-01-15T14:45:00"),targetModifiedBy:"mary.sales"},suggestion:"keep-target",suggestionReason:"Target was modified more recently"},{id:"conflict-2",table:"products",tableName:"Products",recordId:"PRD-1337",recordLabel:"Widget Pro Max",type:"delete-update",severity:"critical",fields:[{field:"_deleted",fieldLabel:"Record Status",dataType:"boolean",sourceValue:!0,targetValue:!1},{field:"name",fieldLabel:"Product Name",dataType:"string",sourceValue:"[DELETED]",targetValue:"Widget Pro Max v2"}],suggestion:"keep-target",suggestionReason:"Record was updated in target, deletion may be accidental"},{id:"conflict-3",table:"config",tableName:"Configuration",recordId:"CFG-TAX-RATE",recordLabel:"Tax Rate Settings",type:"concurrent-update",severity:"medium",fields:[{field:"value",fieldLabel:"Value",dataType:"number",sourceValue:.21,targetValue:.22,baseValue:.2},{field:"effective_date",fieldLabel:"Effective Date",dataType:"date",sourceValue:"2024-02-01",targetValue:"2024-03-01"}],suggestion:"keep-source",suggestionReason:"Source has the newer effective date"}],te={"concurrent-update":{label:"Concurrent Update",icon:"zap",description:"Record was modified in both environments"},"delete-update":{label:"Delete vs Update",icon:"trash",description:"Record deleted in source but updated in target"},"update-delete":{label:"Update vs Delete",icon:"edit",description:"Record updated in source but deleted in target"},"constraint-violation":{label:"Constraint Violation",icon:"slash",description:"Change violates database constraints"},"unique-key-conflict":{label:"Unique Key Conflict",icon:"lock",description:"Duplicate unique key detected"},"foreign-key-missing":{label:"Missing FK Reference",icon:"link",description:"Referenced record does not exist"},"type-mismatch":{label:"Type Mismatch",icon:"warning",description:"Data type incompatibility"},"schema-change":{label:"Schema Change",icon:"clipboard",description:"Schema differs between environments"}},re={low:"var(--nice-color-success, #22c55e)",medium:"var(--nice-color-warning, #f59e0b)",high:"var(--nice-warning, #f97316)",critical:"var(--nice-color-error, #ef4444)"},xe=({conflicts:f=Me,sourceEnvironment:B="development",targetEnvironment:N="uat",showSuggestions:w=!0,allowCustomValues:R=!0,onResolve:E,onSkip:G,onCancel:W,className:Q,style:Y,"data-testid":c})=>{const{t:S}=s.useNiceTranslation(),[h,C]=x.useState(0),[b,g]=x.useState({}),[K,v]=x.useState({}),[$,M]=x.useState(null),[L,F]=x.useState(""),[O,k]=x.useState("single"),u=f[h],j=x.useMemo(()=>Object.keys(b).length,[b]),y=x.useMemo(()=>{if(!u)return!1;const n=K[u.id]||{};return u.fields.every(i=>n[i.field]?.resolution)},[u,K]),A=x.useCallback(n=>{if(K[n.id])return;const i={};n.fields.forEach(m=>{i[m.field]={resolution:"source",value:m.sourceValue}}),v(m=>({...m,[n.id]:i}))},[K]);x.useEffect(()=>{u&&A(u)},[u,A]);const _=(n,i,m)=>{if(!u)return;const V=u.fields.find(P=>P.field===n);if(!V)return;const q=i==="source"?V.sourceValue:i==="target"?V.targetValue:m;v(P=>({...P,[u.id]:{...P[u.id],[n]:{resolution:i,value:q}}}))},d=n=>{if(!u)return;const i={};u.fields.forEach(m=>{i[m.field]={resolution:n,value:n==="source"?m.sourceValue:m.targetValue}}),v(m=>({...m,[u.id]:i}))},D=()=>{if(!u||!y)return;const n={conflictId:u.id,strategy:"manual",fieldResolutions:K[u.id]};g(i=>({...i,[u.id]:n})),h<f.length-1&&C(h+1)},U=()=>{u&&(G?.(u.id),h<f.length-1&&C(h+1))},z=()=>{const n=Object.values(b);E?.(n)},r=(n,i)=>n===null?"null":n===void 0?"undefined":i==="date"?new Date(n).toLocaleDateString():i==="number"?Number(n).toLocaleString():typeof n=="boolean"?n?"true":"false":String(n),t={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)",source:T[B],target:T[N]};return f.length===0?e.jsxs("div",{className:`nice-data-conflict-resolver ${Q||""}`,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",padding:40,...Y},"data-testid":c,children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(s.NiceIcon,{name:"check",size:48})}),e.jsx("h3",{style:{margin:0},children:S("dataConflictResolver.noConflicts","No Conflicts")}),e.jsx("p",{style:{color:t.textMuted,marginTop:8},children:S("dataConflictResolver.allDataIsCompatibleFor","All data is compatible for merge.")})]}):e.jsxs("div",{className:`nice-data-conflict-resolver ${Q||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",...Y},"data-testid":c,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(s.NiceIcon,{name:"warning",size:16})," ",S("dataConflictResolver.resolveConflicts","Resolve Conflicts")]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{style:{fontSize:13,color:t.textMuted},children:["Resolved: ",e.jsx("strong",{style:{color:t.text},children:j})," /"," ",f.length]}),e.jsx("div",{style:{width:100,height:6,background:t.cardBg,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${j/f.length*100}%`,height:"100%",background:"var(--nice-color-success, #22c55e)",transition:"width 0.2s"}})})]}),e.jsxs("div",{style:{display:"flex",border:`1px solid ${t.border}`,borderRadius:6,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>k("single"),style:{padding:"6px 12px",border:"none",background:O==="single"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:S("dataConflictResolver.single","Single")}),e.jsx("button",{onClick:()=>k("list"),style:{padding:"6px 12px",border:"none",borderLeft:`1px solid ${t.border}`,background:O==="list"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:S("dataConflictResolver.list","List")})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[O==="single"&&u&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:20},children:[e.jsxs("button",{onClick:()=>C(Math.max(0,h-1)),disabled:h===0,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:h>0?"pointer":"not-allowed",opacity:h>0?1:.5,fontSize:12},children:[e.jsx(s.NiceIcon,{name:"arrow-left",size:14})," ",S("dataConflictResolver.previous","Previous")]}),e.jsx("span",{style:{fontSize:13,color:t.textMuted},children:S("dataConflictResolver.conflictOf","Conflict {current} of {total}").replace("{current}",String(h+1)).replace("{total}",String(f.length))}),e.jsxs("button",{onClick:()=>C(Math.min(f.length-1,h+1)),disabled:h===f.length-1,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:h<f.length-1?"pointer":"not-allowed",opacity:h<f.length-1?1:.5,fontSize:12},children:[S("dataConflictResolver.next","Next")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]}),b[u.id]&&e.jsxs("span",{style:{marginLeft:"auto",padding:"4px 8px",background:"color-mix(in srgb, var(--nice-color-success, #22c55e) 19%, transparent)",color:"var(--nice-color-success, #22c55e)",borderRadius:4,fontSize:11},children:[e.jsx(s.NiceIcon,{name:"check",size:14})," ",S("dataConflictResolver.resolved","Resolved")]})]}),e.jsxs("div",{style:{padding:16,background:t.cardBg,borderRadius:8,marginBottom:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:e.jsx(s.NiceIcon,{name:te[u.type].icon,size:24})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:600,fontSize:15},children:[u.tableName,":"," ",u.recordLabel??u.recordId]}),e.jsxs("div",{style:{fontSize:12,color:t.textMuted},children:[te[u.type].label," —"," ",te[u.type].description]})]}),e.jsx("div",{style:{padding:"4px 8px",background:re[u.severity]+"30",color:re[u.severity],borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase"},children:u.severity})]}),u.metadata&&e.jsxs("div",{style:{display:"flex",gap:24,marginTop:12,paddingTop:12,borderTop:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:[u.metadata.sourceModifiedAt&&e.jsxs("span",{children:["Source modified: ",u.metadata.sourceModifiedAt.toLocaleString()," ","by ",u.metadata.sourceModifiedBy]}),u.metadata.targetModifiedAt&&e.jsxs("span",{children:["Target modified: ",u.metadata.targetModifiedAt.toLocaleString()," ","by ",u.metadata.targetModifiedBy]})]}),w&&u.suggestion&&e.jsxs("div",{style:{marginTop:12,padding:12,background:"var(--nice-primary-tint-12, #3b82f620)",border:"1px solid var(--nice-primary, #3b82f6)",borderRadius:6,fontSize:12},children:[e.jsxs("strong",{children:[e.jsx(s.NiceIcon,{name:"lightbulb",size:14})," Suggestion:"]})," ",u.suggestionReason,e.jsx("button",{onClick:()=>d(u.suggestion==="keep-source"?"source":"target"),style:{marginLeft:12,padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:11},children:S("dataConflictResolver.apply","Apply")})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16},children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted,lineHeight:"28px"},children:"Apply to all fields:"}),e.jsxs("button",{onClick:()=>d("source"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.source}`,background:`${t.source}20`,color:t.text,cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[e.jsx(s.NiceIcon,{name:H[B],size:14})," ",S("dataConflictResolver.keepSource","Keep Source")]}),e.jsxs("button",{onClick:()=>d("target"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.target}`,background:`${t.target}20`,color:t.text,cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[e.jsx(s.NiceIcon,{name:H[N],size:14})," ",S("dataConflictResolver.keepTarget","Keep Target")]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:u.fields.map(n=>{const i=K[u.id]?.[n.field],m=$===`${u.id}-${n.field}`;return e.jsxs("div",{style:{background:t.cardBg,borderRadius:8,overflow:"hidden",border:`1px solid ${i?.resolution?"var(--nice-color-success, #22c55e)":t.border}`},children:[e.jsxs("div",{style:{padding:"10px 16px",background:i?.resolution?"var(--nice-success-tint-10, #22c55e10)":"transparent",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:i?.resolution?"var(--nice-color-success, #22c55e)":t.textMuted},children:e.jsx(s.NiceIcon,{name:i?.resolution?"check":"circle",size:14})}),e.jsx("span",{style:{fontWeight:500},children:n.fieldLabel}),e.jsxs("span",{style:{fontSize:11,color:t.textMuted},children:["(",n.field,")"]}),e.jsx("span",{style:{marginLeft:"auto",fontSize:10,padding:"2px 6px",background:t.bg,borderRadius:4,color:t.textMuted},children:n.dataType})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,background:t.border},children:[e.jsxs("div",{onClick:()=>_(n.field,"source"),style:{padding:16,background:i?.resolution==="source"?`${t.source}20`:t.bg,cursor:"pointer",border:i?.resolution==="source"?`2px solid ${t.source}`:"2px solid transparent"},children:[e.jsxs("div",{style:{fontSize:10,color:t.source,marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[e.jsx(s.NiceIcon,{name:H[B],size:14})," ",S("dataConflictResolver.source","Source"),i?.resolution==="source"&&e.jsx("span",{style:{marginLeft:4},children:e.jsx(s.NiceIcon,{name:"check",size:14})})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:r(n.sourceValue,n.dataType)})]}),e.jsxs("div",{onClick:()=>_(n.field,"target"),style:{padding:16,background:i?.resolution==="target"?`${t.target}20`:t.bg,cursor:"pointer",border:i?.resolution==="target"?`2px solid ${t.target}`:"2px solid transparent"},children:[e.jsxs("div",{style:{fontSize:10,color:t.target,marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[e.jsx(s.NiceIcon,{name:H[N],size:14})," ",S("dataConflictResolver.target","Target"),i?.resolution==="target"&&e.jsx("span",{style:{marginLeft:4},children:e.jsx(s.NiceIcon,{name:"check",size:14})})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:r(n.targetValue,n.dataType)})]})]}),R&&e.jsxs("div",{style:{padding:12,background:i?.resolution==="custom"?"var(--nice-accent-tint-12, #8b5cf620)":t.bg,borderTop:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"Custom value:"}),m?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:L,onChange:V=>F(V.target.value),style:{flex:1,padding:8,borderRadius:4,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontFamily:"monospace",fontSize:13},autoFocus:!0}),e.jsx("button",{onClick:()=>{_(n.field,"custom",L),M(null)},style:{padding:"6px 12px",borderRadius:4,border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12},children:S("dataConflictResolver.apply","Apply")}),e.jsx("button",{onClick:()=>M(null),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:S("dataConflictResolver.cancel","Cancel")})]}):e.jsx("button",{onClick:()=>{F(i?.resolution==="custom"?String(i.value):String(n.sourceValue)),M(`${u.id}-${n.field}`)},style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:i?.resolution==="custom"?"var(--nice-accent-tint-12, #8b5cf620)":"transparent",color:t.text,cursor:"pointer",fontSize:12},children:i?.resolution==="custom"?`Using: ${r(i.value,n.dataType)}`:"Enter custom..."})]})]},n.field)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:U,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:13},children:S("dataConflictResolver.skip","Skip")}),e.jsx("button",{onClick:D,disabled:!y,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:y?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:y?1:.5},children:h<f.length-1?e.jsxs(e.Fragment,{children:[S("dataConflictResolver.confirmAndNext","Confirm & Next")," ",e.jsx(s.NiceIcon,{name:"arrow-right",size:14})]}):S("dataConflictResolver.confirm","Confirm")})]})]}),O==="list"&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:f.map((n,i)=>{const m=!!b[n.id];return e.jsxs("div",{onClick:()=>{C(i),k("single")},style:{padding:16,background:t.cardBg,borderRadius:8,cursor:"pointer",border:`1px solid ${m?"var(--nice-color-success, #22c55e)":t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:e.jsx(s.NiceIcon,{name:m?"check":te[n.type].icon,size:14})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:500},children:[n.tableName,": ",n.recordLabel??n.recordId]}),e.jsxs("div",{style:{fontSize:11,color:t.textMuted},children:[n.fields.length," fields • ",te[n.type].label]})]}),e.jsx("div",{style:{padding:"4px 8px",background:re[n.severity]+"30",color:re[n.severity],borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase"},children:n.severity})]},n.id)})})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"space-between"},children:[e.jsx("button",{onClick:W,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:13},children:S("dataConflictResolver.cancel","Cancel")}),e.jsxs("button",{onClick:z,disabled:j===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:j>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:j>0?1:.5},children:["Finish (",j," resolved)"]})]})]})},we=Object.freeze(Object.defineProperty({__proto__:null,NiceDataConflictResolver:xe},Symbol.toStringTag,{value:"Module"})),Re=[{id:"snap-001",name:"Q1 Release Backup",description:"Backup before Q1 2024 release deployment",environment:"production",createdAt:new Date("2024-01-15T06:00:00"),createdBy:{id:"admin",name:"Admin"},size:{records:265770,bytes:2921e5},type:"manual",status:"ready",tags:["release","q1-2024"]},{id:"snap-002",name:"Daily Backup 2024-01-20",environment:"production",createdAt:new Date("2024-01-20T02:00:00"),createdBy:{id:"system",name:"System"},size:{records:267e3,bytes:2942e5},type:"scheduled",status:"ready",expiresAt:new Date("2024-02-20T02:00:00")},{id:"snap-003",name:"Pre-Merge: UAT to Prod",description:"Automatic backup before merge operation",environment:"production",createdAt:new Date("2024-01-22T10:30:00"),createdBy:{id:"system",name:"System"},size:{records:267500,bytes:295e6},type:"pre-merge",status:"locked",tags:["merge","automatic"]},{id:"snap-004",name:"Selected Tables Only",description:"Partial snapshot of CRM module",environment:"production",createdAt:new Date("2024-01-23T14:00:00"),createdBy:{id:"dev1",name:"John"},size:{records:15e3,bytes:185e5},type:"manual",status:"ready",tables:["customers","contacts","opportunities"],tags:["crm","partial"]},{id:"snap-005",name:"Failed Backup",environment:"production",createdAt:new Date("2024-01-24T02:00:00"),createdBy:{id:"system",name:"System"},size:{records:0,bytes:0},type:"scheduled",status:"failed"}],Ie=[{id:"sched-daily",name:"Daily Backup",cron:"0 2 * * *",enabled:!0,nextRun:new Date(Date.now()+480*60*1e3),lastRun:new Date(Date.now()-960*60*1e3),retainCount:7},{id:"sched-weekly",name:"Weekly Full Backup",cron:"0 4 * * 0",enabled:!0,nextRun:new Date(Date.now()+4320*60*1e3),lastRun:new Date(Date.now()-5760*60*1e3),retainCount:4},{id:"sched-monthly",name:"Monthly Archive",cron:"0 6 1 * *",enabled:!1,lastRun:new Date(Date.now()-360*60*60*1e3),retainCount:12}],Te={enabled:!0,maxCount:30,maxAgeDays:90,keepTagged:!0,keepLocked:!0},se=f=>{if(f===0)return"0 B";const B=1024,N=["B","KB","MB","GB","TB"],w=Math.floor(Math.log(f)/Math.log(B));return parseFloat((f/Math.pow(B,w)).toFixed(1))+" "+N[w]},oe=f=>{const N=new Date().getTime()-f.getTime(),w=Math.floor(N/(1e3*60*60)),R=Math.floor(w/24);return R>0?`${R} day${R>1?"s":""} ago`:w>0?`${w} hour${w>1?"s":""} ago`:"Just now"},Ne=f=>{const B=f.split(" ");if(B.length!==5)return f;const[N,w,R,E,G]=B;return R==="*"&&E==="*"&&G==="*"?`Daily at ${w.padStart(2,"0")}:${N.padStart(2,"0")}`:R==="*"&&E==="*"?`Weekly on ${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][parseInt(G)]} at ${w.padStart(2,"0")}:${N.padStart(2,"0")}`:E==="*"?`Monthly on day ${R} at ${w.padStart(2,"0")}:${N.padStart(2,"0")}`:f},De={creating:{icon:"clock",color:"var(--nice-color-warning, #f59e0b)",label:"Creating"},ready:{icon:"check",color:"var(--nice-color-success, #22c55e)",label:"Ready"},failed:{icon:"close",color:"var(--nice-color-error, #ef4444)",label:"Failed"},expired:{icon:"clock",color:"var(--nice-text-muted, #888)",label:"Expired"},locked:{icon:"lock",color:"var(--nice-color-primary, #3b82f6)",label:"Locked"}},$e={manual:{icon:"user",label:"Manual"},scheduled:{icon:"calendar",label:"Scheduled"},"pre-merge":{icon:"shuffle",label:"Pre-Merge"},"pre-restore":{icon:"reply",label:"Pre-Restore"}},ue=({environment:f="production",snapshots:B=Re,retentionPolicy:N=Te,schedules:w=Ie,onCreateSnapshot:R,onRestoreSnapshot:E,onDeleteSnapshot:G,onCompareSnapshots:W,onExportSnapshot:Q,onUpdateRetentionPolicy:Y,onUpdateSchedules:c,className:S,style:h,"data-testid":C})=>{const{t:b}=s.useNiceTranslation(),[g,K]=x.useState("snapshots"),[v,$]=x.useState(!1),[M,L]=x.useState([]),[F,O]=x.useState(""),[k,u]=x.useState(""),[j,y]=x.useState(N),[A,_]=x.useState(w),d=x.useMemo(()=>{const t=B.filter(i=>i.status==="ready").length,n=B.reduce((i,m)=>i+m.size.bytes,0);return{total:B.length,ready:t,totalSize:n}},[B]),D=()=>{R?.({name:F||`Snapshot ${new Date().toISOString()}`,description:k}),$(!1),O(""),u("")},U=()=>{M.length===2&&W?.(M[0],M[1])},z=t=>{const n=A.map(i=>i.id===t?{...i,enabled:!i.enabled}:i);_(n),c?.(n)},r={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)",env:T[f]};return e.jsxs("div",{className:`nice-data-snapshot ${S||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:r.bg,color:r.text,fontFamily:"system-ui, sans-serif",...h},"data-testid":C,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${r.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(s.NiceIcon,{name:"camera",size:16})," ",b("dataSnapshot.snapshots","Snapshots")]}),e.jsxs("div",{style:{padding:"4px 10px",background:r.env+"30",borderRadius:4,fontSize:12,display:"flex",alignItems:"center",gap:6},children:[e.jsx(s.NiceIcon,{name:H[f],size:14})," ",f.charAt(0).toUpperCase()+f.slice(1)]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:16,fontSize:12,color:r.textMuted},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:r.text},children:d.total})," snapshots"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:r.text},children:se(d.totalSize)})," total"]})]}),e.jsxs("button",{onClick:()=>$(!0),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,display:"flex",alignItems:"center",gap:6},children:[e.jsx(s.NiceIcon,{name:"camera",size:14})," ",b("dataSnapshot.createSnapshot","Create Snapshot")]})]}),e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${r.border}`,padding:"0 20px"},children:["snapshots","schedules","settings"].map(t=>e.jsxs("button",{onClick:()=>K(t),style:{padding:"12px 20px",border:"none",background:"transparent",color:g===t?r.text:r.textMuted,cursor:"pointer",fontSize:13,fontWeight:g===t?600:400,borderBottom:g===t?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",marginBottom:-1},children:[t==="snapshots"&&e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"folder",size:14})," ",b("dataSnapshot.snapshots","Snapshots")]}),t==="schedules"&&e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"calendar",size:14})," ",b("dataSnapshot.schedules","Schedules")]}),t==="settings"&&e.jsxs(e.Fragment,{children:[e.jsx(s.NiceIcon,{name:"settings",size:14})," ",b("dataSnapshot.settings","Settings")]})]},t))}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[g==="snapshots"&&e.jsxs("div",{children:[M.length>0&&e.jsxs("div",{style:{padding:12,background:r.cardBg,borderRadius:8,marginBottom:16,display:"flex",alignItems:"center",gap:12},children:[e.jsxs("span",{style:{fontSize:13},children:[M.length," selected"]}),M.length===2&&e.jsx("button",{onClick:U,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${r.border}`,background:"transparent",color:r.text,cursor:"pointer",fontSize:12},children:b("dataSnapshot.compare","Compare")}),e.jsx("button",{onClick:()=>L([]),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${r.border}`,background:"transparent",color:r.text,cursor:"pointer",fontSize:12,marginLeft:"auto"},children:b("dataSnapshot.clear","Clear")})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:B.map(t=>{const n=M.includes(t.id),i=De[t.status],m=$e[t.type];return e.jsx("div",{style:{padding:16,background:r.cardBg,borderRadius:8,border:`1px solid ${n?"var(--nice-color-primary, #3b82f6)":r.border}`},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("input",{type:"checkbox",checked:n,onChange:V=>{V.target.checked?L(q=>[...q,t.id]):L(q=>q.filter(P=>P!==t.id))},style:{marginTop:4}}),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:600},children:t.name}),e.jsxs("span",{style:{padding:"2px 6px",background:i.color+"20",color:i.color,borderRadius:4,fontSize:10},children:[e.jsx(s.NiceIcon,{name:i.icon,size:14})," ",i.label]}),e.jsxs("span",{style:{padding:"2px 6px",background:r.bg,color:r.textMuted,borderRadius:4,fontSize:10},children:[e.jsx(s.NiceIcon,{name:m.icon,size:14})," ",m.label]})]}),t.description&&e.jsx("div",{style:{fontSize:12,color:r.textMuted,marginBottom:8},children:t.description}),e.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,color:r.textMuted},children:[e.jsx("span",{children:oe(t.createdAt)}),e.jsxs("span",{children:["by ",t.createdBy.name]}),e.jsxs("span",{children:[t.size.records.toLocaleString()," records"]}),e.jsx("span",{children:se(t.size.bytes)}),t.tables&&e.jsxs("span",{children:[t.tables.length," tables"]}),t.expiresAt&&e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["Expires: ",t.expiresAt.toLocaleDateString()]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{style:{display:"flex",gap:6,marginTop:8},children:t.tags.map(V=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--nice-accent-tint-12, #8b5cf620)",color:"var(--nice-color-accent, #8b5cf6)",borderRadius:4,fontSize:10},children:["#",V]},V))})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[t.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>E?.(t.id),title:b("dataSnapshot.restore","Restore"),"aria-label":b("dataSnapshot.restore","Restore"),style:{padding:8,borderRadius:4,border:`1px solid ${r.border}`,background:"transparent",color:r.text,cursor:"pointer",fontSize:14},children:e.jsx(s.NiceIcon,{name:"reply",size:14})}),e.jsx("button",{onClick:()=>Q?.(t.id,"sql"),title:b("dataSnapshot.export","Export"),"aria-label":b("dataSnapshot.export","Export"),style:{padding:8,borderRadius:4,border:`1px solid ${r.border}`,background:"transparent",color:r.text,cursor:"pointer",fontSize:14},children:e.jsx(s.NiceIcon,{name:"upload",size:14})})]}),t.status!=="locked"&&e.jsx("button",{onClick:()=>G?.(t.id),title:b("dataSnapshot.delete","Delete"),"aria-label":b("dataSnapshot.delete","Delete"),style:{padding:8,borderRadius:4,border:`1px solid ${r.border}`,background:"transparent",color:"var(--nice-color-error, #ef4444)",cursor:"pointer",fontSize:14},children:e.jsx(s.NiceIcon,{name:"trash",size:14})})]})]})},t.id)})})]}),g==="schedules"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[A.map(t=>e.jsx("div",{style:{padding:16,background:r.cardBg,borderRadius:8,border:`1px solid ${r.border}`,opacity:t.enabled?1:.6},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("label",{className:"toggle",style:{display:"flex",alignItems:"center",cursor:"pointer"},children:e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>z(t.id),style:{width:16,height:16}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:t.name}),e.jsxs("div",{style:{fontSize:12,color:r.textMuted},children:[Ne(t.cron)," • Keep ",t.retainCount," snapshots"]})]}),e.jsxs("div",{style:{textAlign:"right",fontSize:11,color:r.textMuted},children:[t.enabled&&t.nextRun&&e.jsxs("div",{children:["Next: ",t.nextRun.toLocaleString()]}),t.lastRun&&e.jsxs("div",{children:["Last: ",oe(t.lastRun)]})]})]})},t.id)),e.jsx("button",{style:{padding:16,borderRadius:8,border:`1px dashed ${r.border}`,background:"transparent",color:r.textMuted,cursor:"pointer",fontSize:13},children:"+ Add Schedule"})]}),g==="settings"&&e.jsxs("div",{style:{maxWidth:500},children:[e.jsx("h4",{style:{marginTop:0},children:b("dataSnapshot.retentionPolicy","Retention Policy")}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j.enabled,onChange:t=>y({...j,enabled:t.target.checked})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:b("dataSnapshot.enableAutomaticCleanup","Enable automatic cleanup")}),e.jsx("div",{style:{fontSize:11,color:r.textMuted},children:b("dataSnapshot.automaticallyDeleteOldSnapshotsBased","Automatically delete old snapshots based on policy")})]})]}),j.enabled&&e.jsxs("div",{style:{padding:16,background:r.cardBg,borderRadius:8,display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:r.textMuted},children:b("dataSnapshot.maximumNumberOfSnapshots","Maximum number of snapshots")}),e.jsx("input",{type:"number",value:j.maxCount??"",onChange:t=>y({...j,maxCount:parseInt(t.target.value)||void 0}),placeholder:b("dataSnapshot.unlimited","Unlimited"),style:{padding:10,borderRadius:6,border:`1px solid ${r.border}`,background:r.bg,color:r.text,fontSize:13,width:150}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:r.textMuted},children:"Maximum age (days)"}),e.jsx("input",{type:"number",value:j.maxAgeDays??"",onChange:t=>y({...j,maxAgeDays:parseInt(t.target.value)||void 0}),placeholder:b("dataSnapshot.unlimited","Unlimited"),style:{padding:10,borderRadius:6,border:`1px solid ${r.border}`,background:r.bg,color:r.text,fontSize:13,width:150}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j.keepTagged??!1,onChange:t=>y({...j,keepTagged:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:b("dataSnapshot.keepTaggedSnapshots","Keep tagged snapshots")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j.keepLocked??!1,onChange:t=>y({...j,keepLocked:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:b("dataSnapshot.keepLockedSnapshots","Keep locked snapshots")})]})]}),e.jsx("button",{onClick:()=>Y?.(j),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,alignSelf:"flex-start"},children:b("dataSnapshot.savePolicy","Save Policy")})]})]})]}),v&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>$(!1),children:e.jsxs("div",{style:{background:r.cardBg,borderRadius:12,padding:24,width:400},onClick:t=>t.stopPropagation(),children:[e.jsxs("h4",{style:{margin:"0 0 16px"},children:[e.jsx(s.NiceIcon,{name:"camera",size:14})," ",b("dataSnapshot.createSnapshot","Create Snapshot")]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:r.textMuted},children:b("dataSnapshot.snapshotName","Snapshot Name")}),e.jsx("input",{type:"text",value:F,onChange:t=>O(t.target.value),placeholder:`Snapshot ${new Date().toISOString().split("T")[0]}`,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${r.border}`,background:r.bg,color:r.text,fontSize:13,boxSizing:"border-box"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:r.textMuted},children:"Description (optional)"}),e.jsx("textarea",{value:k,onChange:t=>u(t.target.value),placeholder:b("dataSnapshot.whatsThisSnapshotFor","What's this snapshot for?"),rows:3,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${r.border}`,background:r.bg,color:r.text,fontSize:13,resize:"vertical",boxSizing:"border-box"}})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>$(!1),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${r.border}`,background:"transparent",color:r.text,cursor:"pointer",fontSize:13},children:b("dataSnapshot.cancel","Cancel")}),e.jsx("button",{onClick:D,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:b("dataSnapshot.create","Create")})]})]})})]})},Ae=Object.freeze(Object.defineProperty({__proto__:null,NiceDataSnapshot:ue},Symbol.toStringTag,{value:"Module"}));exports.NiceDataBranchGraph=ce;exports.NiceDataBranchGraph$1=ke;exports.NiceDataBranchManager=de;exports.NiceDataBranchManager$1=be;exports.NiceDataConflictResolver=xe;exports.NiceDataConflictResolver$1=we;exports.NiceDataDiffViewer=le;exports.NiceDataDiffViewer$1=je;exports.NiceDataMergeBuilder=pe;exports.NiceDataMergeBuilder$1=Ce;exports.NiceDataSnapshot=ue;exports.NiceDataSnapshot$1=Ae;
|