ezux 1.1.11 → 1.1.13
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/dist/{EzContextMenu-C3eDRS7E.cjs → EzContextMenu-B6HBUjWv.cjs} +1 -1
- package/dist/{EzContextMenu-BsHdOgtL.js → EzContextMenu-BSA_B6Pr.js} +1 -1
- package/dist/{EzEventModal-FP2rs1pp.js → EzEventModal-BUMp_BFi.js} +6 -6
- package/dist/{EzEventModal-DkowH9rh.cjs → EzEventModal-xzHfzi0O.cjs} +1 -1
- package/dist/{EzGroupingPanel-DuKrZuqq.js → EzGroupingPanel-BUsIYDRi.js} +5 -5
- package/dist/EzGroupingPanel-D0HdSomF.cjs +1 -0
- package/dist/{EzSchedulerQuickAdd-s2jtG8vH.js → EzSchedulerQuickAdd-C653LTGh.js} +5 -5
- package/dist/{EzSchedulerQuickAdd-BLF22CDh.cjs → EzSchedulerQuickAdd-UnOWCpJd.cjs} +1 -1
- package/dist/{EzSchedulerToolbar-CaVVmnjt.cjs → EzSchedulerToolbar-C-5OdRY6.cjs} +1 -1
- package/dist/{EzSchedulerToolbar-tz6h80GC.js → EzSchedulerToolbar-CO5jjDQg.js} +15 -15
- package/dist/{EzSignature-CPoQLAyS.cjs → EzSignature-BaNesxwC.cjs} +1 -1
- package/dist/{EzSignature-D7134EQo.js → EzSignature-D4EYwo9W.js} +2 -2
- package/dist/{EzTableEditDialog-3eU6i9cv.js → EzTableEditDialog-Cd948V1C.js} +3 -3
- package/dist/{EzTableEditDialog-ftpeOKI_.cjs → EzTableEditDialog-NiOubaMT.cjs} +1 -1
- package/dist/{EzTableFooter-BiyI1m1O.cjs → EzTableFooter-CWjfGCjL.cjs} +1 -1
- package/dist/{EzTableFooter-DuAaOcLd.js → EzTableFooter-DveD12RC.js} +1 -1
- package/dist/{EzTableToolbar-DmAb94U-.js → EzTableToolbar-Bz8UWv6j.js} +50 -54
- package/dist/EzTableToolbar-DHE7Bb1R.cjs +1 -0
- package/dist/{HighlightText-C0sUEoCH.js → HighlightText-8D6KEyBw.js} +9 -11
- package/dist/HighlightText-LtZmzCle.cjs +1 -0
- package/dist/{NotificationPanel-xjIHKnlE.js → NotificationPanel-D2Y-_ahk.js} +3 -3
- package/dist/NotificationPanel-zLxrtTGf.cjs +1 -0
- package/dist/{TooltipWrapper-Bv7F-Gk4.js → TooltipWrapper-BrRTi5EJ.js} +1 -1
- package/dist/{TooltipWrapper-CgYlx0Jq.cjs → TooltipWrapper-DWts4bAI.cjs} +1 -1
- package/dist/{avatar-BkA_3sri.js → avatar-BeK0E4mn.js} +1 -1
- package/dist/{avatar-CJH7L2Or.cjs → avatar-DZAaTK2f.cjs} +1 -1
- package/dist/bell-DAz8P0BR.js +14 -0
- package/dist/bell-DOX2y38e.cjs +1 -0
- package/dist/{calendar-ChRJyGvt.cjs → calendar-BMZ8ddOf.cjs} +1 -1
- package/dist/{calendar-CCxXqG5a.js → calendar-Dy3rVMW2.js} +4 -4
- package/dist/{checkbox-_Uxyw6xN.cjs → checkbox-B0lGHUyy.cjs} +1 -1
- package/dist/{checkbox-DTLp-Oqj.js → checkbox-boJRxICT.js} +1 -1
- package/dist/circle-x-Cv7bfIC_.js +9 -0
- package/dist/circle-x-DwVXxhXr.cjs +1 -0
- package/dist/{date-time-picker-BPwpIWxg.cjs → date-time-picker-DTxHdPgQ.cjs} +1 -1
- package/dist/{date-time-picker-B9QBboUX.js → date-time-picker-Dj2eftJI.js} +6 -6
- package/dist/ezux.css +1 -1
- package/dist/grip-vertical-CSyDKBul.js +12 -0
- package/dist/grip-vertical-DZNBW1Dn.cjs +1 -0
- package/dist/{index-BmjgUrNF.cjs → index-B3ipEEhH.cjs} +2 -2
- package/dist/index-BPPb7bcs.js +3220 -0
- package/dist/{index-pr_yrvsV.js → index-BQKw_Vho.js} +4026 -1904
- package/dist/{index-B7foCkRR.js → index-C5STgBSy.js} +678 -677
- package/dist/{index-CpEN0z3t.js → index-C6NfgycP.js} +357 -357
- package/dist/index-D4f2ZdrG.cjs +2 -0
- package/dist/index-DUY1SqMo.cjs +1 -0
- package/dist/index-c1Zg--dt.cjs +7 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +67 -14
- package/dist/index.es.js +136 -135
- package/dist/{input-D1zXv4Kl.cjs → input-BgM_la4k.cjs} +1 -1
- package/dist/{input-DG8ycH6m.js → input-jYQ5VKNR.js} +1 -1
- package/dist/{isBefore-DdLSsf0_.js → isBefore-C3Y_wbk3.js} +1 -1
- package/dist/{isBefore-BAixcVtb.cjs → isBefore-Cp1ttk6q.cjs} +1 -1
- package/dist/kanban.cjs +1 -1
- package/dist/kanban.es.js +4 -4
- package/dist/{label-Ch1wkGGP.js → label-ClOW9UCt.js} +2 -2
- package/dist/{label-DrUloKDN.cjs → label-Dx6oDB-X.cjs} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +29 -1
- package/dist/layout.es.js +3 -3
- package/dist/{popover-4Ng-GmwM.cjs → popover-BJq1CKmi.cjs} +1 -1
- package/dist/{popover-DstiJFa3.js → popover-Cmlb7w3R.js} +1 -1
- package/dist/scheduler.cjs +1 -1
- package/dist/scheduler.es.js +5 -5
- package/dist/{scroll-area-mGPAChYm.js → scroll-area-9fwpVNxT.js} +1 -1
- package/dist/{scroll-area-B_yufXtG.cjs → scroll-area-CwwZSSA4.cjs} +1 -1
- package/dist/select-GxA46anr.cjs +1 -0
- package/dist/select-mDCun_IR.js +35 -0
- package/dist/{settings-HCrwja-A.js → settings-CvyjK75A.js} +14 -14
- package/dist/settings-DKPknrt8.cjs +1 -0
- package/dist/signature.cjs +1 -1
- package/dist/signature.es.js +1 -1
- package/dist/{sortable.esm-DDmDbyCC.cjs → sortable.esm-CsRPuXyD.cjs} +1 -1
- package/dist/{sortable.esm-eBjUK76c.js → sortable.esm-CzMCDPet.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +18 -0
- package/dist/table.es.js +10 -9
- package/dist/theme-vars.css +2 -2
- package/dist/{tooltip-CDLAzCi8.cjs → tooltip-B41iztKT.cjs} +1 -1
- package/dist/{tooltip-C216fkmP.js → tooltip-BCtrEe0z.js} +1 -1
- package/dist/treeview.cjs +1 -2
- package/dist/treeview.es.js +558 -543
- package/dist/{useInitCoreServices-DSudhSFo.cjs → useInitCoreServices-CwXv2p4S.cjs} +1 -1
- package/dist/{useInitCoreServices-BC7QMeLn.js → useInitCoreServices-D1WaWlaI.js} +4 -3
- package/dist/{useService-DBnjCLOu.cjs → useService-8OoezWr8.cjs} +1 -1
- package/dist/{useService-BKWyN7jJ.js → useService-BUi3uAqE.js} +1 -1
- package/dist/{useServiceState-MlrHzngO.cjs → useServiceState-BjpCjUn2.cjs} +1 -1
- package/dist/{useServiceState-DWb3cncq.js → useServiceState-VE-viK8b.js} +1 -1
- package/package.json +21 -20
- package/dist/EzGroupingPanel-Dw4bbefz.cjs +0 -1
- package/dist/EzTableToolbar-qlNVxvsL.cjs +0 -1
- package/dist/HighlightText-BDclEh_K.cjs +0 -1
- package/dist/NotificationPanel-juBrjjOY.cjs +0 -1
- package/dist/index-BKsqtcvu.cjs +0 -2
- package/dist/index-D2HX-sbl.js +0 -3092
- package/dist/index-DEIRrhVY.cjs +0 -1
- package/dist/index-DGhcUfqi.cjs +0 -7
- package/dist/info-BY2cfl1l.cjs +0 -1
- package/dist/info-BuURqzhx.js +0 -14
- package/dist/select-BxcAKVaB.cjs +0 -1
- package/dist/select-BxiFqo8j.js +0 -35
- package/dist/settings-BuS8Pqjb.cjs +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),y=require("react"),X=require("./TooltipWrapper-DWts4bAI.cjs"),q=require("./EzErrorBoundary-CEdz_hDo.cjs"),V=require("./tooltip-B41iztKT.cjs"),Le=require("./NotificationPanel-zLxrtTGf.cjs"),ye=require("@tanstack/react-store"),dt=require("@tanstack/store"),z=require("./useInitCoreServices-CwXv2p4S.cjs"),ut=require("./useServiceState-BjpCjUn2.cjs"),te=require("./index-B3ipEEhH.cjs"),we=require("./input-BgM_la4k.cjs"),K=require("./select-GxA46anr.cjs"),he=require("./popover-BJq1CKmi.cjs"),re=require("./checkbox-B0lGHUyy.cjs"),oe=require("./label-Dx6oDB-X.cjs"),mt=require("./scroll-area-CwwZSSA4.cjs"),ht=require("./layers-xSPd-hz3.cjs"),$e=require("./download-0ZhO2XaW.cjs"),xt=require("@tanstack/react-form"),be=require("./date-time-picker-DTxHdPgQ.cjs"),xe=require("./avatar-DZAaTK2f.cjs"),We=require("./calendar-BMZ8ddOf.cjs"),ce=require("./EzContextMenu-B6HBUjWv.cjs"),ge=require("./sortable.esm-CsRPuXyD.cjs"),Ae=require("./settings-DKPknrt8.cjs"),De=require("./circle-x-DwVXxhXr.cjs"),gt=require("./circle-alert-77QqFR-z.cjs"),pt=require("./isBefore-Cp1ttk6q.cjs"),ft=require("@tanstack/react-virtual"),qe=require("./ellipsis-CzlqJf-i.cjs"),Je=require("./chevron-down-DZVL7VHW.cjs");function Ct(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const se=Ct(y);const vt=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],yt=q.createLucideIcon("activity",vt);const jt=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],wt=q.createLucideIcon("archive",jt);const bt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],je=q.createLucideIcon("circle-check",bt);const Nt=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],St=q.createLucideIcon("circle-play",Nt);const kt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ke=q.createLucideIcon("circle-question-mark",kt);const Dt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],It=q.createLucideIcon("circle-stop",Dt);const Bt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Pe=q.createLucideIcon("file-text",Bt);const At=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Tt=q.createLucideIcon("image",At);const Mt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Ft=q.createLucideIcon("list",Mt);const _t=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],Et=q.createLucideIcon("lock-open",_t);const Vt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Oe=q.createLucideIcon("lock",Vt);const zt=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Rt=q.createLucideIcon("message-square",zt);const Lt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Qe=q.createLucideIcon("panels-top-left",Lt);const $t=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],qt=q.createLucideIcon("pen",$t);const Kt=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],Pt=q.createLucideIcon("redo-2",Kt);const Ot=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Qt=q.createLucideIcon("refresh-ccw",Ot);const Ut=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Ht=q.createLucideIcon("shield-alert",Ut);const Wt=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Jt=q.createLucideIcon("square-check-big",Wt);const Xt=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Gt=q.createLucideIcon("undo-2",Xt);const Yt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Zt=q.createLucideIcon("users",Yt),pe=()=>z.useI18nService(),es=()=>e.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md",children:[e.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-destructive/10",children:e.jsx(q.TriangleAlert,{className:"w-8 h-8 text-destructive"})}),e.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Kanban Board Error"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"An error occurred while rendering the Kanban board. Please refresh the page or contact support if the issue persists."})]}),e.jsx(V.Button,{onClick:()=>window.location.reload(),children:"Reload Board"})]})}),ts=(t,s="standard")=>new dt.Store({board:t,selectedCards:[],selectedColumnId:null,view:s,searchQuery:"",activeFilters:{},history:[t],historyIndex:0}),ss=t=>({setBoard:s=>{t.setState(n=>{const r=[...n.history.slice(0,n.historyIndex+1),s];return{...n,board:s,history:r,historyIndex:r.length-1}})},addCard:s=>{t.setState(n=>{const r={...n.board,cards:[...n.board.cards,s]},c=[...n.history.slice(0,n.historyIndex+1),r];return{...n,board:r,history:c,historyIndex:c.length-1}})},updateCard:(s,n)=>{t.setState(r=>{const c={...r.board,cards:r.board.cards.map(C=>C.id===s?{...C,...n}:C)},d=[...r.history.slice(0,r.historyIndex+1),c];return{...r,board:c,history:d,historyIndex:d.length-1}})},deleteCard:s=>{t.setState(n=>{const r={...n.board,cards:n.board.cards.filter(d=>d.id!==s)},c=[...n.history.slice(0,n.historyIndex+1),r];return{...n,board:r,history:c,historyIndex:c.length-1}})},moveCard:(s,n)=>{t.setState(r=>{const c={...r.board,cards:r.board.cards.map(C=>C.id===s?{...C,columnId:n}:C)},d=[...r.history.slice(0,r.historyIndex+1),c];return{...r,board:c,history:d,historyIndex:d.length-1}})},addColumn:s=>{t.setState(n=>{const r={...n.board,columns:[...n.board.columns,s]},c=[...n.history.slice(0,n.historyIndex+1),r];return{...n,board:r,history:c,historyIndex:c.length-1}})},updateColumn:(s,n)=>{t.setState(r=>{const c={...r.board,columns:r.board.columns.map(C=>C.id===s?{...C,...n}:C)},d=[...r.history.slice(0,r.historyIndex+1),c];return{...r,board:c,history:d,historyIndex:d.length-1}})},deleteColumn:s=>{t.setState(n=>{const r={...n.board,columns:n.board.columns.filter(d=>d.id!==s),cards:n.board.cards.filter(d=>d.columnId!==s)},c=[...n.history.slice(0,n.historyIndex+1),r];return{...n,board:r,history:c,historyIndex:c.length-1}})},setSelectedCards:s=>{t.setState(n=>({...n,selectedCards:s}))},setSelectedColumnId:s=>{t.setState(n=>({...n,selectedColumnId:s}))},setView:s=>{t.setState(n=>({...n,view:s}))},setSearchQuery:s=>{t.setState(n=>({...n,searchQuery:s}))},setActiveFilters:s=>{t.setState(n=>({...n,activeFilters:s}))},undo:()=>{t.setState(s=>s.historyIndex>0?{...s,board:s.history[s.historyIndex-1],historyIndex:s.historyIndex-1}:s)},redo:()=>{t.setState(s=>s.historyIndex<s.history.length-1?{...s,board:s.history[s.historyIndex+1],historyIndex:s.historyIndex+1}:s)},canUndo:()=>t.state.historyIndex>0,canRedo:()=>t.state.historyIndex<t.state.history.length-1}),ns=t=>{const s=y.useMemo(()=>ts(t.board,t.view),[t.board.id,t.view]),n=y.useMemo(()=>ss(s),[s]),r=ye.useStore(s,f=>f.board),c=ye.useStore(s,f=>f.selectedCards),d=ye.useStore(s,f=>f.selectedColumnId),C=ye.useStore(s,f=>f.view),m=ye.useStore(s,f=>f.searchQuery),g=ye.useStore(s,f=>f.activeFilters),S=y.useRef(JSON.stringify(t.board)),j=y.useRef(t.view);return y.useEffect(()=>{const f=JSON.stringify(t.board);f!==S.current&&(S.current=f,n.setBoard(t.board)),t.view&&t.view!==j.current&&(j.current=t.view,n.setView(t.view))},[t.board,t.view,n]),{board:r,selectedCards:c,selectedColumnId:d,view:C,searchQuery:m,activeFilters:g,setBoard:n.setBoard,setSelectedCards:n.setSelectedCards,setSelectedColumnId:n.setSelectedColumnId,setView:n.setView,setSearchQuery:n.setSearchQuery,setActiveFilters:n.setActiveFilters,addCard:n.addCard,updateCard:n.updateCard,deleteCard:n.deleteCard,moveCard:n.moveCard,addColumn:n.addColumn,updateColumn:n.updateColumn,deleteColumn:n.deleteColumn,undo:n.undo,redo:n.redo,canUndo:n.canUndo(),canRedo:n.canRedo(),store:s,actions:n}},as=(t,s)=>{const n=z.useEzServiceRegistry(),r=X.useQueryClient(),c=()=>n.get("KanbanService"),d=(a,l,u=3e3)=>{const p=n.get("NotificationService");p&&p.add({type:a,message:l,duration:u})},C=a=>{r.setQueryData(["board",s.id],a),t.onBoardChange?.(a)},m=X.useMutation({mutationFn:async a=>{const l=c();return l?await l.createCard(s.id,a):await t.onCardCreate?.(a),a},onMutate:async a=>{await r.cancelQueries({queryKey:["board",s.id]});const l=r.getQueryData(["board",s.id]),u={...s,cards:[...s.cards,a]};return C(u),{previousBoard:l}},onError:(a,l,u)=>{u?.previousBoard&&C(u.previousBoard),d("error","Failed to create card. Please try again.",5e3)},onSuccess:a=>{d("success",`Card "${a.title}" created successfully`)}}),g=y.useCallback(async a=>{const l={id:`card-${Date.now()}`,type:a.type||"standard",title:a.title||"New Card",description:a.description,columnId:a.columnId||s.columns[0]?.id||"",position:a.position??s.cards.filter(u=>u.columnId===a.columnId).length,assignees:a.assignees||[],tags:a.tags||[],priority:a.priority,metadata:a.metadata||{},createdBy:"current-user",createdAt:new Date,updatedBy:"current-user",updatedAt:new Date,...a};return m.mutateAsync(l)},[s,m]),S=X.useMutation({mutationFn:async({cardId:a,updates:l})=>{const u=c();if(u)await u.updateCard(a,l);else{const p=s.cards.find(D=>D.id===a);p&&await t.onCardUpdate?.({...p,...l},"edit")}return{cardId:a,updates:l}},onMutate:async({cardId:a,updates:l})=>{await r.cancelQueries({queryKey:["board",s.id]});const u=r.getQueryData(["board",s.id]),p=s.cards.map(F=>F.id===a?{...F,...l,updatedAt:new Date}:F),D={...s,cards:p};return C(D),{previousBoard:u}},onError:(a,l,u)=>{u?.previousBoard&&C(u.previousBoard),d("error","Failed to update card",5e3)},onSuccess:()=>{d("success","Card updated successfully",2e3)}}),j=y.useCallback(async(a,l)=>S.mutateAsync({cardId:a,updates:l}),[S]),f=X.useMutation({mutationFn:async a=>{const l=c();return l?await l.deleteCard(a):await t.onCardDelete?.(a),a},onMutate:async a=>{await r.cancelQueries({queryKey:["board",s.id]});const l=r.getQueryData(["board",s.id]),u={...s,cards:s.cards.filter(p=>p.id!==a)};return C(u),{previousBoard:l,deletedCardTitle:l?.cards.find(p=>p.id===a)?.title}},onError:(a,l,u)=>{u?.previousBoard&&C(u.previousBoard),d("error","Failed to delete card",5e3)},onSuccess:(a,l,u)=>{const p=u?.deletedCardTitle||"Card";d("success",`Card "${p}" deleted`)}}),I=y.useCallback(async a=>f.mutateAsync(a),[f]),o=X.useMutation({mutationFn:async a=>{const{cardId:l,targetColumnId:u,targetSwimlaneId:p,targetPosition:D}=a,F=c();if(F)await F.moveCard(l,u,p,D);else{const M=s.cards.find(T=>T.id===l);M&&await t.onCardUpdate?.({...M,columnId:u,swimlaneId:p},"move")}},onMutate:async({cardId:a,targetColumnId:l,targetSwimlaneId:u,targetPosition:p})=>{await r.cancelQueries({queryKey:["board",s.id]});const D=r.getQueryData(["board",s.id]),F=s.cards.find(b=>b.id===a);if(!F)return{previousBoard:D};const M=s.cards.filter(b=>b.id!==a),T=M.filter(b=>b.columnId===l).sort((b,B)=>(b.position??0)-(B.position??0)),N=p!==void 0?Math.min(p,T.length):T.length,_=[...T.slice(0,N),{...F,columnId:l,swimlaneId:u,updatedAt:new Date},...T.slice(N)].map((b,B)=>({...b,position:B})),U=F.columnId,W=M.filter(b=>b.columnId===U).sort((b,B)=>(b.position??0)-(B.position??0)).map((b,B)=>({...b,position:B})),E=[...M.filter(b=>b.columnId!==l&&b.columnId!==U),...W,..._],H={...s,cards:E};return C(H),{previousBoard:D}},onError:(a,l,u)=>{u?.previousBoard&&C(u.previousBoard),d("error","Failed to move card",3e3)}}),v=y.useCallback(async(a,l,u,p)=>o.mutateAsync({cardId:a,targetColumnId:l,targetSwimlaneId:u,targetPosition:p}),[o]),w=y.useCallback(async a=>{const l=s.cards.find(p=>p.id===a);if(!l)throw new Error("Card not found");const u={...l,id:`card-${Date.now()}`,title:`${l.title} (Copy)`,position:(l.position??0)+1,createdAt:new Date,updatedAt:new Date};return g(u)},[s.cards,g]),k=y.useCallback(async a=>j(a,{isArchived:!0}),[j]),i=y.useCallback(async a=>j(a,{isArchived:!1}),[j]);return{createCard:g,updateCard:j,deleteCard:I,moveCard:v,duplicateCard:w,archiveCard:k,restoreCard:i}},rs=(t,s)=>{const n=z.useEzServiceRegistry(),r=X.useQueryClient(),c=()=>n.get("KanbanService"),d=(i,a,l=3e3)=>{const u=n.get("NotificationService");u&&u.add({type:i,message:a,duration:l})},C=i=>{r.setQueryData(["board",s.id],i),t.onBoardChange?.(i)},m=X.useMutation({mutationFn:async i=>{const a=c();return a?await a.createColumn(s.id,i):await t.onColumnCreate?.(i),i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l={...s,columns:[...s.columns,i]};return C(l),{previousBoard:a}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to create column",5e3)},onSuccess:i=>{d("success",`Column "${i.name}" added`)}}),g=y.useCallback(async i=>{const a={id:`column-${Date.now()}`,name:i.name||"New Column",color:i.color,icon:i.icon,wipLimit:i.wipLimit,position:i.position??s.columns.length,isCollapsed:!1,...i};return m.mutateAsync(a)},[s.columns.length,m]),S=X.useMutation({mutationFn:async({columnId:i,updates:a})=>{const l=c();if(l)await l.updateColumn(i,a);else{const u=s.columns.find(p=>p.id===i);u&&await t.onColumnUpdate?.({...u,...a})}return{columnId:i,updates:a}},onMutate:async({columnId:i,updates:a})=>{await r.cancelQueries({queryKey:["board",s.id]});const l=r.getQueryData(["board",s.id]),u={...s,columns:s.columns.map(p=>p.id===i?{...p,...a}:p)};return C(u),{previousBoard:l}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to update column",5e3)}}),j=y.useCallback(async(i,a)=>S.mutateAsync({columnId:i,updates:a}),[S]),f=X.useMutation({mutationFn:async i=>{const a=c();return a?await a.deleteColumn(i):await t.onColumnDelete?.(i),i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l=a?.columns.find(p=>p.id===i),u={...s,columns:s.columns.filter(p=>p.id!==i),cards:s.cards.filter(p=>p.columnId!==i)};return C(u),{previousBoard:a,deletedColumnName:l?.name}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to delete column",5e3)},onSuccess:(i,a,l)=>{const u=l?.deletedColumnName||"Column";d("success",`Column "${u}" deleted`)}}),I=y.useCallback(async i=>f.mutateAsync(i),[f]),o=X.useMutation({mutationFn:async i=>{const a=c();if(a){const l=i.map((u,p)=>a.updateColumn(u,{position:p}));await Promise.all(l)}return i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l={...s,columns:i.map((u,p)=>{const D=s.columns.find(F=>F.id===u);if(!D)throw new Error(`Column ${u} not found`);return{...D,position:p}})};return C(l),{previousBoard:a}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to reorder columns",3e3)}}),v=y.useCallback(async i=>o.mutateAsync(i),[o]),w=y.useCallback(i=>{j(i,{isCollapsed:!0})},[j]),k=y.useCallback(i=>{j(i,{isCollapsed:!1})},[j]);return{createColumn:g,updateColumn:j,deleteColumn:I,reorderColumns:v,collapseColumn:w,expandColumn:k}},is=(t,s)=>{const n=z.useEzServiceRegistry(),r=X.useQueryClient(),c=()=>n.get("KanbanService"),d=(i,a,l=3e3)=>{const u=n.get("NotificationService");u&&u.add({type:i,message:a,duration:l})},C=i=>{r.setQueryData(["board",s.id],i),t.onBoardChange?.(i)},m=X.useMutation({mutationFn:async i=>{const a=c();return a?await a.createSwimlane(s.id,i):await t.onSwimlaneCreate?.(i),i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l={...s,swimlanes:[...s.swimlanes||[],i]};return C(l),{previousBoard:a}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to create swimlane",5e3)},onSuccess:i=>{d("success",`Swimlane "${i.name}" added`)}}),g=y.useCallback(async i=>{const a={id:`swimlane-${Date.now()}`,name:i.name||"New Swimlane",type:i.type||"custom",color:i.color,position:i.position??(s.swimlanes?.length||0),isCollapsed:!1,...i};return m.mutateAsync(a)},[s.swimlanes,m]),S=X.useMutation({mutationFn:async({swimlaneId:i,updates:a})=>{const l=c();if(l)await l.updateSwimlane(i,a);else{const u=s.swimlanes?.find(p=>p.id===i);u&&await t.onSwimlaneUpdate?.({...u,...a})}return{swimlaneId:i,updates:a}},onMutate:async({swimlaneId:i,updates:a})=>{await r.cancelQueries({queryKey:["board",s.id]});const l=r.getQueryData(["board",s.id]),u={...s,swimlanes:(s.swimlanes||[]).map(p=>p.id===i?{...p,...a}:p)};return C(u),{previousBoard:l}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to update swimlane",5e3)}}),j=y.useCallback(async(i,a)=>S.mutateAsync({swimlaneId:i,updates:a}),[S]),f=X.useMutation({mutationFn:async i=>{const a=c();return a?await a.deleteSwimlane(i):await t.onSwimlaneDelete?.(i),i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l=a?.swimlanes?.find(p=>p.id===i),u={...s,swimlanes:(s.swimlanes||[]).filter(p=>p.id!==i),cards:s.cards.map(p=>p.swimlaneId===i?{...p,swimlaneId:void 0}:p)};return C(u),{previousBoard:a,deletedSwimlaneName:l?.name}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to delete swimlane",5e3)},onSuccess:(i,a,l)=>{const u=l?.deletedSwimlaneName||"Swimlane";d("success",`Swimlane "${u}" deleted`)}}),I=y.useCallback(async i=>f.mutateAsync(i),[f]),o=X.useMutation({mutationFn:async i=>{const a=c();if(a){const l=i.map((u,p)=>a.updateSwimlane(u,{position:p}));await Promise.all(l)}return i},onMutate:async i=>{await r.cancelQueries({queryKey:["board",s.id]});const a=r.getQueryData(["board",s.id]),l={...s,swimlanes:i.map((u,p)=>{const D=s.swimlanes?.find(F=>F.id===u);return D?{...D,position:p}:null}).filter(Boolean)};return C(l),{previousBoard:a}},onError:(i,a,l)=>{l?.previousBoard&&C(l.previousBoard),d("error","Failed to reorder swimlanes",3e3)}}),v=y.useCallback(async i=>o.mutateAsync(i),[o]),w=y.useCallback(i=>{j(i,{isCollapsed:!0}),t.onSwimlaneToggle?.({swimlaneId:i,isCollapsed:!0})},[j,t.onSwimlaneToggle]),k=y.useCallback(i=>{j(i,{isCollapsed:!1}),t.onSwimlaneToggle?.({swimlaneId:i,isCollapsed:!1})},[j,t.onSwimlaneToggle]);return{createSwimlane:g,updateSwimlane:j,deleteSwimlane:I,reorderSwimlanes:v,collapseSwimlane:w,expandSwimlane:k}},ls=t=>{const[s,n]=y.useState(""),[r,c]=y.useState({});return{filteredCards:y.useMemo(()=>t.cards.filter(m=>{if(s){const g=s.toLowerCase();if(!(m.title.toLowerCase().includes(g)||m.description?.toLowerCase().includes(g)||m.tags.some(j=>j.name.toLowerCase().includes(g))))return!1}return!(r.tags&&r.tags.length>0&&!m.tags.some(S=>r.tags?.includes(S.id))||r.assignees&&r.assignees.length>0&&!m.assignees.some(S=>r.assignees?.includes(S.id))||r.priority&&r.priority.length>0&&m.priority&&!r.priority.includes(m.priority)||r.columns&&r.columns.length>0&&!r.columns.includes(m.columnId))}),[t.cards,s,r]),searchQuery:s,setSearchQuery:n,activeFilters:r,setActiveFilters:c,clearFilters:()=>{n(""),c({})}}},os=(t,s,n=!1,r)=>{const c=z.useEzServiceRegistry(),[d,C]=y.useState(null),[m,g]=y.useState(null),[S,j]=y.useState(null),f=y.useCallback(w=>{if(r?.onCardDragStart){const k={card:w,columnId:w.columnId,cancel:!1};if(r.onCardDragStart(k),k.cancel)return}C(w)},[r?.onCardDragStart]),I=y.useCallback((w,k)=>{d&&m!==w&&(m&&r?.onCardDragLeave&&r.onCardDragLeave({card:d,targetColumnId:m}),r?.onCardDragEnter&&r.onCardDragEnter({card:d,targetColumnId:w})),g(w),k&&j(k)},[d,r,m]),o=y.useCallback(()=>{d&&r?.onCardDragStop&&r.onCardDragStop({card:d,columnId:d.columnId}),C(null),g(null),j(null)},[d,r?.onCardDragStop]),v=y.useCallback((w,k,i)=>{if(!d)return;const a=t.columns.find(l=>l.id===w);if(a?.wipLimit&&t.cards.filter(u=>u.columnId===w&&!u.isArchived).length>=a.wipLimit&&(d.columnId!==w||d.swimlaneId!==k)){const u=c.get("NotificationService");if(u&&u.add({type:"warning",message:`WIP limit reached for "${a.name}" (${a.wipLimit} cards)`,duration:4e3}),n){u?.add({type:"error",message:`Cannot move card: "${a.name}" is full (Strict WIP)`,duration:4e3}),C(null),g(null),j(null);return}}s(d.id,w,k,i),r?.onCardDragStop&&r.onCardDragStop({card:d,columnId:w}),C(null),g(null),j(null)},[d,t,s,r?.onCardDragStop]);return{draggedCard:d,dragOverColumn:m,dragOverSwimlane:S,handleDragStart:f,handleDragOver:I,handleDragEnd:o,handleDrop:v}},Xe=(t,s={})=>{const r=ut.useServiceState("I18nService")?.dir||"ltr",c=t.dir==="auto"||!t.dir?r:t.dir,d={showSpinner:()=>{},hideSpinner:()=>{}},C=null,{board:m,setBoard:g,selectedCards:S,setSelectedCards:j,selectedColumnId:f,setSelectedColumnId:I,view:o,setView:v,undo:w,redo:k,canUndo:i,canRedo:a}=ns(t),[l,u]=y.useState(null),{createCard:p,updateCard:D,deleteCard:F,moveCard:M,duplicateCard:T,archiveCard:N,restoreCard:_}=as(t,m),{createColumn:U,updateColumn:W,deleteColumn:G,reorderColumns:E,collapseColumn:H,expandColumn:b}=rs(t,m),{createSwimlane:B,updateSwimlane:P,deleteSwimlane:J,reorderSwimlanes:ne,collapseSwimlane:O,expandSwimlane:Q}=is(t,m),{draggedCard:Z,dragOverColumn:le,handleDragStart:Y,handleDragOver:ae,handleDragEnd:Se,handleDrop:ke}=os(m,M,t.wipStrict,t),{filteredCards:ie,searchQuery:fe,setSearchQuery:Ce,activeFilters:x,setActiveFilters:h,clearFilters:A}=ls(m),{selectedIndex:$,setSelectedIndex:ee}=te.useKeyboardNavigation({totalItems:ie.length,columns:1,enabled:!t.readOnly,onSelect:L=>{const R=ie[L];R&&(u(R.id),(document.getElementById(R.id)||document.querySelector(`[data-card-id="${R.id}"]`))?.scrollIntoView({behavior:"smooth",block:"nearest"}))},onAction:L=>{const R=ie[L];R&&s.onCardClick&&s.onCardClick(R)}}),de=y.useMemo(()=>({addCard:p,updateCard:D,deleteCard:F,moveCard:M,duplicateCard:T,archiveCard:N,restoreCard:_,getCard:L=>m.cards.find(R=>R.id===L),getCards:()=>m.cards,getCardsInColumn:L=>m.cards.filter(R=>R.columnId===L),getOrderedCards:L=>m.cards.filter(R=>R.columnId===L).sort((R,ve)=>(R.position??0)-(ve.position??0)),addColumn:U,updateColumn:W,deleteColumn:G,reorderColumns:E,collapseColumn:H,expandColumn:b,getColumn:L=>m.columns.find(R=>R.id===L),getColumns:()=>m.columns,addSwimlane:B,updateSwimlane:P,deleteSwimlane:J,reorderSwimlanes:ne,collapseSwimlane:O,expandSwimlane:Q,getSwimlane:L=>m.swimlanes?.find(R=>R.id===L),getSwimlanes:()=>m.swimlanes||[],selectCard:L=>j([L]),selectCards:j,deselectCard:L=>{const R=S.filter(ve=>ve!==L);j(R)},deselectAllCards:()=>j([]),getSelectedCards:()=>m.cards.filter(L=>S.includes(L.id)),focusCard:L=>{const R=document.getElementById(L)||document.querySelector(`[data-card-id="${L}"]`);R instanceof HTMLElement&&(R.focus(),R.scrollIntoView({behavior:"smooth",block:"center"}))},highlightCard:(L,R=2e3)=>{u(L),setTimeout(()=>u(null),R)},setView:v,getView:()=>o,scrollToColumn:(L,R)=>{(document.getElementById(`column-${L}`)||document.querySelector(`[data-column-id="${L}"]`))?.scrollIntoView(R||{behavior:"smooth",block:"center",inline:"center"})},scrollToCard:(L,R)=>{(document.getElementById(L)||document.querySelector(`[data-card-id="${L}"]`))?.scrollIntoView(R||{behavior:"smooth",block:"center"})},setSearchQuery:Ce,getSearchQuery:()=>fe,setActiveFilters:h,getActiveFilters:()=>x,clearFilters:A,getFilteredCards:()=>ie,getBoard:()=>m,setBoard:g,refresh:async()=>{},reset:()=>g(t.board),showSpinner:d.showSpinner,hideSpinner:d.hideSpinner,forceUpdate:()=>{},getStatistics:()=>({totalCards:m.cards.length,totalColumns:m.columns.length}),validate:()=>({isValid:!0,errors:[]}),...s}),[m,p,D,F,M,T,N,_,U,W,G,E,H,b,B,P,J,ne,O,Q,S,j,f,I,fe,Ce,x,h,A,ie,g,t.board,d,s,o,t.wipStrict,t]);return y.useMemo(()=>({state:{board:m,selectedCards:S,highlightedCardId:l,selectedColumnId:f,view:o,draggedCard:Z,dragOverColumn:le,filteredCards:ie,searchQuery:fe,activeFilters:x,selectedIndex:$,canUndo:i,canRedo:a},actions:{setBoard:g,setSelectedCards:j,setSelectedColumnId:I,setView:v,createCard:p,updateCard:D,deleteCard:F,moveCard:M,duplicateCard:T,archiveCard:N,restoreCard:_,createColumn:U,updateColumn:W,deleteColumn:G,reorderColumns:E,collapseColumn:H,expandColumn:b,createSwimlane:B,updateSwimlane:P,deleteSwimlane:J,reorderSwimlanes:ne,collapseSwimlane:O,expandSwimlane:Q,handleDragStart:Y,handleDragOver:ae,handleDragEnd:Se,handleDrop:ke,setSearchQuery:Ce,setActiveFilters:h,clearFilters:A,setSelectedIndex:ee,undo:w,redo:k},services:{serviceRegistry:C},imperativeAPI:de,dir:c,baseApi:d}),[d,de,m,g,S,j,l,f,I,o,v,c,p,D,F,M,T,N,_,U,W,G,E,H,b,B,P,J,ne,O,Q,Z,le,Y,ae,Se,ke,ie,fe,Ce,x,h,A,C,$,ee,w,k,i,a])};function Ge(t,s=300){const[n,r]=y.useState(t);return y.useEffect(()=>{const c=setTimeout(()=>{r(t)},s);return()=>{clearTimeout(c)}},[t,s]),n}const Ye=V.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Me({className:t,variant:s,...n}){return e.jsx("div",{className:z.cn(Ye({variant:s}),t),...n})}const cs=({board:t,activeFilters:s,onFiltersChange:n,onClearFilters:r})=>{const d=Array.from(new Set(t.cards.flatMap(o=>o.tags).map(o=>JSON.stringify(o)))).map(o=>JSON.parse(o)).filter((o,v,w)=>v===w.findIndex(k=>k.id===o.id)),m=Array.from(new Set(t.cards.flatMap(o=>o.assignees).map(o=>JSON.stringify(o)))).map(o=>JSON.parse(o)).filter((o,v,w)=>v===w.findIndex(k=>k.id===o.id)),g=["low","medium","high","critical"],S=o=>{const v=s.priority||[],w=v.includes(o)?v.filter(k=>k!==o):[...v,o];n({...s,priority:w.length?w:void 0})},j=o=>{const v=s.tags||[],w=v.includes(o)?v.filter(k=>k!==o):[...v,o];n({...s,tags:w.length?w:void 0})},f=o=>{const v=s.assignees||[],w=v.includes(o)?v.filter(k=>k!==o):[...v,o];n({...s,assignees:w.length?w:void 0})},I=(s.priority?.length||0)+(s.tags?.length||0)+(s.assignees?.length||0);return e.jsxs(he.Popover,{children:[e.jsx(he.PopoverTrigger,{asChild:!0,children:e.jsxs(V.Button,{variant:"outline",size:"sm",className:"relative",children:[e.jsx(re.Funnel,{className:"h-4 w-4 mr-2"}),"Filters",I>0&&e.jsx(Me,{variant:"secondary",className:"ml-2 h-5 min-w-[20px] px-1 text-[10px] flex items-center justify-center",children:I})]})}),e.jsxs(he.PopoverContent,{className:"w-80 p-4",align:"start",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"font-medium leading-none",children:"Filters"}),I>0&&e.jsx(V.Button,{variant:"ghost",size:"sm",className:"h-auto p-0 text-xs text-muted-foreground",onClick:r,children:"Clear all"})]}),e.jsx(mt.ScrollArea,{className:"h-[300px] pr-4",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"Priority"}),e.jsx("div",{className:"space-y-2",children:g.map(o=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(re.Checkbox,{id:`priority-${o}`,checked:s.priority?.includes(o),onCheckedChange:()=>S(o)}),e.jsx(oe.Label,{htmlFor:`priority-${o}`,className:"capitalize text-sm font-normal cursor-pointer",children:o})]},o))})]}),m.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"Assignees"}),e.jsx("div",{className:"space-y-2",children:m.map(o=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(re.Checkbox,{id:`assignee-${o.id}`,checked:s.assignees?.includes(o.id),onCheckedChange:()=>f(o.id)}),e.jsxs(oe.Label,{htmlFor:`assignee-${o.id}`,className:"text-sm font-normal cursor-pointer flex items-center gap-2",children:[o.avatarUrl&&e.jsx("img",{src:o.avatarUrl,alt:"",className:"w-4 h-4 rounded-full"}),o.name]})]},o.id))})]}),d.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"text-sm font-medium text-muted-foreground",children:"Tags"}),e.jsx("div",{className:"space-y-2",children:d.map(o=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(re.Checkbox,{id:`tag-${o.id}`,checked:s.tags?.includes(o.id),onCheckedChange:()=>j(o.id)}),e.jsxs(oe.Label,{htmlFor:`tag-${o.id}`,className:"text-sm font-normal cursor-pointer flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:o.color}}),o.name]})]},o.id))})]})]})})]})]})},Ze=({searchQuery:t,onSearchChange:s,onAddCardClick:n,onAddColumn:r,board:c,className:d,view:C="standard",onViewChange:m,onUndo:g,onRedo:S,canUndo:j,canRedo:f,activeFilters:I,onFiltersChange:o})=>{const v=z.useEzServiceRegistry(),[w,k]=y.useState(t),{t:i}=pe(),a=Ge(w,300);y.useEffect(()=>{s(a)},[a,s]),y.useEffect(()=>{k(t)},[t]);const l=()=>{n?.()},u=p=>{if(c)try{const D=v.get("ExportService");if(p==="csv"){const M=c.cards.map(T=>({id:T.id,title:T.title,description:T.description||"",column:c.columns.find(N=>N.id===T.columnId)?.name||"",priority:T.priority||"",assignees:T.assignees?.map(N=>N.name).join("; ")||"",tags:T.tags?.map(N=>N.name).join("; ")||"",dueDate:T.dueDate?new Date(T.dueDate).toISOString().split("T")[0]:"",isArchived:T.isArchived?"Yes":"No"}));if(D)D.exportToCSV(M,[{header:"ID",accessorKey:"id"},{header:"Title",accessorKey:"title"},{header:"Description",accessorKey:"description"},{header:"Column",accessorKey:"column"},{header:"Priority",accessorKey:"priority"},{header:"Assignees",accessorKey:"assignees"},{header:"Tags",accessorKey:"tags"},{header:"Due Date",accessorKey:"dueDate"},{header:"Archived",accessorKey:"isArchived"}],{fileName:`kanban-board-${c.id}`});else{const T=Object.keys(M[0]||{}),N=[T.join(","),...M.map(G=>T.map(E=>`"${G[E]}"`).join(","))].join(`
|
|
2
|
+
`),_=new Blob([N],{type:"text/csv"}),U=URL.createObjectURL(_),W=document.createElement("a");W.href=U,W.download=`kanban-board-${c.id}.csv`,W.click(),URL.revokeObjectURL(U)}}else{const M=JSON.stringify(c,null,2);if(D&&D.download)D.download(M,`kanban-board-${c.id}.json`);else{const T=new Blob([M],{type:"application/json"}),N=URL.createObjectURL(T),_=document.createElement("a");_.href=N,_.download=`kanban-board-${c.id}.json`,_.click(),URL.revokeObjectURL(N)}}const F=v.get("NotificationService");F&&F.add({type:"success",message:`Board exported as ${p.toUpperCase()}`,duration:3e3})}catch(D){const F=v.get("NotificationService");F&&F.add({type:"error",message:`Failed to export board: ${D instanceof Error?D.message:"Unknown error"}`,duration:4e3})}};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:`flex items-center gap-4 p-4 border-b ${d||""}`,children:[e.jsxs("div",{className:"flex gap-1 mr-2",children:[e.jsx(V.Button,{variant:"ghost",size:"icon",onClick:g,disabled:!j,title:"Undo (Ctrl+Z)",children:e.jsx(Gt,{className:"h-4 w-4"})}),e.jsx(V.Button,{variant:"ghost",size:"icon",onClick:S,disabled:!f,title:"Redo (Ctrl+Shift+Z)",children:e.jsx(Pt,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(K.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(we.Input,{placeholder:i("search_placeholder"),value:w,onChange:p=>k(p.target.value),className:"pl-9"})]}),e.jsx("div",{className:"w-[180px]",children:e.jsxs(K.Select,{value:C,onValueChange:p=>m?.(p),children:[e.jsx(K.SelectTrigger,{children:e.jsx(K.SelectValue,{placeholder:"Select view"})}),e.jsxs(K.SelectContent,{children:[e.jsx(K.SelectItem,{value:"standard",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"}),i("view_standard")]})}),e.jsx(K.SelectItem,{value:"swimlane",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ht.Layers,{className:"h-4 w-4 mr-2"}),i("view_swimlane")]})}),e.jsx(K.SelectItem,{value:"timeline",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Qe,{className:"h-4 w-4 mr-2"})," ",i("view_timeline")]})})]})]})}),c&&e.jsx(cs,{board:c,activeFilters:I||{},onFiltersChange:p=>o?.(p),onClearFilters:()=>o?.({})}),c&&e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(V.Button,{variant:"outline",size:"sm",onClick:()=>u("csv"),title:"Export as CSV",children:[e.jsx($e.Download,{className:"h-4 w-4 mr-2"}),"CSV"]}),e.jsxs(V.Button,{variant:"outline",size:"sm",onClick:()=>u("json"),title:"Export as JSON",children:[e.jsx($e.Download,{className:"h-4 w-4 mr-2"}),"JSON"]})]}),e.jsxs("div",{className:"ml-auto flex gap-2",children:[e.jsxs(V.Button,{variant:"outline",size:"sm",onClick:r,children:[e.jsx(re.Plus,{className:"h-4 w-4 mr-2"}),i("add_column")]}),e.jsxs(V.Button,{size:"sm",onClick:l,children:[e.jsx(re.Plus,{className:"h-4 w-4 mr-2"}),i("add_card")]})]})]})})},Ne=se.forwardRef(({className:t,...s},n)=>e.jsx("textarea",{className:z.cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...s}));Ne.displayName="Textarea";const Fe=se.createContext(void 0),_e=se.forwardRef(({className:t,defaultValue:s,value:n,onValueChange:r,children:c,...d},C)=>{const[m,g]=se.useState(s||""),S=n!==void 0,j=S?n:m,f=se.useCallback(I=>{S||g(I),r?.(I)},[S,r]);return e.jsx(Fe.Provider,{value:{value:j,onValueChange:f},children:e.jsx("div",{ref:C,className:z.cn(t),...d,children:c})})});_e.displayName="Tabs";const Ee=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));Ee.displayName="TabsList";const ue=se.forwardRef(({className:t,value:s,onClick:n,...r},c)=>{const d=se.useContext(Fe);if(!d)throw new Error("TabsTrigger must be used within Tabs");const C=d.value===s;return e.jsx("button",{ref:c,type:"button",className:z.cn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",C&&"bg-background text-foreground shadow-sm",t),onClick:m=>{d.onValueChange(s),n?.(m)},...r})});ue.displayName="TabsTrigger";const me=se.forwardRef(({className:t,value:s,children:n,...r},c)=>{const d=se.useContext(Fe);if(!d)throw new Error("TabsContent must be used within Tabs");return d.value!==s?null:e.jsx("div",{ref:c,className:z.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r,children:n})});me.displayName="TabsContent";const et=({isOpen:t,onClose:s,onSave:n,onDelete:r,card:c,columns:d=[],columnId:C,customFields:m=[],currentUser:g={id:"current-user",name:"Current User"}})=>{const{t:S}=pe(),j=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,f=xt.useForm({defaultValues:{title:c?.title||"",description:c?.description||"",columnId:c?.columnId||C||d[0]?.id||"",priority:c?.priority||"medium",startDate:c?.startDate?new Date(c.startDate):void 0,dueDate:c?.dueDate?new Date(c.dueDate):void 0,checklists:c?.checklists||[],attachments:c?.attachments||[],comments:c?.comments||[],coverImage:c?.coverImage||"",customFieldValues:c?.customFieldValues||{},subtasks:c?.subtasks||[],timeTracking:c?.timeTracking||{estimated:0,actual:0},activity:c?.activity||[],assignees:c?.assignees||[],tags:c?.tags||[],...c},onSubmit:async({value:x})=>{n(x),s()}});y.useEffect(()=>{},[t,c]);const I=()=>{c?.id&&r&&r(c.id)},[o,v]=y.useState({}),w=()=>{const x={id:j(),title:"Checklist",items:[]};f.pushFieldValue("checklists",x)},k=(x,h)=>{v(A=>({...A,[x]:h}))},i=x=>{const h=o[x]?.trim();if(!h)return;const $=(f.getFieldValue("checklists")||[]).map(ee=>ee.id===x?{...ee,items:[...ee.items,{id:j(),text:h,isChecked:!1}]}:ee);f.setFieldValue("checklists",$),v(ee=>({...ee,[x]:""}))},a=(x,h)=>{const $=(f.getFieldValue("checklists")||[]).map(ee=>ee.id===x?{...ee,items:ee.items.map(de=>de.id===h?{...de,isChecked:!de.isChecked}:de)}:ee);f.setFieldValue("checklists",$)},[l,u]=y.useState(""),[p,D]=y.useState(null),[F,M]=y.useState(""),[T,N]=y.useState(null),_=()=>{if(!l.trim())return;const x={id:j(),text:l,authorId:g.id,authorName:g.name,createdAt:new Date};f.pushFieldValue("comments",x),u("");const h={id:j(),type:"comment",text:`commented "${l.slice(0,20)}${l.length>20?"...":""}"`,userId:g.id,userName:g.name,createdAt:new Date};f.pushFieldValue("activity",h)},U=x=>{D(x.id),M(x.text)},W=()=>{if(p&&F.trim()){const h=(f.getFieldValue("comments")||[]).map(A=>A.id===p?{...A,text:F}:A);f.setFieldValue("comments",h),D(null),M("")}},G=()=>{D(null),M("")},E=x=>{N(x)},H=()=>{N(null)},b=x=>{const h=f.getFieldValue("comments")||[];f.setFieldValue("comments",h.filter($=>$.id!==x)),N(null);const A={id:j(),type:"delete",text:"deleted a comment",userId:g.id,userName:g.name,createdAt:new Date};f.pushFieldValue("activity",A)},[B,P]=y.useState(""),J=()=>{if(!B.trim())return;const x={id:j(),title:B,isCompleted:!1};f.pushFieldValue("subtasks",x),P("")},ne=x=>{const A=(f.getFieldValue("subtasks")||[]).map($=>$.id===x?{...$,isCompleted:!$.isCompleted}:$);f.setFieldValue("subtasks",A)},O=x=>{const h=f.getFieldValue("subtasks")||[];f.setFieldValue("subtasks",h.filter(A=>A.id!==x))},Q=y.useRef(null),[Z,le]=y.useState(!1),[Y,ae]=y.useState(null),Se=async x=>{const h=x.target.files?.[0];if(!h)return;le(!0),ae(null),await new Promise(ee=>setTimeout(ee,1500));const A={id:j(),name:h.name,url:URL.createObjectURL(h),type:h.type.startsWith("image/")?"image":"file",size:h.size,uploadedAt:new Date};f.pushFieldValue("attachments",A),le(!1),Q.current&&(Q.current.value="");const $={id:j(),type:"attachment",text:`attached ${h.name}`,userId:g.id,userName:g.name,createdAt:new Date};f.pushFieldValue("activity",$)},ke=x=>{const h=f.getFieldValue("attachments")||[];f.setFieldValue("attachments",h.filter($=>$.id!==x));const A={id:j(),type:"delete",text:"removed an attachment",userId:g.id,userName:g.name,createdAt:new Date};f.pushFieldValue("activity",A)},ie=!!c?.id,fe=x=>{x.preventDefault(),x.stopPropagation(),f.handleSubmit()},Ce=e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsx(f.Field,{name:"title",children:x=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{htmlFor:"title",className:"text-right",children:S("common.title")}),e.jsx(we.Input,{id:"title",value:x.state.value,onChange:h=>x.handleChange(h.target.value),placeholder:S("kanban.cardTitlePlaceholder"),className:"text-lg font-semibold"})]})}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx("div",{className:"w-[200px]",children:e.jsx(f.Field,{name:"columnId",children:x=>e.jsxs(K.Select,{value:x.state.value,onValueChange:h=>x.handleChange(h),children:[e.jsx(K.SelectTrigger,{children:e.jsx(K.SelectValue,{placeholder:"Status"})}),e.jsx(K.SelectContent,{children:d.map(h=>e.jsx(K.SelectItem,{value:h.id,children:h.name},h.id))})]})})}),ie&&e.jsxs("span",{className:"text-sm text-muted-foreground font-mono",children:["#",c?.id?.slice(0,8)]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(f.Field,{name:"priority",children:x=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{children:"Priority"}),e.jsxs(K.Select,{value:x.state.value,onValueChange:h=>x.handleChange(h),children:[e.jsx(K.SelectTrigger,{children:e.jsx(K.SelectValue,{placeholder:"Priority"})}),e.jsxs(K.SelectContent,{children:[e.jsx(K.SelectItem,{value:"low",children:"Low"}),e.jsx(K.SelectItem,{value:"medium",children:"Medium"}),e.jsx(K.SelectItem,{value:"high",children:"High"}),e.jsx(K.SelectItem,{value:"critical",children:"Critical"})]})]})]})}),e.jsx(f.Field,{name:"startDate",children:x=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{children:"Start Date"}),e.jsx(be.DateTimePicker,{date:x.state.value,setDate:h=>x.handleChange(h),mode:"date"})]})}),e.jsx(f.Field,{name:"dueDate",children:x=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{children:"Due Date"}),e.jsx(be.DateTimePicker,{date:x.state.value,setDate:h=>x.handleChange(h),mode:"date"})]})})]}),e.jsx(f.Field,{name:"description",children:x=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{children:"Description"}),e.jsx(Ne,{value:x.state.value||"",onChange:h=>x.handleChange(h.target.value),className:"min-h-[150px]"})]})}),m.length>0&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 border-t pt-4",children:m.map(x=>e.jsx(f.Field,{name:`customFieldValues.${x.id}`,children:h=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe.Label,{children:x.name}),x.type==="text"&&e.jsx(we.Input,{value:h.state.value||"",onChange:A=>h.handleChange(A.target.value)}),x.type==="number"&&e.jsx(we.Input,{type:"number",value:h.state.value||"",onChange:A=>h.handleChange(Number(A.target.value))}),x.type==="date"&&e.jsx(be.DateTimePicker,{date:h.state.value,setDate:A=>h.handleChange(A),mode:"date"}),x.type==="select"&&e.jsxs(K.Select,{value:h.state.value||"",onValueChange:A=>h.handleChange(A),children:[e.jsx(K.SelectTrigger,{children:e.jsx(K.SelectValue,{placeholder:"Select..."})}),e.jsx(K.SelectContent,{children:x.options?.map(A=>e.jsx(K.SelectItem,{value:A,children:A},A))})]}),x.type==="checkbox"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(re.Checkbox,{checked:!!h.state.value,onCheckedChange:A=>h.handleChange(!!A)}),e.jsx("span",{className:"text-sm font-medium",children:x.name})]})]})},x.id))}),e.jsxs(_e,{defaultValue:"subtasks",className:"w-full",children:[e.jsxs(Ee,{className:"grid w-full grid-cols-5",children:[e.jsx(ue,{value:"subtasks",children:"Subtasks"}),e.jsx(ue,{value:"checklists",children:"Checklists"}),e.jsx(ue,{value:"attachments",children:"Attachments"}),e.jsx(ue,{value:"comments",children:"Comments"}),e.jsx(ue,{value:"activity",children:"Activity"})]}),e.jsxs(me,{value:"subtasks",className:"space-y-4 pt-4",children:[e.jsx(f.Field,{name:"subtasks",children:x=>e.jsxs("div",{className:"space-y-2",children:[x.state.value?.map(h=>e.jsxs("div",{className:"flex items-center gap-2 border p-3 rounded-md",children:[e.jsx(re.Checkbox,{checked:h.isCompleted,onCheckedChange:()=>ne(h.id)}),e.jsx("span",{className:h.isCompleted?"line-through text-muted-foreground flex-1":"flex-1",children:h.title}),e.jsx(V.Button,{variant:"ghost",size:"icon",onClick:()=>O(h.id),children:e.jsx(V.X,{className:"w-4 h-4"})})]},h.id)),(!x.state.value||x.state.value.length===0)&&e.jsx("div",{className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg",children:"No subtasks yet."})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(we.Input,{value:B,onChange:x=>P(x.target.value),placeholder:"Add a subtask...",onKeyDown:x=>x.key==="Enter"&&J()}),e.jsx(V.Button,{onClick:J,disabled:!B.trim(),children:"Add"})]})]}),e.jsxs(me,{value:"checklists",className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"font-medium",children:"Checklists"}),e.jsxs(V.Button,{size:"sm",onClick:w,variant:"outline",children:[e.jsx(re.Plus,{className:"w-4 h-4 mr-2"})," Add Checklist"]})]}),e.jsx(f.Field,{name:"checklists",children:x=>e.jsxs("div",{className:"space-y-4",children:[x.state.value?.map(h=>{const A=h.items.length>0?Math.round(h.items.filter($=>$.isChecked).length/h.items.length*100):0;return e.jsxs("div",{className:"border rounded-md p-4 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("div",{className:"font-medium",children:h.title}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[A,"%"]})]}),e.jsx("div",{className:"h-2 w-full bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${A}%`}})}),e.jsx("div",{className:"space-y-2",children:h.items.map($=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(re.Checkbox,{checked:$.isChecked,onCheckedChange:()=>a(h.id,$.id)}),e.jsx("span",{className:$.isChecked?"line-through text-muted-foreground":"",children:$.text})]},$.id))}),e.jsxs("div",{className:"pt-2 flex gap-2",children:[e.jsx(we.Input,{placeholder:"Add an item...",className:"h-8 text-sm",value:o[h.id]||"",onChange:$=>k(h.id,$.target.value),onKeyDown:$=>$.key==="Enter"&&i(h.id)}),e.jsx(V.Button,{size:"sm",onClick:()=>i(h.id),disabled:!o[h.id]?.trim(),children:"Add"})]})]},h.id)}),(!x.state.value||x.state.value.length===0)&&e.jsx("div",{className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg",children:"No checklists yet."})]})})]}),e.jsxs(me,{value:"attachments",className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"font-medium",children:"Attachments"}),e.jsx("input",{type:"file",className:"hidden",ref:Q,onChange:Se}),e.jsxs("div",{className:"flex items-center gap-2",children:[Y&&e.jsx("span",{className:"text-xs text-red-500",children:Y}),e.jsxs(V.Button,{size:"sm",variant:"outline",onClick:()=>Q.current?.click(),disabled:Z,children:[Z?e.jsx(q.LoaderCircle,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(be.Paperclip,{className:"w-4 h-4 mr-2"}),Z?"Uploading...":"Upload"]})]})]}),e.jsx(f.Field,{name:"attachments",children:x=>e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[x.state.value?.map(h=>e.jsxs("div",{className:"border p-2 rounded flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 bg-muted flex items-center justify-center rounded",children:e.jsx(Tt,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("div",{className:"truncate font-medium text-sm",children:h.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:h.type})]}),e.jsx(V.Button,{variant:"ghost",size:"icon",className:"ml-auto",onClick:()=>ke(h.id),children:e.jsx(V.X,{className:"w-4 h-4 text-muted-foreground"})})]},h.id)),(!x.state.value||x.state.value.length===0)&&!Z&&e.jsx("div",{className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg",children:"No attachments yet."})]})})]}),e.jsxs(me,{value:"comments",className:"space-y-4 pt-4",children:[e.jsx(f.Field,{name:"comments",children:x=>e.jsxs("div",{className:"space-y-4",children:[x.state.value?.map(h=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx(xe.Avatar,{className:"w-8 h-8",children:e.jsx(xe.AvatarFallback,{children:h.authorName[0]})}),e.jsxs("div",{className:"space-y-1 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-sm",children:h.authorName}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(h.createdAt).toLocaleString()})]}),p===h.id?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ne,{value:F,onChange:A=>M(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.metaKey||A.ctrlKey)?W():A.key==="Escape"&&G()},autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(V.Button,{size:"sm",variant:"ghost",onClick:G,children:"Cancel"}),e.jsx(V.Button,{size:"sm",onClick:W,children:"Save"})]})]}):e.jsx("div",{className:"text-sm bg-muted/50 p-2 rounded-md",children:h.text}),T===h.id&&e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-red-50 text-red-800 rounded-md text-sm mt-2",children:[e.jsx(q.TriangleAlert,{className:"w-4 h-4"}),e.jsx("span",{className:"flex-1",children:"Delete this comment?"}),e.jsx(V.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-red-100 text-red-800",onClick:H,children:"No"}),e.jsx(V.Button,{size:"sm",variant:"destructive",className:"h-6 px-2",onClick:()=>b(h.id),children:"Yes"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(V.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>U(h),disabled:!!T,children:e.jsx(qt,{className:"w-3 h-3 text-muted-foreground"})}),e.jsx(V.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>E(h.id),disabled:!!T,children:e.jsx(We.Trash2,{className:"w-3 h-3 text-muted-foreground"})})]})]},h.id)),(!x.state.value||x.state.value.length===0)&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No comments yet."})]})}),e.jsx("div",{className:"pt-4 border-t sticky bottom-0 bg-background",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(xe.Avatar,{className:"w-8 h-8",children:e.jsx(xe.AvatarFallback,{children:g?.name?.[0]||"U"})}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Ne,{value:l,onChange:x=>u(x.target.value),placeholder:"Write a comment...",rows:2}),e.jsx("div",{className:"flex justify-end",children:e.jsx(V.Button,{size:"sm",onClick:_,disabled:!l.trim(),children:"Send"})})]})]})})]}),e.jsx(me,{value:"activity",className:"space-y-4 pt-4",children:e.jsx(f.Field,{name:"activity",children:x=>e.jsxs("div",{className:"space-y-4",children:[x.state.value?.map(h=>e.jsxs("div",{className:"flex gap-3 text-sm",children:[e.jsx("div",{className:"mt-1",children:e.jsx(yt,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold",children:h.userName})," ",e.jsx("span",{className:"text-muted-foreground",children:h.text}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:new Date(h.createdAt).toLocaleString()})]})]},h.id)),(!x.state.value||x.state.value.length===0)&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No activity yet."})]})})})]})]});return e.jsxs(te.Modal,{isOpen:t,onClose:s,title:ie?"Edit Card":"New Card",className:"sm:max-w-[800px] h-[85vh] flex flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:Ce}),e.jsxs("div",{className:"flex justify-between pt-4 border-t mt-4",children:[ie&&e.jsx(V.Button,{variant:"destructive",onClick:I,children:"Delete Card"}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsx(V.Button,{variant:"outline",onClick:s,children:"Cancel"}),e.jsx(V.Button,{onClick:x=>fe(x),children:"Save"})]})]})]})},Be=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("rounded-xl border bg-card text-card-foreground shadow",t),...s}));Be.displayName="Card";const Ve=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("flex flex-col space-y-1.5 p-6",t),...s}));Ve.displayName="CardHeader";const tt=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("font-semibold leading-none tracking-tight",t),...s}));tt.displayName="CardTitle";const st=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("text-sm text-muted-foreground",t),...s}));st.displayName="CardDescription";const Ie=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("p-6 pt-0",t),...s}));Ie.displayName="CardContent";const nt=se.forwardRef(({className:t,...s},n)=>e.jsx("div",{ref:n,className:z.cn("flex items-center p-6 pt-0",t),...s}));nt.displayName="CardFooter";const Ue={Active:{color:"emerald",label:"Active",icon:je},Verified:{color:"emerald",label:"Verified",icon:je},Approved:{color:"emerald",label:"Approved",icon:je},Published:{color:"teal",label:"Published",icon:je},Resolved:{color:"teal",label:"Resolved",icon:je},Completed:{color:"indigo",label:"Completed",icon:je},"In Progress":{color:"sky",label:"In Progress",icon:St},Open:{color:"sky",label:"Open",icon:Et},Pending:{color:"amber",label:"Pending",icon:te.Clock},"Under Review":{color:"amber",label:"Under Review",icon:Pe},Scheduled:{color:"orange",label:"Scheduled",icon:te.Clock},Returned:{color:"orange",label:"Returned",icon:Qt},Rejected:{color:"red",label:"Rejected",icon:De.CircleX},Disapproved:{color:"red",label:"Disapproved",icon:De.CircleX},Unresolved:{color:"red",label:"Unresolved",icon:gt.CircleAlert},Expired:{color:"red",label:"Expired",icon:It},Cancelled:{color:"rose",label:"Cancelled",icon:De.CircleX},Unverified:{color:"rose",label:"Unverified",icon:Ke},Inactive:{color:"slate",label:"Inactive",icon:De.CircleX},"On Leave":{color:"blue",label:"On Leave",icon:te.Clock},Archived:{color:"gray",label:"Archived",icon:wt},Draft:{color:"gray",label:"Draft",icon:Pe},Closed:{color:"gray",label:"Closed",icon:Oe},Public:{color:"blue",label:"Public",icon:Ae.Globe},Private:{color:"slate",label:"Private",icon:Oe},Restricted:{color:"amber",label:"Restricted",icon:Ht},Internal:{color:"indigo",label:"Internal",icon:Zt},External:{color:"blue",label:"External",icon:Ae.Globe},System:{color:"violet",label:"System",icon:Ae.Settings},Default:{color:"gray",label:"Default",icon:Ke}},ds={none:"none",low:"0 0 10px -5px",medium:"0 0 20px -8px",high:"0 0 30px -4px"},ze=y.memo(({status:t,className:s,showDot:n=!1,showIcon:r=!1,iconPosition:c="left",hideLabel:d=!1,showTooltip:C=!0,variant:m="solid",customWidth:g,customHeight:S,customFontSize:j="11px",customBgColor:f,customTextColor:I,showBorder:o=!1,borderThickness:v="1px",customBorderColor:w,glowIntensity:k="medium"})=>{const i=Ue[t]||Ue.Default,a=i.color,l=i.icon,u=a==="gray"||a==="slate",p={width:g||void 0,height:S||void 0,fontSize:j,backgroundColor:f||void 0,color:I||void 0,borderWidth:o?v:"0px",borderColor:w||(o?"currentColor":"transparent"),borderStyle:o?"solid":"none",boxShadow:k!=="none"&&!f?`${ds[k]} var(--tw-shadow-color)`:void 0};return e.jsxs("div",{style:p,title:C?i.label:void 0,className:z.cn("inline-flex items-center justify-center gap-2 transition-all duration-300 rounded-full font-bold",d?"p-1.5 w-[28px] h-[28px]":"px-3 py-1",!g&&!d&&"min-w-[120px]",!S&&!d&&"min-h-[28px]",!f&&(m==="solid"?`bg-${a}-100`:"bg-transparent"),!I&&`text-${a}-950`,!f&&`dark:bg-${a}-300`,!I&&(u?"dark:text-white dark:bg-gray-800":"dark:text-black"),`shadow-${a}-500/40`,C&&"cursor-help",s),children:[c==="left"&&r&&e.jsx(l,{className:z.cn("shrink-0 stroke-[3px]",d?"w-4 h-4":"w-3.5 h-3.5")}),n&&!r&&!d&&e.jsx("span",{className:z.cn("w-1.5 h-1.5 rounded-full flex-shrink-0",`bg-${a}-700`,u?"dark:bg-white":"dark:bg-black/70")}),!d&&e.jsx("span",{className:"uppercase tracking-widest font-black leading-none",children:i.label}),c==="right"&&r&&e.jsx(l,{className:z.cn("shrink-0 stroke-[3px]",d?"w-4 h-4":"w-3.5 h-3.5")})]})});ze.displayName="StatusBadge";const He={formatDate:(t,s="PP")=>{if(!t)return"";const n=new Date(t);return te.isValid(n)?te.format(n,s):""},formatDateTime:(t,s="PP p")=>{if(!t)return"";const n=new Date(t);return te.isValid(n)?te.format(n,s):""},isValidDate:t=>{const s=new Date(t);return te.isValid(s)}},at=({card:t,onClick:s,onDoubleClick:n,isDragging:r,isHighlighted:c,enableTooltip:d,tooltipTemplate:C,customFields:m,slots:g,slotProps:S,className:j,dir:f})=>{const I=f==="rtl",{attributes:o,listeners:v,setNodeRef:w,transform:k,transition:i,isDragging:a}=ge.useSortable({id:t.id,data:{type:"card",card:t}}),l=r||a,u={transform:ce.CSS.Translate.toString(k),transition:i},p={low:"Pending",medium:"In Progress",high:"Active",critical:"Inactive"},D=t.checklists?.reduce((E,H)=>E+H.items.length,0)||0,F=t.checklists?.reduce((E,H)=>E+H.items.filter(b=>b.isChecked).length,0)||0,M=t.subtasks?.length||0,T=t.subtasks?.filter(E=>E.isCompleted).length||0,N=e.jsxs("div",{className:"p-0 space-y-2",children:[t.coverImage&&e.jsx("div",{className:"h-32 w-full overflow-hidden rounded-t-lg",children:e.jsx("img",{src:t.coverImage,alt:"Cover",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:z.cn("p-3 space-y-2",t.coverImage?"pt-1":""),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"font-medium text-sm line-clamp-2 flex-1",children:t.title}),t.priority&&e.jsx(ze,{status:p[t.priority]||"Pending",className:"shrink-0"})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),t.tags&&t.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(E=>e.jsx(Me,{variant:"secondary",className:"text-xs px-2 py-0",style:{backgroundColor:E.color,color:"#fff"},children:E.name},E.id))}),(D>0||t.attachments&&t.attachments.length>0||t.comments&&t.comments.length>0||M>0||t.timeTracking)&&e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground pt-1 flex-wrap",children:[t.attachments&&t.attachments.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(be.Paperclip,{className:"w-3 h-3"}),e.jsx("span",{children:t.attachments.length})]}),t.comments&&t.comments.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Rt,{className:"w-3 h-3"}),e.jsx("span",{children:t.comments.length})]}),D>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Jt,{className:"w-3 h-3"}),e.jsxs("span",{children:[F,"/",D]})]}),M>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ft,{className:"w-3 h-3"}),e.jsxs("span",{children:[T,"/",M]})]}),t.timeTracking&&(t.timeTracking.estimated>0||t.timeTracking.actual>0)&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",title:`Estimated: ${t.timeTracking.estimated}h, Actual: ${t.timeTracking.actual}h`,children:[e.jsx(te.Clock,{className:"w-3 h-3"}),e.jsxs("span",{children:[t.timeTracking.actual,"h / ",t.timeTracking.estimated,"h"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-2",children:[t.assignees.slice(0,3).map(E=>e.jsx(xe.Avatar,{className:"w-6 h-6 border-2 border-background",children:E.avatarUrl?e.jsx(xe.AvatarImage,{src:E.avatarUrl,alt:E.name}):e.jsx(xe.AvatarFallback,{className:"text-xs",children:E.name.substring(0,2).toUpperCase()})},E.id)),t.assignees.length>3&&e.jsx("div",{className:"w-6 h-6 rounded-full bg-muted border-2 border-background flex items-center justify-center",children:e.jsxs("span",{className:"text-xs",children:["+",t.assignees.length-3]})})]}),t.dueDate&&e.jsxs("div",{className:z.cn("flex items-center gap-1 text-xs text-muted-foreground",I?"mr-auto":"ml-auto"),children:[e.jsx(pt.Calendar,{className:"w-3 h-3"}),e.jsx("span",{children:He.formatDate(t.dueDate)})]})]})]}),m&&m.length>0&&t.customFieldValues&&e.jsx("div",{className:"px-3 pb-3 gap-1 flex flex-wrap",children:m.map(E=>{const H=t.customFieldValues?.[E.id];return H==null||H===""?null:e.jsxs("div",{className:"text-xs bg-muted px-1.5 py-0.5 rounded flex items-center gap-1 max-w-full truncate",children:[e.jsxs("span",{className:"text-muted-foreground opacity-70",children:[E.name,":"]}),e.jsx("span",{className:"font-medium truncate",children:E.type==="date"?He.formatDate(H):String(H)})]},E.id)})})]}),_=g?.cardContent,U=_?e.jsx(_,{card:t,...S?.cardContent}):N,W=e.jsx(Be,{ref:w,style:u,...o,...v,onClick:()=>s?.(t),onDoubleClick:()=>n?.(t),id:t.id,"data-card-id":t.id,className:z.cn("cursor-pointer transition-all hover:shadow-md overflow-hidden",l&&"opacity-50 ring-2 ring-primary/50",c&&"ring-2 ring-primary bg-primary/5 transition-colors duration-300",j),children:U}),G=g?.card;return G?e.jsx(G,{card:t,defaultContent:W,...S?.card}):e.jsx(X.TooltipWrapper,{enabled:d,content:C?C(t):null,children:W})};at.displayName="KanbanCard";const Re=y.memo(at),us=({cards:t,estimateSize:s=120,overscan:n=5})=>{const r=y.useRef(null),c=ft.useVirtualizer({count:t.length,getScrollElement:()=>r.current,estimateSize:()=>s,overscan:n});return{parentRef:r,virtualizer:c,virtualItems:c.getVirtualItems(),totalSize:c.getTotalSize()}},rt=({column:t,cards:s,onCardClick:n,onCardDoubleClick:r,onCardDragStart:c,onAddCard:d,onToggleCollapse:C,onDeleteColumn:m,onUpdateColumn:g,onColumnClick:S,selectedColumnId:j,draggedCardId:f,highlightedCardId:I,isDropTarget:o,customFields:v,className:w,dir:k,slots:i,slotProps:a})=>{const l=k==="rtl",{t:u}=pe(),[p,D]=y.useState(!1),F=i?.card||Re,[M,T]=y.useState(t.name),N=y.useRef(null);y.useEffect(()=>{p&&N.current&&(N.current.focus(),N.current.select())},[p]);const _=()=>{M.trim()&&M!==t.name?g?.(t.id,{name:M}):T(t.name),D(!1)},U=O=>{O.key==="Enter"?_():O.key==="Escape"&&(T(t.name),D(!1))},W=t.wipLimit&&s.length>t.wipLimit,G=t.wipLimit&&s.length===t.wipLimit,{setNodeRef:E,attributes:H,listeners:b,transform:B,transition:P,isDragging:J}=ge.useSortable({id:t.id,data:{type:"column",column:t}}),ne={transform:ce.CSS.Translate.toString(B),transition:P};return e.jsxs(Be,{ref:E,style:ne,className:z.cn("flex flex-col w-80 shrink-0 transition-all duration-200",j===t.id?"ring-2 ring-primary border-primary":"",J?"opacity-50":"",o?"ring-2 ring-primary/70 border-primary/50 bg-primary/5":"",w),onClick:()=>S?.(t.id),children:[e.jsxs(Ve,{className:"pb-3",onDoubleClick:()=>D(!0),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("div",{...H,...b,className:"cursor-grab active:cursor-grabbing p-1 hover:bg-muted rounded text-muted-foreground/50 hover:text-primary transition-colors",children:e.jsx(qe.Ellipsis,{className:"h-4 w-4"})}),e.jsx(V.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>C?.(t.id),children:t.isCollapsed?l?e.jsx(q.ChevronRight,{className:"h-4 w-4 rotate-180"}):e.jsx(q.ChevronRight,{className:"h-4 w-4"}):e.jsx(Je.ChevronDown,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[p?e.jsx("input",{ref:N,value:M,onChange:O=>T(O.target.value),onBlur:_,onKeyDown:U,className:"h-6 w-full text-sm font-semibold border rounded px-1 bg-background",onClick:O=>O.stopPropagation()}):e.jsx("h3",{className:"font-semibold text-sm truncate",title:t.name,children:t.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.length," ",u("items")]})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(he.DropdownMenu,{children:[e.jsx(he.DropdownMenuTrigger,{asChild:!0,children:e.jsx(V.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",children:e.jsx(qe.Ellipsis,{className:"h-4 w-4"})})}),e.jsx(he.DropdownMenuContent,{align:"end",children:e.jsxs(he.DropdownMenuItem,{className:"text-red-600 focus:text-red-600 focus:bg-red-50",onClick:()=>m?.(t.id),children:[e.jsx(We.Trash2,{className:"h-4 w-4 me-2"}),u("delete_column")||"Delete Column"]})})]}),e.jsx(V.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>d?.(t.id),children:e.jsx(re.Plus,{className:"h-4 w-4"})})]})]}),t.wipLimit&&e.jsx("div",{className:"mt-2",children:e.jsx("div",{className:"h-1 w-full bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:z.cn("h-full transition-all",W?"bg-red-500":G?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(s.length/t.wipLimit*100,100)}%`}})})})]}),!t.isCollapsed&&(()=>{const O=s.sort((Q,Z)=>Q.position-Z.position);if(O.length>50){const{parentRef:Q,virtualItems:Z,totalSize:le}=us({cards:O,estimateSize:120,overscan:5});return e.jsxs(Ie,{ref:Q,className:"flex-1 overflow-y-auto max-h-[calc(100vh-200px)]",children:[e.jsx("div",{style:{height:`${le}px`,position:"relative"},children:Z.map(Y=>{const ae=O[Y.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Y.start}px)`,paddingBottom:"8px"},children:e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Y.start}px)`,paddingBottom:"8px"},children:e.jsx(F,{card:ae,onClick:n,onDoubleClick:r,onDragStart:c,isDragging:f===ae.id,isHighlighted:I===ae.id,customFields:v,dir:k,...a?.card})},ae.id)},ae.id)})}),O.length===0&&e.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:u("no_cards")})]})}return e.jsxs(Ie,{className:"flex-1 overflow-y-auto max-h-[calc(100vh-200px)] space-y-2",children:[e.jsx(ge.SortableContext,{items:s.map(Q=>Q.id),strategy:ge.verticalListSortingStrategy,children:O.map(Q=>e.jsx(F,{card:Q,onClick:n,onDoubleClick:r,onDragStart:c,isDragging:f===Q.id,isHighlighted:I===Q.id,customFields:v,dir:k,...a?.card},Q.id))}),s.length===0&&e.jsx("div",{className:z.cn("flex h-32 items-center justify-center rounded-lg border border-dashed text-sm transition-all duration-150",o?"border-primary/60 bg-primary/5 text-primary/70":"text-muted-foreground"),children:o?"✦ Drop here":u("no_cards")})]})})()]})},ms=({swimlaneId:t,columnId:s,children:n,className:r})=>{const{isOver:c,setNodeRef:d}=ce.useDroppable({id:`swimlane-cell-${t}-${s}`,data:{type:"swimlane-cell",swimlaneId:t,columnId:s}});return e.jsx("div",{ref:d,className:z.cn(r,c&&"bg-primary/5 transition-colors"),children:n})},Te=({swimlane:t,columns:s,cards:n,onCardClick:r,onCardDoubleClick:c,onCardDragStart:d,onCardDragEnd:C,onToggleCollapse:m,draggedCardId:g,highlightedCardId:S,customFields:j,className:f,dir:I,slots:o,slotProps:v})=>{const w=I==="rtl",{t:k}=pe(),i=o?.card||Re;return e.jsxs("div",{className:z.cn("flex flex-col border rounded-lg bg-card text-card-foreground shadow-sm mb-4",f),children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 border-b bg-muted/30",children:[e.jsx(V.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>m?.(t.id),children:t.isCollapsed?w?e.jsx(q.ChevronRight,{className:"h-4 w-4 rotate-180"}):e.jsx(q.ChevronRight,{className:"h-4 w-4"}):e.jsx(Je.ChevronDown,{className:"h-4 w-4"})}),e.jsx("h3",{className:"font-semibold text-sm",children:t.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",n.length," ",k("items"),")"]})]}),!t.isCollapsed&&e.jsx("div",{className:z.cn("flex divide-x",w&&"divide-x-reverse"),children:s.map(a=>{const l=n.filter(u=>u.columnId===a.id);return e.jsx(ms,{swimlaneId:t.id,columnId:a.id,className:"flex-1 min-w-[280px] p-2 min-h-[100px]",children:e.jsx("div",{className:"space-y-2",children:l.map(u=>e.jsx(i,{card:u,onClick:r,onDoubleClick:c,onDragStart:d,onDragEnd:C,isDragging:g===u.id,isHighlighted:S===u.id,customFields:j,dir:I,...v?.card},u.id))})},a.id)})})]})},hs=(t,s)=>s.find(r=>r.id===t.columnId)?.color||"hsl(var(--primary))",it=({cards:t,columns:s,swimlanes:n,onCardUpdate:r,onCardClick:c,onCardCreate:d,className:C,dir:m})=>{const g=y.useMemo(()=>{let o=[];return n&&n.length>0?(o=n.sort((v,w)=>v.position-w.position).map(v=>({id:v.id,name:v.name,color:v.color})),t.some(v=>!v.swimlaneId)&&o.push({id:"uncategorized",name:"Uncategorized",color:"hsl(var(--muted-foreground))"}),o):s.sort((v,w)=>v.position-w.position).map(v=>({id:v.id,name:v.name,color:v.color}))},[n,s,t]),S=y.useMemo(()=>t.map(o=>{const v=n&&n.length>0?o.swimlaneId||"uncategorized":o.columnId||"uncategorized",w=o.startDate?new Date(o.startDate):o.dueDate?te.startOfDay(new Date(o.dueDate)):te.startOfDay(new Date),k=o.dueDate?new Date(o.dueDate):te.addDays(w,1),i=s.find(a=>a.id===o.columnId);return{id:o.id,title:o.title,start:w,end:k,resourceId:v||"uncategorized",description:o.description,color:hs(o,s),status:i?.name,originalCard:o}}),[t,n,s]),j=y.useCallback(o=>{const v=o.originalCard;if(!v)return;const w={...v,startDate:o.start,dueDate:o.end,...n&&n.length>0?{swimlaneId:o.resourceId}:{columnId:o.resourceId||v.columnId||s[0]?.id||""}};r?.(w,"move")},[r,n,s]),f=y.useCallback(o=>{const v=n&&n.length>0,w={title:o.title||"New Card",startDate:o.start,dueDate:o.end,columnId:!v&&o.resourceId?o.resourceId:s[0]?.id||"",swimlaneId:v&&o.resourceId?o.resourceId:void 0,description:o.description||"",priority:"medium"};d?.(w)},[n,s,d]),I=y.useCallback(o=>{const v=o.originalCard;v&&c?.(v)},[c]);return e.jsx("div",{className:C,style:{height:"100%",minHeight:"600px"},children:e.jsx(te.EzScheduler,{events:S,resources:g,selectedDate:new Date,view:"TimelineMonth",views:["TimelineWeek","TimelineMonth"],onEventChange:j,onEventCreate:f,onEventClick:I,showHeaderBar:!0,showResourceHeaders:!0,dir:m})})},lt=({board:t,onCardClick:s,onCardDoubleClick:n,onCardDragStart:r,onCardDragEnd:c,onCardDrop:d,onAddCard:C,onToggleColumnCollapse:m,onToggleSwimlaneCollapse:g,onAddColumn:S,onDeleteColumn:j,onUpdateColumn:f,onColumnClick:I,onCreateCard:o,selectedColumnId:v,draggedCardId:w,filteredCards:k,slots:i,slotProps:a,className:l,view:u="standard",dir:p})=>{const D=k||t.cards,{t:F}=pe(),[M,T]=y.useState(null),[N,_]=y.useState(null);if(u==="timeline")return e.jsx(it,{cards:D,columns:t.columns,swimlanes:t.swimlanes,onCardUpdate:d?async(b,B)=>{B==="move"&&d(b.columnId,b.swimlaneId)}:void 0,onCardClick:s,onCardCreate:o,className:l,dir:p});const U=()=>!t.swimlanes||t.swimlanes.length===0?null:e.jsx("div",{className:z.cn("flex flex-col p-4 overflow-y-auto h-full",l),children:e.jsxs(ge.SortableContext,{items:D.map(b=>b.id),children:[t.swimlanes.sort((b,B)=>b.position-B.position).map(b=>{const B=D.filter(P=>P.swimlaneId===b.id);return e.jsx(Te,{swimlane:b,columns:t.columns.sort((P,J)=>P.position-J.position),cards:B,onCardClick:s,onCardDoubleClick:n,onCardDragStart:r,onCardDragEnd:c,onDrop:d,onToggleCollapse:g,draggedCardId:w,customFields:t.customFields,slots:i,slotProps:a,dir:p},b.id)}),D.some(b=>!b.swimlaneId)&&e.jsx(Te,{swimlane:{id:"uncategorized",name:F("uncategorized"),type:"custom",position:9999,isCollapsed:!1},columns:t.columns.sort((b,B)=>b.position-B.position),cards:D.filter(b=>!b.swimlaneId),onCardClick:s,onCardDoubleClick:n,onCardDragStart:r,onCardDragEnd:c,onDrop:d,onToggleCollapse:()=>{},draggedCardId:w,customFields:t.customFields,slots:i,slotProps:a,dir:p})]})}),W=ce.useSensors(ce.useSensor(ce.PointerSensor,{activationConstraint:{distance:5}})),G=b=>{const{active:B}=b;B.data.current?.type==="card"&&(T(B.data.current.card),r?.(B.data.current.card))},E=b=>{const{over:B}=b;if(!B){_(null);return}B.data.current?.type==="column"?_(B.data.current.column.id):B.data.current?.type==="card"?_(B.data.current.card.columnId):B.data.current?.type==="swimlane-cell"?_(B.data.current.columnId):_(null)},H=b=>{const{active:B,over:P}=b;if(T(null),_(null),!P){c?.();return}if(B.data.current?.type==="card"){let J,ne,O;if(P.data.current?.type==="column")J=P.data.current.column.id,ne=void 0;else if(P.data.current?.type==="swimlane-cell")J=P.data.current.columnId,O=P.data.current.swimlaneId;else if(P.data.current?.type==="card"){const Q=P.data.current.card;J=Q.columnId,O=Q.swimlaneId;let Z=t.cards.filter(Y=>Y.columnId===J);O&&(Z=Z.filter(Y=>Y.swimlaneId===O)),Z.sort((Y,ae)=>(Y.position??0)-(ae.position??0));const le=Z.findIndex(Y=>Y.id===Q.id);ne=le>=0?le:void 0}J?d?.(J,O,ne):c?.()}else B.data.current?.type==="column"&&P.data.current?.type,c?.()};return e.jsxs(ce.DndContext,{sensors:W,onDragStart:G,onDragOver:E,onDragEnd:H,children:[u==="swimlane"?U():e.jsxs("div",{className:z.cn("flex gap-4 overflow-x-auto p-4",l),children:[e.jsx(ge.SortableContext,{items:t.columns.map(b=>b.id),strategy:ge.horizontalListSortingStrategy,children:t.columns.sort((b,B)=>b.position-B.position).map(b=>{const B=D.filter(P=>P.columnId===b.id);return e.jsx(rt,{column:b,cards:B,onCardClick:s,onCardDoubleClick:n,onCardDragStart:r,onCardDragEnd:c,onDrop:d,onAddCard:C,onToggleCollapse:m,onDeleteColumn:j,onUpdateColumn:f,onColumnClick:I,selectedColumnId:v,draggedCardId:w,isDropTarget:N===b.id,customFields:t.customFields,slots:i,slotProps:a,dir:p},b.id)})}),S&&e.jsx("div",{className:"w-80 shrink-0",children:e.jsxs(V.Button,{variant:"outline",className:"w-full h-12 border-dashed",onClick:S,children:[e.jsx(re.Plus,{className:"me-2 h-4 w-4"}),F("add_column")||"Add Column"]})})]}),e.jsx(ce.DragOverlay,{dropAnimation:{duration:200,easing:"ease"},children:M?e.jsx("div",{className:"rotate-2 opacity-90 shadow-2xl ring-2 ring-primary/60 rounded-lg pointer-events-none w-72",children:e.jsxs("div",{className:"bg-card border border-border rounded-lg p-3 space-y-1",children:[e.jsx("p",{className:"font-medium text-sm",children:M.title}),M.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]})}):null})]})},xs=({isOpen:t,onClose:s,onConfirm:n,title:r,message:c,description:d})=>{const{t:C}=pe(),m=()=>{n(),s()};return e.jsx(te.Modal,{isOpen:t,onClose:s,title:r||C("confirm_delete")||"Confirm Delete",size:"sm",footer:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(V.Button,{variant:"ghost",onClick:s,children:C("cancel")||"Cancel"}),e.jsx(V.Button,{variant:"destructive",onClick:m,children:C("delete")||"Delete"})]}),children:e.jsxs("div",{className:"py-2",children:[e.jsx("p",{children:c||C("confirm_delete_message")||"Are you sure you want to delete this item?"}),(d||C("action_cannot_be_undone"))&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:d||C("action_cannot_be_undone")||"This action cannot be undone."})]})})},gs=new X.QueryClient,ot=y.forwardRef((t,s)=>{const{className:n,readOnly:r,...c}=t;return z.useInitCoreServices(),e.jsx(X.QueryClientProvider,{client:gs,children:e.jsx(q.EzErrorBoundary,{fallback:e.jsx(es,{}),children:e.jsx(ct,{ref:s,className:n,readOnly:r,...c})})})});ot.displayName="EzKanban";const ct=y.forwardRef((t,s)=>{const{className:n,readOnly:r,onCardClick:c,onCardDoubleClick:d}=t,C=Xe(t,s),{state:m,actions:g,dir:S,imperativeAPI:j}=C,[f,I]=y.useState(!1),[o,v]=y.useState(void 0),[w,k]=y.useState(!1),[i,a]=y.useState(null);y.useImperativeHandle(s,()=>j,[j]);const l=N=>{const _=N||m.selectedColumnId||m.board.columns[0]?.id;v({columnId:_,title:"",description:"",priority:"medium"}),I(!0)},u=async N=>{N.id?await g.updateCard(N.id,N):await g.createCard(N),I(!1)},p=N=>{t.confirmOnDelete!==!1?(a(N),k(!0),I(!1)):(g.deleteCard(N),I(!1))},D=async()=>{i&&(await g.deleteCard(i),k(!1),a(null))},F=N=>{r||(v(N),I(!0)),c?.(N)},M=N=>{const _=m.board.columns.find(U=>U.id===N);_&&(_.isCollapsed?g.expandColumn(N):g.collapseColumn(N))},T=N=>{const _=m.board.swimlanes?.find(U=>U.id===N);_&&(_.isCollapsed?g.expandSwimlane(N):g.collapseSwimlane(N))};return e.jsxs("div",{className:z.cn("flex flex-col h-full bg-background",n),dir:S,children:[e.jsx(Le.NotificationPanel,{}),e.jsx(Le.NotificationPanel,{}),!r&&(t.slots?.toolbar?e.jsx(t.slots.toolbar,{searchQuery:m.searchQuery,onSearchChange:g.setSearchQuery,onAddCardClick:()=>l(),onAddColumn:()=>{g.createColumn({name:"New Column",position:m.board.columns.length}).then(N=>{g.setSelectedColumnId(N.id)})},activeFilters:m.activeFilters,onFiltersChange:g.setActiveFilters,view:m.view,onViewChange:g.setView,onUndo:g.undo,onRedo:g.redo,canUndo:m.canUndo,canRedo:m.canRedo,...t.slotProps?.toolbar||{}}):e.jsx(Ze,{searchQuery:m.searchQuery,onSearchChange:g.setSearchQuery,onAddCardClick:()=>l(),onAddColumn:()=>{g.createColumn({name:"New Column",position:m.board.columns.length}).then(N=>{g.setSelectedColumnId(N.id)})},activeFilters:m.activeFilters,onFiltersChange:g.setActiveFilters,view:m.view,onViewChange:g.setView,onUndo:g.undo,onRedo:g.redo,canUndo:m.canUndo,canRedo:m.canRedo})),e.jsx("div",{className:"flex-1 overflow-hidden h-full",children:t.slots?.board?e.jsx(t.slots.board,{board:m.board,onCardClick:F,onCardDoubleClick:d,onCardDragStart:g.handleDragStart,onCardDragEnd:g.handleDragEnd,onCardDrop:g.handleDrop,onAddCard:l,onToggleColumnCollapse:M,onToggleSwimlaneCollapse:T,onDeleteColumn:g.deleteColumn,onUpdateColumn:g.updateColumn,onColumnClick:g.setSelectedColumnId,onCreateCard:u,selectedColumnId:m.selectedColumnId,draggedCardId:m.draggedCard?.id,filteredCards:m.filteredCards,slots:t.slots,slotProps:t.slotProps,view:m.view,dir:S,className:"flex-1 h-full",...t.slotProps?.board||{}}):e.jsx(lt,{board:m.board,onCardClick:F,onCardDoubleClick:d,onCardDragStart:g.handleDragStart,onCardDragEnd:g.handleDragEnd,onCardDrop:g.handleDrop,onAddCard:l,onToggleColumnCollapse:M,onToggleSwimlaneCollapse:T,onDeleteColumn:g.deleteColumn,onUpdateColumn:g.updateColumn,onColumnClick:g.setSelectedColumnId,onCreateCard:u,selectedColumnId:m.selectedColumnId,draggedCardId:m.draggedCard?.id,filteredCards:m.filteredCards,slots:t.slots,slotProps:t.slotProps,view:m.view,dir:S,className:"flex-1 h-full"})}),t.slots?.cardEditor?e.jsx(t.slots.cardEditor,{isOpen:f,onClose:()=>I(!1),onSave:u,onDelete:p,card:o,columns:m.board.columns,...t.slotProps?.cardEditor||{}}):e.jsx(et,{isOpen:f,onClose:()=>I(!1),onSave:u,onDelete:p,card:o,columns:m.board.columns}),e.jsx(xs,{isOpen:w,onClose:()=>k(!1),onConfirm:D,title:"Confirm Delete",message:"Are you sure you want to delete this card?",description:"This action cannot be undone."})]})});ct.displayName="EzKanbanInner";exports.Badge=Me;exports.Card=Be;exports.CardContent=Ie;exports.CardDescription=st;exports.CardEditorModal=et;exports.CardFooter=nt;exports.CardHeader=Ve;exports.CardTitle=tt;exports.EzKanban=ot;exports.KanbanBoardComponent=lt;exports.KanbanCard=Re;exports.KanbanColumn=rt;exports.KanbanSwimlane=Te;exports.KanbanTimelineView=it;exports.KanbanToolbar=Ze;exports.StatusBadge=ze;exports.Tabs=_e;exports.TabsContent=me;exports.TabsList=Ee;exports.TabsTrigger=ue;exports.Textarea=Ne;exports.badgeVariants=Ye;exports.useDebounce=Ge;exports.useEzKanban=Xe;exports.useI18n=pe;
|