@objectstack/console 16.0.0-rc.1 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/dist/.objectui-sha +1 -1
  3. package/dist/assets/{AdapterProvider-DkXaFA1A.js → AdapterProvider-CqW7TSvk.js} +1 -1
  4. package/dist/assets/{AiPendingActionsPage-C1pkyzWu.js → AiPendingActionsPage-C-QNNI9k.js} +1 -1
  5. package/dist/assets/{ApiConsolePage-BCujjvCA.js → ApiConsolePage-DSvjQt5N.js} +1 -1
  6. package/dist/assets/{AppDocsIndex-DwtDfwnR.js → AppDocsIndex-B4Vi3Lmx.js} +1 -1
  7. package/dist/assets/{AppManagementPage-KPrmIA-f.js → AppManagementPage-l7bxl-aE.js} +1 -1
  8. package/dist/assets/{ApprovalsInboxPage-DFQUv0F_.js → ApprovalsInboxPage-BV4PlaEv.js} +1 -1
  9. package/dist/assets/{AuditLogPage-BNkFvefV.js → AuditLogPage-ChJYd7GY.js} +1 -1
  10. package/dist/assets/{ComponentNavView-FTFk3uvC.js → ComponentNavView-C4OkKu2y.js} +1 -1
  11. package/dist/assets/CreateViewDialog-DwpQ8KvO.js +1 -0
  12. package/dist/assets/{DashboardView-Y6nIjjJB.js → DashboardView-CuDS84Jp.js} +1 -1
  13. package/dist/assets/{DeveloperHubPage-CYPM3AvL.js → DeveloperHubPage-CnVzl2hV.js} +1 -1
  14. package/dist/assets/{DocShell-DnXj6ocC.js → DocShell-D83T8iWF.js} +1 -1
  15. package/dist/assets/{ExpressionProvider-BrbZIz2M.js → ExpressionProvider-CyltvbX0.js} +1 -1
  16. package/dist/assets/{FlowRunsPage-BAbmqrqx.js → FlowRunsPage-BE8HeEGL.js} +1 -1
  17. package/dist/assets/{IntegrationsPage-CyD9iolE.js → IntegrationsPage-DI3vZb2A.js} +1 -1
  18. package/dist/assets/{InterfaceListPage-DdaX7c_c.js → InterfaceListPage-BL7sW-SC.js} +1 -1
  19. package/dist/assets/{ManagedByBadge-DbYycO1m.js → ManagedByBadge-D8aPzQJc.js} +1 -1
  20. package/dist/assets/MarketplaceAccessDenied-B00hPOtj.js +1 -0
  21. package/dist/assets/{MarketplaceInstalledPage-BtD9NMRl.js → MarketplaceInstalledPage-BdLyXA35.js} +1 -1
  22. package/dist/assets/{MarketplacePackagePage-DHrjr3jY.js → MarketplacePackagePage-By15SZoJ.js} +1 -1
  23. package/dist/assets/{MarketplacePage-Dw2yHsdE.js → MarketplacePage-BKxIWeT_.js} +1 -1
  24. package/dist/assets/MetadataInspector-CcRGESLn.js +1 -0
  25. package/dist/assets/{MetadataProvider-BnfG1pyl.js → MetadataProvider-CjWp0ChY.js} +1 -1
  26. package/dist/assets/ObjectDataPage-DiQJROyN.js +1 -0
  27. package/dist/assets/{PageView-jtsz_IPE.js → PageView-CJY74CxE.js} +1 -1
  28. package/dist/assets/{ProfilePage-BhlwjGUP.js → ProfilePage-CjxWQMQA.js} +1 -1
  29. package/dist/assets/PublicFormsPage-BVEV96-N.js +1 -0
  30. package/dist/assets/RecordDetailView-DpRJpP6t.js +9 -0
  31. package/dist/assets/{RecordFormPage-BRDfPdPg.js → RecordFormPage-BMs8Sa4p.js} +1 -1
  32. package/dist/assets/ReportDefaultInspector-BpXXGsGu.js +3 -0
  33. package/dist/assets/ReportView-C0fP1MLd.js +2 -0
  34. package/dist/assets/SearchResultsPage-CjSZ416m.js +1 -0
  35. package/dist/assets/{SettingsHub-DqS8nfs-.js → SettingsHub-DhWm94wF.js} +1 -1
  36. package/dist/assets/{SettingsView-DHrrHsbU.js → SettingsView-Dd0B_UlN.js} +1 -1
  37. package/dist/assets/{SystemHubPage-BWPXrnc9.js → SystemHubPage-C5Widsf0.js} +1 -1
  38. package/dist/assets/{useMetadata-Byeqylbl.js → createDerive-DGOUbVlZ.js} +1 -1
  39. package/dist/assets/data-adapter-Dz0aiaG6.js +9 -0
  40. package/dist/assets/framework-BqSgd3ir.js +8 -0
  41. package/dist/assets/{getIcon-EzAarNT8.js → getIcon-BZn0biL3.js} +1 -1
  42. package/dist/assets/{highlighted-body-OFNGDK62-3tGE6imP.js → highlighted-body-OFNGDK62-CDb4f2Sa.js} +1 -1
  43. package/dist/assets/{i18n-CWIk44wT.js → i18n-SjY5NweX.js} +1 -1
  44. package/dist/assets/{index-LuGaXtX0.js → index-CgfL2xiq.js} +1 -1
  45. package/dist/assets/index-De6xiiED.css +2 -0
  46. package/dist/assets/mermaid-GHXKKRXX-CWn_Hnds.js +1 -0
  47. package/dist/assets/metadata-admin-BRw86sJ-.js +25 -0
  48. package/dist/assets/{plugin-calendar-Bx_Bsdae.js → plugin-calendar-C4ZXapZt.js} +1 -1
  49. package/dist/assets/plugin-charts-D5Lb0q0u.js +7 -0
  50. package/dist/assets/plugin-chatbot-dJq9DS4J.js +120 -0
  51. package/dist/assets/{plugin-dashboard-D2VhHDxA.js → plugin-dashboard-Cr7jkjy7.js} +3 -3
  52. package/dist/assets/{plugin-form-HMQsT2Tp.js → plugin-form-D4kHsl47.js} +1 -1
  53. package/dist/assets/{plugin-gantt-CMpG3oO4.js → plugin-gantt-8LuVErg3.js} +2 -2
  54. package/dist/assets/plugin-grid-CDpGckvD.js +8 -0
  55. package/dist/assets/plugin-kanban-Xwny03DA.js +1 -0
  56. package/dist/assets/{plugin-map-zagD7Zuk.js → plugin-map-CVC4XDJz.js} +1 -1
  57. package/dist/assets/{plugin-markdown-DtcSX8M_.js → plugin-markdown-By5yxTCK.js} +1 -1
  58. package/dist/assets/{plugin-report-BRs6v5vb.js → plugin-report-DwvPiTGE.js} +1 -1
  59. package/dist/assets/{plugin-timeline-Cl8J9HYj.js → plugin-timeline-D2Sep4-I.js} +1 -1
  60. package/dist/assets/{plugin-tree-B3zTpUOf.js → plugin-tree-Doah8whm.js} +1 -1
  61. package/dist/assets/plugin-view-DZXBuUS9.js +1 -0
  62. package/dist/assets/plugins-views-BGSw-KmQ.js +4 -0
  63. package/dist/assets/runtime-metadata-persistence-CEZY_PIp.js +1 -0
  64. package/dist/assets/{skeletons-CPF9cI6N.js → skeletons-D0Z3uPzj.js} +1 -1
  65. package/dist/assets/src-DPHY2JFl.js +1 -0
  66. package/dist/assets/src-RHOMTPFk.js +19 -0
  67. package/dist/assets/{src-A4S4Zx5p.js → src-YtGn_UVR.js} +1 -1
  68. package/dist/assets/{types-CtGENai_.js → types-BR_9hYa5.js} +1 -1
  69. package/dist/assets/{ui-components-D1psd5qA.js → ui-components-Ci5ufF7g.js} +11 -11
  70. package/dist/assets/{ui-layout-UgL2qgLW.js → ui-layout-D_8Fal4s.js} +1 -1
  71. package/dist/assets/{use-book-data-CWCLCSUn.js → use-book-data-CV2dCLgr.js} +1 -1
  72. package/dist/assets/{appRoute-C7XNGt8B.js → utils-CFdPTF34.js} +1 -1
  73. package/dist/assets/{vendor-i18n-ByHglwq-.js → vendor-i18n-D2ce6sLS.js} +1 -1
  74. package/dist/assets/vendor-radix-B1fu-dZi.js +46 -0
  75. package/dist/assets/{vendor-sentry-C3ouQ5cr.js → vendor-sentry-BFtl-K03.js} +25 -25
  76. package/dist/index.html +5 -5
  77. package/package.json +4 -4
  78. package/dist/assets/CreateViewDialog-DTzKynzF.js +0 -1
  79. package/dist/assets/MarketplaceAccessDenied-Csr3Jh7C.js +0 -1
  80. package/dist/assets/MetadataInspector-C6pU5_lx.js +0 -1
  81. package/dist/assets/ObjectDataPage-BA93ldBf.js +0 -1
  82. package/dist/assets/PublicFormsPage-D5kg7qJa.js +0 -1
  83. package/dist/assets/RecordDetailView-F0k3QMTV.js +0 -9
  84. package/dist/assets/ReportDefaultInspector-CYCJDOVb.js +0 -3
  85. package/dist/assets/ReportView-Dtz9IJbH.js +0 -2
  86. package/dist/assets/SearchResultsPage-0pCQZ9_u.js +0 -1
  87. package/dist/assets/data-adapter-BR5P3Htq.js +0 -9
  88. package/dist/assets/framework-brxTxzwx.js +0 -8
  89. package/dist/assets/index-D3TWmLHH.css +0 -2
  90. package/dist/assets/mermaid-GHXKKRXX-btdeklf1.js +0 -1
  91. package/dist/assets/metadata-admin-Buf34qxl.js +0 -25
  92. package/dist/assets/plugin-charts-DqND8tT3.js +0 -7
  93. package/dist/assets/plugin-chatbot-DwbSyUax.js +0 -120
  94. package/dist/assets/plugin-grid-Dz4WW_sQ.js +0 -8
  95. package/dist/assets/plugin-kanban-fgScBnfP.js +0 -1
  96. package/dist/assets/plugin-view-BDYhOlHx.js +0 -1
  97. package/dist/assets/plugins-views-Dc4ARhcP.js +0 -4
  98. package/dist/assets/runtime-metadata-persistence-D1KKivGr.js +0 -1
  99. package/dist/assets/src-By-rFjBo.js +0 -1
  100. package/dist/assets/src-CRFYUj2Z.js +0 -19
  101. package/dist/assets/utils-Bxty7IIa.js +0 -1
  102. package/dist/assets/vendor-radix-CWCRv2pn.js +0 -46
@@ -1,4 +1,4 @@
1
- import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{r as n,y as r}from"./vendor-react-BKSb6vFP.js";import{$t as i,H as a,Nt as o,Qt as s,ct as c,et as l,on as u,rt as d}from"./framework-brxTxzwx.js";import{_ as f}from"./vendor-objectstack-CjHQG7Oa.js";import{Ba as p,Br as m,Cr as h,Er as g,Gs as _,Ic as ee,Ka as te,Ks as ne,L as re,Mc as v,Mr as y,Or as b,Pa as ie,Pc as ae,Sr as oe,Tr as x,Uc as S,Ws as se,Yi as ce,Yo as C,Yr as w,Zi as le,a as ue,as as de,ba as T,br as fe,c as pe,h as me,i as he,jc as E,jr as ge,l as _e,m as ve,o as ye,p as be,va as xe,wc as Se,wr as Ce,xr as we,yr as Te,zi as Ee}from"./ui-components-D1psd5qA.js";import{r as De}from"./vendor-ui-utils-D-WJ115h.js";import{o as Oe,s as ke}from"./plugins-views-Dc4ARhcP.js";var D=e(r(),1),O=1e3*60*60*24,k=e=>e.toISOString().slice(0,10);function A(e,t){if(t.skipWeekends){let t=e.getUTCDay();if(t===0||t===6)return!1}return!(t.holidays&&t.holidays.has(k(e)))}function j(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t}function Ae(e,t){let n=j(e);for(;!A(n,t);)n=new Date(n.getTime()+O);return n.getTime()}function je(e,t,n){if(t<=e)return 0;let r=0,i=j(e),a=j(t).getTime();for(;i.getTime()<a;)A(i,n)&&r++,i=new Date(i.getTime()+O);return r}function M(e,t,n){if(t<=0)return j(e).getTime();let r=j(e),i=t;for(;i>0;)A(r,n)&&i--,r=new Date(r.getTime()+O);return r.getTime()}function Me(e,t,n){if(t<=0)return j(e).getTime();let r=j(e),i=t;for(;i>0;)r=new Date(r.getTime()-O),A(r,n)&&i--;return r.getTime()}var N=e=>String(e);function Ne(e){return e===`ss`||e===`ff`||e===`sf`?e:`fs`}function Pe(e){let t=new Set(e.map(e=>N(e.id))),n=[];for(let r of e){let e=N(r.id);for(let i of r.dependencies??[]){let r=typeof i==`object`&&!!i,a=r?i.id:i;if(a==null||a===``)continue;let o=N(a);o===e||!t.has(o)||n.push({pred:o,succ:e,type:Ne(r?i.type:void 0)})}}return n}function Fe(e){let t=new Set;for(let n of e)n.parent!=null&&n.parent!==``&&t.add(N(n.parent));return t}function Ie(e,t){let n=new Map,r=new Map;for(let t of e)n.set(t,0),r.set(t,[]);for(let e of t)r.get(e.pred).push(e.succ),n.set(e.succ,(n.get(e.succ)??0)+1);let i=e.filter(e=>(n.get(e)??0)===0),a=[];for(;i.length;){let e=i.shift();a.push(e);for(let t of r.get(e)??[]){let e=(n.get(t)??0)-1;n.set(t,e),e===0&&i.push(t)}}if(a.length<e.length){let t=new Set(a);for(let n of e)t.has(n)||a.push(n);return{order:a,hasCycle:!0}}return{order:a,hasCycle:!1}}function Le(e,t){let n={criticalIds:new Set,criticalEdges:new Set};if(!e.length)return n;let r=new Map;for(let n of e){let e=t?je(n.start.getTime(),n.end.getTime(),t):(n.end.getTime()-n.start.getTime())/O;r.set(N(n.id),Number.isFinite(e)&&e>0?e:0)}let i=Pe(e),a=e.map(e=>N(e.id)),{order:o,hasCycle:s}=Ie(a,i);if(s)return n;let c=new Map,l=new Map;for(let e of a)c.set(e,[]),l.set(e,[]);for(let e of i)c.get(e.succ).push(e),l.get(e.pred).push(e);let u=new Map,d=new Map;for(let e of o){let t=0;for(let n of c.get(e)??[])t=Math.max(t,d.get(n.pred)??0);u.set(e,t),d.set(e,t+(r.get(e)??0))}let f=Math.max(0,...a.map(e=>d.get(e)??0)),p=new Map,m=new Map;for(let e=o.length-1;e>=0;e--){let t=o[e],n=l.get(t)??[],i=f;n.length&&(i=Math.min(...n.map(e=>m.get(e.succ)??f))),p.set(t,i),m.set(t,i-(r.get(t)??0))}let h=1e-6,g=new Set;for(let e of a){let t=(m.get(e)??0)-(u.get(e)??0);Math.abs(t)<=h&&g.add(e)}let _=new Set;for(let e of i)_.add(e.pred),_.add(e.succ);for(let e of[...g])!_.has(e)&&(r.get(e)??0)===0&&g.delete(e);let ee=new Set;for(let e of i)!g.has(e.pred)||!g.has(e.succ)||Math.abs((d.get(e.pred)??0)-(u.get(e.succ)??0))<=h&&ee.add(`${e.pred}->${e.succ}`);return{criticalIds:g,criticalEdges:ee}}function Re(e,t,n){if(!e.length)return{changes:[],skippedLocked:[]};let r=Pe(e),i=e.map(e=>N(e.id)),{order:a,hasCycle:o}=Ie(i,r);if(o)return{changes:[],skippedLocked:[]};let s=Fe(e),c=new Map;for(let t of e)c.set(N(t.id),t);let l=new Map;for(let t of e){if(t.parent==null||t.parent===``)continue;let e=N(t.parent),n=l.get(e)??[];n.push(t),l.set(e,n)}let u=n?.summaryExtent===`self`,d=e=>u&&e.hasOwnDates!==!1&&!e.locked,f=new Map;for(let e of i)f.set(e,[]);for(let e of r)f.get(e.succ).push(e);let p=new Map,m=new Map;for(let t of e)p.set(N(t.id),t.start.getTime()),m.set(N(t.id),t.end.getTime());let h=[];for(let e of a){let r=c.get(e);if(!r)continue;let i=t?je(p.get(e),m.get(e),t):m.get(e)-p.get(e),a=r.start.getTime(),o=a;for(let n of f.get(e)??[]){let e=p.get(n.pred),r=m.get(n.pred),a;switch(n.type){case`ss`:a=e;break;case`ff`:a=t?Me(r,i,t):r-i;break;case`sf`:a=t?Me(e,i,t):e-i;break;default:a=r;break}a>o&&(o=a)}let l=o>a;if(!(s.has(e)&&!d(r))){if(r.locked){l&&h.push(e);continue}if(l&&!t&&n?.snapStart&&(o=Math.max(o,n.snapStart(o))),t){let n=Ae(o,t);p.set(e,n),m.set(e,M(n,i,t))}else p.set(e,o),m.set(e,o+i)}}if(u)for(let t of e){let e=N(t.id);if(!s.has(e)||!d(t))continue;let n=p.get(e)-t.start.getTime();if(n<=0)continue;let r=[...l.get(e)??[]];for(;r.length;){let e=r.pop(),t=N(e.id);if(r.push(...l.get(t)??[]),e.locked)continue;let i=e.start.getTime()+n;if(i>p.get(t)){let e=m.get(t)-p.get(t);p.set(t,i),m.set(t,i+e)}}}let g=[];for(let t of e){let e=N(t.id),n=p.get(e),r=m.get(e);(n!==t.start.getTime()||r!==t.end.getTime())&&g.push({id:e,start:new Date(n),end:new Date(r)})}return{changes:g,skippedLocked:h}}function ze(e,t,n){let r=String(t),i=String(n);if(r===i)return!0;let a=new Map;for(let[t,n]of e){let e=a.get(t);e?e.push(n):a.set(t,[n])}let o=new Set([i]),s=[i];for(;s.length;){let e=s.pop();for(let t of a.get(e)??[]){if(t===r)return!0;o.has(t)||(o.add(t),s.push(t))}}return!1}var Be=6e4;1440*Be;var Ve=1440;function P(e){if(typeof e!=`string`)return null;let t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n<0||n>23||r<0||r>59?null:n*60+r}function He(e){if(!e||!Array.isArray(e.bands)||e.bands.length===0)return null;let t=P(e.dayStart)??0,n=[];for(let t=0;t<e.bands.length;t++){let r=e.bands[t],i=P(r.start),a=P(r.end);if(i==null||a==null||!r.label)return null;let o=(a-i+Ve)%Ve||Ve;n.push({key:r.key??`band${t}`,label:r.label,color:r.color,durMs:o*Be})}return{dayStartMin:t,bands:n,showMidnight:e.showMidnight!==!1}}function Ue(e,t){let n=new Date(e);return n.setHours(0,0,0,0),n.setMinutes(t),n.getTime()>e.getTime()&&n.setDate(n.getDate()-1),n}function We(e,t){if(t.bands.length===0)return null;let n=Ue(e,t.dayStartMin).getTime(),r=e.getTime()-n,i=0;for(let e of t.bands)if(i+=e.durMs,r<i)return e;return t.bands[t.bands.length-1]}var Ge={"gantt.column.taskName":`Task Name`,"gantt.column.start":`Start`,"gantt.column.end":`End`,"gantt.toolbar.prevPeriod":`Previous period`,"gantt.toolbar.nextPeriod":`Next period`,"gantt.toolbar.zoomIn":`Zoom in`,"gantt.toolbar.zoomOut":`Zoom out`,"gantt.toolbar.jumpToToday":`Jump to today`,"gantt.toolbar.today":`Today`,"gantt.toolbar.thisWeek":`This week`,"gantt.toolbar.thisMonth":`This month`,"gantt.toolbar.exportPdf":`Export PDF`,"gantt.toolbar.saveLayout":`Save layout`,"gantt.toolbar.showTaskList":`Show task list`,"gantt.toolbar.hideTaskList":`Hide task list`,"gantt.toolbar.viewMode":`Timeline granularity`,"gantt.toolbar.enterFullscreen":`Enter fullscreen`,"gantt.toolbar.exitFullscreen":`Exit fullscreen`,"gantt.toolbar.criticalPath":`Highlight critical path`,"gantt.toolbar.autoSchedule":`Auto-schedule dependencies`,"gantt.toolbar.exportPng":`Export as PNG`,"gantt.toolbar.refresh":`Refresh`,"gantt.toolbar.undo":`Undo`,"gantt.toolbar.redo":`Redo`,"gantt.viewMode.day":`Day`,"gantt.viewMode.week":`Week`,"gantt.viewMode.month":`Month`,"gantt.viewMode.quarter":`Quarter`,"gantt.viewMode.year":`Year`,"gantt.row.expand":`Expand`,"gantt.row.collapse":`Collapse`,"gantt.row.open":`Open details`,"gantt.aria.taskList":`Task list`,"gantt.tooltip.days":`d`,"gantt.menu.view":`View details`,"gantt.menu.edit":`Edit inline`,"gantt.menu.delete":`Delete`,"gantt.menu.addPredecessor":`Add predecessor…`,"gantt.menu.addSuccessor":`Add successor…`,"gantt.menu.removeDependency":`Remove dependency`,"gantt.menu.noCandidates":`No available tasks`,"gantt.menu.searchTasks":`Search tasks…`,"gantt.delete.title":`Delete this task?`,"gantt.delete.body":`"{{title}}" will be permanently removed. This action cannot be undone.`,"gantt.delete.cancel":`Cancel`,"gantt.delete.confirm":`Delete`,"gantt.delete.deleting":`Deleting…`,"gantt.drawer.fallbackTitle":`Task Details`,"gantt.linkType.fs":`Finish → Start`,"gantt.linkType.ss":`Start → Start`,"gantt.linkType.ff":`Finish → Finish`,"gantt.linkType.sf":`Start → Finish`,"gantt.linkEnd.start":`start`,"gantt.linkEnd.end":`end`,"gantt.conflict.title":`Schedule conflict`,"gantt.conflict.body":`This move conflicts with dependency constraints. Auto-reschedule {count} affected task(s)?`,"gantt.conflict.confirm":`Auto-reschedule`,"gantt.conflict.cancel":`Keep as is`,"gantt.autoScheduleDlg.title":`Auto-schedule`,"gantt.autoScheduleDlg.body":`Shift {count} task(s) later to satisfy dependency links?`,"gantt.autoScheduleDlg.skipped":`{count} locked task(s) also violate links and were skipped.`,"gantt.autoScheduleDlg.confirm":`Apply`,"gantt.autoScheduleDlg.cancel":`Cancel`,"gantt.autoScheduleDlg.none":`All dependencies satisfied — nothing to reschedule.`,"gantt.resource.header":`Resource`,"gantt.resource.peak":`Peak`,"gantt.resource.over":`overloaded`,"gantt.resource.empty":`No tasks to allocate.`,"gantt.readOnly":`Read-only`,"gantt.readOnlyHint":`Editing is disabled for this view.`,"gantt.lockedHint":`No edit permission`,"gantt.writeFailed":`Save failed — the change was rolled back`};function Ke(e,t){let n=Ge[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n}function qe(){try{let e=S();return{t:(t,n)=>{let r=e.t(t,n);return typeof r==`string`&&r!==t?r:Ke(t,n)},language:e.language}}catch{return{t:Ke,language:void 0}}}var F=n(),Je=8;function Ye(e,t){if(t.width<=0)return`move`;let n=Math.min(Je,t.width/3),r=e-t.left;return r<=n?`resize-left`:r>=t.width-n?`resize-right`:`move`}function Xe(e){return 110}function Ze(e){return e<640?140:e<1024?220:320}function Qe(e){return e>=280}function $e(e){return e<640?32:40}var et=[`day`,`week`,`month`,`quarter`,`year`],tt={day:1,week:7,month:30.44,quarter:91.31,year:365.25},nt=1e3*60*60*24;function I(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=e=>Number(n.formatToParts(t).find(t=>t.type===e)?.value??0);return Date.UTC(r(`year`),r(`month`)-1,r(`day`),r(`hour`)%24,r(`minute`),r(`second`))-Math.floor(t.getTime()/1e3)*1e3}function rt(e){let t={delta:0,to:e=>e,from:e=>e,now:()=>new Date};if(!e)return t;try{I(e,new Date)}catch{return console.warn(`[GanttView] invalid timeZone "${e}" — falling back to the browser zone`),t}let n=t=>I(e,t)- -t.getTimezoneOffset()*6e4,r=n(new Date);return r===0?t:{delta:r,to:e=>new Date(e.getTime()+n(e)),from:e=>new Date(e.getTime()-n(e)),now:()=>new Date(Date.now()+n(new Date))}}function L(e,t){let n=new Date(e);return n.setHours(0,0,0,0),t===`week`?n.setDate(n.getDate()-(n.getDay()+6)%7):t===`month`?n.setDate(1):t===`quarter`?n.setMonth(Math.floor(n.getMonth()/3)*3,1):t===`year`&&n.setMonth(0,1),n}function it(e,t,n){let r=e.length-1,i=0;for(;i<r&&e[i+1]<t;)i++;let a=i;for(;a<r&&e[a]<n;)a++;return{start:i,end:a}}function at(e,t,n){let r=new Date(e);if(n===`day`)r.setDate(r.getDate()+t);else if(n===`week`)r.setDate(r.getDate()+t*7);else{let e=t*(n===`month`?1:n===`quarter`?3:12),i=r.getDate();r.setDate(1),r.setMonth(r.getMonth()+e);let a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();r.setDate(Math.min(i,a))}return r}function ot(e,t,n,r=2){return new Promise(i=>{let a=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),o=URL.createObjectURL(a),s=new Image;s.onload=()=>{let e=document.createElement(`canvas`);e.width=t*r,e.height=n*r;let a=e.getContext(`2d`);a&&(a.fillStyle=`#ffffff`,a.fillRect(0,0,e.width,e.height),a.scale(r,r),a.drawImage(s,0,0)),URL.revokeObjectURL(o),i(e)},s.onerror=()=>{URL.revokeObjectURL(o),i(null)},s.src=o})}function st(e,t){let n=document.createElement(`a`);n.href=URL.createObjectURL(e),n.download=t,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(n.href),1e3)}function ct(e,t,n){let r=e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t},i=`q ${t} 0 0 ${n} 0 0 cm /Im0 Do Q`,a=[],o=[],s=0,c=e=>{a.push(e),s+=e.length},l=()=>{o.push(s)};c(r(`%PDF-1.3
1
+ import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{r as n,y as r}from"./vendor-react-BKSb6vFP.js";import{$t as i,H as a,Nt as o,Qt as s,ct as c,et as l,on as u,rt as d}from"./framework-BqSgd3ir.js";import{_ as f}from"./vendor-objectstack-CjHQG7Oa.js";import{Ba as p,Br as m,Cr as h,Er as g,Gs as _,Ic as ee,Ka as te,Ks as ne,L as re,Mc as v,Mr as y,Or as b,Pa as ie,Pc as ae,Sr as oe,Tr as x,Uc as S,Ws as se,Yi as ce,Yo as C,Yr as w,Zi as le,a as ue,as as de,ba as T,br as fe,c as pe,h as me,i as he,jc as E,jr as ge,l as _e,m as ve,o as ye,p as be,va as xe,wc as Se,wr as Ce,xr as we,yr as Te,zi as Ee}from"./ui-components-Ci5ufF7g.js";import{r as De}from"./vendor-ui-utils-D-WJ115h.js";import{o as Oe,s as ke}from"./plugins-views-BGSw-KmQ.js";var D=e(r(),1),O=1e3*60*60*24,k=e=>e.toISOString().slice(0,10);function A(e,t){if(t.skipWeekends){let t=e.getUTCDay();if(t===0||t===6)return!1}return!(t.holidays&&t.holidays.has(k(e)))}function j(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t}function Ae(e,t){let n=j(e);for(;!A(n,t);)n=new Date(n.getTime()+O);return n.getTime()}function je(e,t,n){if(t<=e)return 0;let r=0,i=j(e),a=j(t).getTime();for(;i.getTime()<a;)A(i,n)&&r++,i=new Date(i.getTime()+O);return r}function M(e,t,n){if(t<=0)return j(e).getTime();let r=j(e),i=t;for(;i>0;)A(r,n)&&i--,r=new Date(r.getTime()+O);return r.getTime()}function Me(e,t,n){if(t<=0)return j(e).getTime();let r=j(e),i=t;for(;i>0;)r=new Date(r.getTime()-O),A(r,n)&&i--;return r.getTime()}var N=e=>String(e);function Ne(e){return e===`ss`||e===`ff`||e===`sf`?e:`fs`}function Pe(e){let t=new Set(e.map(e=>N(e.id))),n=[];for(let r of e){let e=N(r.id);for(let i of r.dependencies??[]){let r=typeof i==`object`&&!!i,a=r?i.id:i;if(a==null||a===``)continue;let o=N(a);o===e||!t.has(o)||n.push({pred:o,succ:e,type:Ne(r?i.type:void 0)})}}return n}function Fe(e){let t=new Set;for(let n of e)n.parent!=null&&n.parent!==``&&t.add(N(n.parent));return t}function Ie(e,t){let n=new Map,r=new Map;for(let t of e)n.set(t,0),r.set(t,[]);for(let e of t)r.get(e.pred).push(e.succ),n.set(e.succ,(n.get(e.succ)??0)+1);let i=e.filter(e=>(n.get(e)??0)===0),a=[];for(;i.length;){let e=i.shift();a.push(e);for(let t of r.get(e)??[]){let e=(n.get(t)??0)-1;n.set(t,e),e===0&&i.push(t)}}if(a.length<e.length){let t=new Set(a);for(let n of e)t.has(n)||a.push(n);return{order:a,hasCycle:!0}}return{order:a,hasCycle:!1}}function Le(e,t){let n={criticalIds:new Set,criticalEdges:new Set};if(!e.length)return n;let r=new Map;for(let n of e){let e=t?je(n.start.getTime(),n.end.getTime(),t):(n.end.getTime()-n.start.getTime())/O;r.set(N(n.id),Number.isFinite(e)&&e>0?e:0)}let i=Pe(e),a=e.map(e=>N(e.id)),{order:o,hasCycle:s}=Ie(a,i);if(s)return n;let c=new Map,l=new Map;for(let e of a)c.set(e,[]),l.set(e,[]);for(let e of i)c.get(e.succ).push(e),l.get(e.pred).push(e);let u=new Map,d=new Map;for(let e of o){let t=0;for(let n of c.get(e)??[])t=Math.max(t,d.get(n.pred)??0);u.set(e,t),d.set(e,t+(r.get(e)??0))}let f=Math.max(0,...a.map(e=>d.get(e)??0)),p=new Map,m=new Map;for(let e=o.length-1;e>=0;e--){let t=o[e],n=l.get(t)??[],i=f;n.length&&(i=Math.min(...n.map(e=>m.get(e.succ)??f))),p.set(t,i),m.set(t,i-(r.get(t)??0))}let h=1e-6,g=new Set;for(let e of a){let t=(m.get(e)??0)-(u.get(e)??0);Math.abs(t)<=h&&g.add(e)}let _=new Set;for(let e of i)_.add(e.pred),_.add(e.succ);for(let e of[...g])!_.has(e)&&(r.get(e)??0)===0&&g.delete(e);let ee=new Set;for(let e of i)!g.has(e.pred)||!g.has(e.succ)||Math.abs((d.get(e.pred)??0)-(u.get(e.succ)??0))<=h&&ee.add(`${e.pred}->${e.succ}`);return{criticalIds:g,criticalEdges:ee}}function Re(e,t,n){if(!e.length)return{changes:[],skippedLocked:[]};let r=Pe(e),i=e.map(e=>N(e.id)),{order:a,hasCycle:o}=Ie(i,r);if(o)return{changes:[],skippedLocked:[]};let s=Fe(e),c=new Map;for(let t of e)c.set(N(t.id),t);let l=new Map;for(let t of e){if(t.parent==null||t.parent===``)continue;let e=N(t.parent),n=l.get(e)??[];n.push(t),l.set(e,n)}let u=n?.summaryExtent===`self`,d=e=>u&&e.hasOwnDates!==!1&&!e.locked,f=new Map;for(let e of i)f.set(e,[]);for(let e of r)f.get(e.succ).push(e);let p=new Map,m=new Map;for(let t of e)p.set(N(t.id),t.start.getTime()),m.set(N(t.id),t.end.getTime());let h=[];for(let e of a){let r=c.get(e);if(!r)continue;let i=t?je(p.get(e),m.get(e),t):m.get(e)-p.get(e),a=r.start.getTime(),o=a;for(let n of f.get(e)??[]){let e=p.get(n.pred),r=m.get(n.pred),a;switch(n.type){case`ss`:a=e;break;case`ff`:a=t?Me(r,i,t):r-i;break;case`sf`:a=t?Me(e,i,t):e-i;break;default:a=r;break}a>o&&(o=a)}let l=o>a;if(!(s.has(e)&&!d(r))){if(r.locked){l&&h.push(e);continue}if(l&&!t&&n?.snapStart&&(o=Math.max(o,n.snapStart(o))),t){let n=Ae(o,t);p.set(e,n),m.set(e,M(n,i,t))}else p.set(e,o),m.set(e,o+i)}}if(u)for(let t of e){let e=N(t.id);if(!s.has(e)||!d(t))continue;let n=p.get(e)-t.start.getTime();if(n<=0)continue;let r=[...l.get(e)??[]];for(;r.length;){let e=r.pop(),t=N(e.id);if(r.push(...l.get(t)??[]),e.locked)continue;let i=e.start.getTime()+n;if(i>p.get(t)){let e=m.get(t)-p.get(t);p.set(t,i),m.set(t,i+e)}}}let g=[];for(let t of e){let e=N(t.id),n=p.get(e),r=m.get(e);(n!==t.start.getTime()||r!==t.end.getTime())&&g.push({id:e,start:new Date(n),end:new Date(r)})}return{changes:g,skippedLocked:h}}function ze(e,t,n){let r=String(t),i=String(n);if(r===i)return!0;let a=new Map;for(let[t,n]of e){let e=a.get(t);e?e.push(n):a.set(t,[n])}let o=new Set([i]),s=[i];for(;s.length;){let e=s.pop();for(let t of a.get(e)??[]){if(t===r)return!0;o.has(t)||(o.add(t),s.push(t))}}return!1}var Be=6e4;1440*Be;var Ve=1440;function P(e){if(typeof e!=`string`)return null;let t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n<0||n>23||r<0||r>59?null:n*60+r}function He(e){if(!e||!Array.isArray(e.bands)||e.bands.length===0)return null;let t=P(e.dayStart)??0,n=[];for(let t=0;t<e.bands.length;t++){let r=e.bands[t],i=P(r.start),a=P(r.end);if(i==null||a==null||!r.label)return null;let o=(a-i+Ve)%Ve||Ve;n.push({key:r.key??`band${t}`,label:r.label,color:r.color,durMs:o*Be})}return{dayStartMin:t,bands:n,showMidnight:e.showMidnight!==!1}}function Ue(e,t){let n=new Date(e);return n.setHours(0,0,0,0),n.setMinutes(t),n.getTime()>e.getTime()&&n.setDate(n.getDate()-1),n}function We(e,t){if(t.bands.length===0)return null;let n=Ue(e,t.dayStartMin).getTime(),r=e.getTime()-n,i=0;for(let e of t.bands)if(i+=e.durMs,r<i)return e;return t.bands[t.bands.length-1]}var Ge={"gantt.column.taskName":`Task Name`,"gantt.column.start":`Start`,"gantt.column.end":`End`,"gantt.toolbar.prevPeriod":`Previous period`,"gantt.toolbar.nextPeriod":`Next period`,"gantt.toolbar.zoomIn":`Zoom in`,"gantt.toolbar.zoomOut":`Zoom out`,"gantt.toolbar.jumpToToday":`Jump to today`,"gantt.toolbar.today":`Today`,"gantt.toolbar.thisWeek":`This week`,"gantt.toolbar.thisMonth":`This month`,"gantt.toolbar.exportPdf":`Export PDF`,"gantt.toolbar.saveLayout":`Save layout`,"gantt.toolbar.showTaskList":`Show task list`,"gantt.toolbar.hideTaskList":`Hide task list`,"gantt.toolbar.viewMode":`Timeline granularity`,"gantt.toolbar.enterFullscreen":`Enter fullscreen`,"gantt.toolbar.exitFullscreen":`Exit fullscreen`,"gantt.toolbar.criticalPath":`Highlight critical path`,"gantt.toolbar.autoSchedule":`Auto-schedule dependencies`,"gantt.toolbar.exportPng":`Export as PNG`,"gantt.toolbar.refresh":`Refresh`,"gantt.toolbar.undo":`Undo`,"gantt.toolbar.redo":`Redo`,"gantt.viewMode.day":`Day`,"gantt.viewMode.week":`Week`,"gantt.viewMode.month":`Month`,"gantt.viewMode.quarter":`Quarter`,"gantt.viewMode.year":`Year`,"gantt.row.expand":`Expand`,"gantt.row.collapse":`Collapse`,"gantt.row.open":`Open details`,"gantt.aria.taskList":`Task list`,"gantt.tooltip.days":`d`,"gantt.menu.view":`View details`,"gantt.menu.edit":`Edit inline`,"gantt.menu.delete":`Delete`,"gantt.menu.addPredecessor":`Add predecessor…`,"gantt.menu.addSuccessor":`Add successor…`,"gantt.menu.removeDependency":`Remove dependency`,"gantt.menu.noCandidates":`No available tasks`,"gantt.menu.searchTasks":`Search tasks…`,"gantt.delete.title":`Delete this task?`,"gantt.delete.body":`"{{title}}" will be permanently removed. This action cannot be undone.`,"gantt.delete.cancel":`Cancel`,"gantt.delete.confirm":`Delete`,"gantt.delete.deleting":`Deleting…`,"gantt.drawer.fallbackTitle":`Task Details`,"gantt.linkType.fs":`Finish → Start`,"gantt.linkType.ss":`Start → Start`,"gantt.linkType.ff":`Finish → Finish`,"gantt.linkType.sf":`Start → Finish`,"gantt.linkEnd.start":`start`,"gantt.linkEnd.end":`end`,"gantt.conflict.title":`Schedule conflict`,"gantt.conflict.body":`This move conflicts with dependency constraints. Auto-reschedule {count} affected task(s)?`,"gantt.conflict.confirm":`Auto-reschedule`,"gantt.conflict.cancel":`Keep as is`,"gantt.autoScheduleDlg.title":`Auto-schedule`,"gantt.autoScheduleDlg.body":`Shift {count} task(s) later to satisfy dependency links?`,"gantt.autoScheduleDlg.skipped":`{count} locked task(s) also violate links and were skipped.`,"gantt.autoScheduleDlg.confirm":`Apply`,"gantt.autoScheduleDlg.cancel":`Cancel`,"gantt.autoScheduleDlg.none":`All dependencies satisfied — nothing to reschedule.`,"gantt.resource.header":`Resource`,"gantt.resource.peak":`Peak`,"gantt.resource.over":`overloaded`,"gantt.resource.empty":`No tasks to allocate.`,"gantt.readOnly":`Read-only`,"gantt.readOnlyHint":`Editing is disabled for this view.`,"gantt.lockedHint":`No edit permission`,"gantt.writeFailed":`Save failed — the change was rolled back`};function Ke(e,t){let n=Ge[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n}function qe(){try{let e=S();return{t:(t,n)=>{let r=e.t(t,n);return typeof r==`string`&&r!==t?r:Ke(t,n)},language:e.language}}catch{return{t:Ke,language:void 0}}}var F=n(),Je=8;function Ye(e,t){if(t.width<=0)return`move`;let n=Math.min(Je,t.width/3),r=e-t.left;return r<=n?`resize-left`:r>=t.width-n?`resize-right`:`move`}function Xe(e){return 110}function Ze(e){return e<640?140:e<1024?220:320}function Qe(e){return e>=280}function $e(e){return e<640?32:40}var et=[`day`,`week`,`month`,`quarter`,`year`],tt={day:1,week:7,month:30.44,quarter:91.31,year:365.25},nt=1e3*60*60*24;function I(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour12:!1,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}),r=e=>Number(n.formatToParts(t).find(t=>t.type===e)?.value??0);return Date.UTC(r(`year`),r(`month`)-1,r(`day`),r(`hour`)%24,r(`minute`),r(`second`))-Math.floor(t.getTime()/1e3)*1e3}function rt(e){let t={delta:0,to:e=>e,from:e=>e,now:()=>new Date};if(!e)return t;try{I(e,new Date)}catch{return console.warn(`[GanttView] invalid timeZone "${e}" — falling back to the browser zone`),t}let n=t=>I(e,t)- -t.getTimezoneOffset()*6e4,r=n(new Date);return r===0?t:{delta:r,to:e=>new Date(e.getTime()+n(e)),from:e=>new Date(e.getTime()-n(e)),now:()=>new Date(Date.now()+n(new Date))}}function L(e,t){let n=new Date(e);return n.setHours(0,0,0,0),t===`week`?n.setDate(n.getDate()-(n.getDay()+6)%7):t===`month`?n.setDate(1):t===`quarter`?n.setMonth(Math.floor(n.getMonth()/3)*3,1):t===`year`&&n.setMonth(0,1),n}function it(e,t,n){let r=e.length-1,i=0;for(;i<r&&e[i+1]<t;)i++;let a=i;for(;a<r&&e[a]<n;)a++;return{start:i,end:a}}function at(e,t,n){let r=new Date(e);if(n===`day`)r.setDate(r.getDate()+t);else if(n===`week`)r.setDate(r.getDate()+t*7);else{let e=t*(n===`month`?1:n===`quarter`?3:12),i=r.getDate();r.setDate(1),r.setMonth(r.getMonth()+e);let a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();r.setDate(Math.min(i,a))}return r}function ot(e,t,n,r=2){return new Promise(i=>{let a=new Blob([e],{type:`image/svg+xml;charset=utf-8`}),o=URL.createObjectURL(a),s=new Image;s.onload=()=>{let e=document.createElement(`canvas`);e.width=t*r,e.height=n*r;let a=e.getContext(`2d`);a&&(a.fillStyle=`#ffffff`,a.fillRect(0,0,e.width,e.height),a.scale(r,r),a.drawImage(s,0,0)),URL.revokeObjectURL(o),i(e)},s.onerror=()=>{URL.revokeObjectURL(o),i(null)},s.src=o})}function st(e,t){let n=document.createElement(`a`);n.href=URL.createObjectURL(e),n.download=t,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(n.href),1e3)}function ct(e,t,n){let r=e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return t},i=`q ${t} 0 0 ${n} 0 0 cm /Im0 Do Q`,a=[],o=[],s=0,c=e=>{a.push(e),s+=e.length},l=()=>{o.push(s)};c(r(`%PDF-1.3
2
2
  %ÿÿÿÿ
3
3
  `)),l(),c(r(`1 0 obj
4
4
  << /Type /Catalog /Pages 2 0 R >>
@@ -60,4 +60,4 @@ endobj
60
60
  bar. Hide it — the pane stays wheel/drag-scrollable and synced. */
61
61
  .gantt-task-list::-webkit-scrollbar { width: 0; height: 0; }
62
62
  .gantt-task-list { scrollbar-width: none; }
63
- `}),(0,F.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 p-2 border-b bg-card`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":M(`gantt.toolbar.prevPeriod`),children:(0,F.jsx)(ne,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":M(`gantt.toolbar.nextPeriod`),children:(0,F.jsx)(se,{className:`h-4 w-4`})}),(0,F.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:q.start.toLocaleDateString(N,{month:`long`,year:`numeric`})}),P&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,"data-testid":`gantt-readonly-badge`,title:M(`gantt.readOnlyHint`),children:[(0,F.jsx)(te,{className:`h-3 w-3`}),M(`gantt.readOnly`)]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex bg-muted rounded-md p-1`,role:`group`,"aria-label":M(`gantt.toolbar.viewMode`),children:et.map(e=>(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:v(`h-6 px-1.5 sm:px-2 text-xs`,B===e&&`bg-background shadow-sm hover:bg-background`),onClick:()=>Xn(e),"aria-pressed":B===e,"data-testid":`gantt-view-mode-${e}`,children:M(`gantt.viewMode.${e}`)},e))}),(0,F.jsxs)(`div`,{className:`flex bg-muted rounded-md p-1`,children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{if(H>15)St(Math.max(15,H-10));else{let e=et.indexOf(B);e<et.length-1&&(Xn(et[e+1]),St(vt))}},"aria-label":M(`gantt.toolbar.zoomOut`),children:(0,F.jsx)(ge,{className:`h-3 w-3`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{if(H<120)St(Math.min(120,H+10));else{let e=et.indexOf(B);e>0&&(Xn(et[e-1]),St(vt))}},"aria-label":M(`gantt.toolbar.zoomIn`),children:(0,F.jsx)(y,{className:`h-3 w-3`})})]}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>At(e=>!e),"aria-label":M(kt?`gantt.toolbar.showTaskList`:`gantt.toolbar.hideTaskList`),"aria-pressed":kt,"data-testid":`gantt-toggle-task-list`,children:kt?(0,F.jsx)(xe,{className:`h-4 w-4`}):(0,F.jsx)(T,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:Tr,disabled:wr==null,"aria-label":M(`gantt.toolbar.jumpToToday`),"data-testid":`gantt-jump-today`,children:M(`gantt.toolbar.today`)}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:kr,"aria-label":M(`gantt.toolbar.thisWeek`),"data-testid":`gantt-jump-week`,children:M(`gantt.toolbar.thisWeek`)}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:Ar,"aria-label":M(`gantt.toolbar.thisMonth`),"data-testid":`gantt-jump-month`,children:M(`gantt.toolbar.thisMonth`)}),Ce?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>void Ce(),disabled:we,"aria-label":M(`gantt.toolbar.refresh`),"aria-busy":we,"data-testid":`gantt-refresh`,children:(0,F.jsx)(ce,{className:`h-4 w-4`})}):null,I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:ln,disabled:!dn,"aria-label":M(`gantt.toolbar.undo`),"data-testid":`gantt-undo`,children:(0,F.jsx)(w,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:un,disabled:!fn,"aria-label":M(`gantt.toolbar.redo`),"data-testid":`gantt-redo`,children:(0,F.jsx)(le,{className:`h-4 w-4`})})]}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>fi(e=>!e),"aria-label":M(`gantt.toolbar.criticalPath`),"aria-pressed":di,"data-testid":`gantt-critical-path`,style:di?{color:$}:void 0,children:(0,F.jsx)(E,{className:`h-4 w-4`})}),gt&&I?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:yi,"aria-label":M(`gantt.toolbar.autoSchedule`),"data-testid":`gantt-auto-schedule`,children:(0,F.jsx)(m,{className:`h-4 w-4`})}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:Ci,"aria-label":M(`gantt.toolbar.exportPng`),"data-testid":`gantt-export-png`,children:(0,F.jsx)(de,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:wi,"aria-label":M(`gantt.toolbar.exportPdf`),"data-testid":`gantt-export-pdf`,children:(0,F.jsx)(C,{className:`h-4 w-4`})}),be||ye?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:Di,"aria-label":M(`gantt.toolbar.saveLayout`),"aria-pressed":Ti,"data-testid":`gantt-save-layout`,style:Ti?{color:$}:void 0,children:(0,F.jsx)(Ee,{className:`h-4 w-4`})}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:yr,"aria-label":M(_r?`gantt.toolbar.exitFullscreen`:`gantt.toolbar.enterFullscreen`),"aria-pressed":_r,"data-testid":`gantt-fullscreen`,children:_r?(0,F.jsx)(ie,{className:`h-4 w-4`}):(0,F.jsx)(p,{className:`h-4 w-4`})})]})]}),(0,F.jsxs)(`div`,{className:`relative flex flex-col flex-1 overflow-hidden outline-none focus-visible:ring-1 focus-visible:ring-ring`,tabIndex:0,onKeyDown:Hn,"data-testid":`gantt-body`,children:[!kt&&V>0&&(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 z-30 group/splitter`,style:{left:V-3,width:7,cursor:`col-resize`},"data-testid":`gantt-list-resize`,role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=V,r=Math.max(160,Be-200),i=e=>{let i=Math.max(160,Math.min(n+(e.clientX-t),r));wt(i)},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),document.body.style.cursor=``};document.body.style.cursor=`col-resize`,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},onDoubleClick:()=>wt(null),children:(0,F.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border group-hover/splitter:w-[3px] group-hover/splitter:bg-primary transition-all`})}),(0,F.jsxs)(`div`,{className:`flex border-b bg-muted/30 shrink-0 h-10 gantt-sm-h50`,children:[(0,F.jsxs)(`div`,{className:`flex items-center font-medium text-xs text-muted-foreground px-2 sm:px-4 border-r bg-card z-20 shadow-sm`,style:{width:V,minWidth:V},children:[(0,F.jsx)(`div`,{className:`flex-1 truncate`,children:M(`gantt.column.taskName`)}),Ft&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right`,children:M(`gantt.column.start`)}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right`,children:M(`gantt.column.end`)})]}),a&&(0,F.jsx)(`div`,{className:`w-6 shrink-0 hidden sm:block`,style:{marginLeft:4},"aria-hidden":`true`,"data-testid":`gantt-header-open-spacer`})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-hidden`,ref:tr,children:(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,style:{width:Kn},children:[(0,F.jsx)(`div`,{className:`relative border-b`,style:{height:`45%`},"data-testid":`gantt-header-groups`,children:$n.slice(hr.start,hr.end).map(e=>(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 flex items-center justify-center border-r text-[10px] font-medium text-muted-foreground overflow-hidden`,style:{left:e.offset,width:e.width},children:(0,F.jsx)(`span`,{className:`truncate px-1`,children:e.label})},e.key))}),(0,F.jsx)(`div`,{className:`relative flex-1`,"data-testid":`gantt-header-units`,children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t;return(0,F.jsxs)(`div`,{className:v(`absolute top-0 bottom-0 flex items-center justify-center gap-1 border-r text-xs text-muted-foreground overflow-hidden`,e.isWeekend&&`bg-muted/50`),style:{left:Y[n],width:e.width,backgroundColor:e.bandColor?`color-mix(in srgb, ${e.bandColor} 16%, transparent)`:void 0},children:[(0,F.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:e.label}),e.sublabel&&H>=32&&(0,F.jsx)(`span`,{className:`text-[10px] opacity-70`,children:e.sublabel})]},n)})})]})})]}),(0,F.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`gantt-task-list overflow-y-auto overflow-x-hidden border-r bg-card z-10 shadow-sm`,ref:nr,onScroll:Gr,style:{width:V,minWidth:V},role:`tree`,"aria-label":M(`gantt.aria.taskList`),children:[Q.startIdx>0&&(0,F.jsx)(`div`,{style:{height:Q.startIdx*z},"aria-hidden":`true`}),K.slice(Q.startIdx,Q.endIdx).map(e=>{let t=e.task,n=ht&&It===t.id,r=Rn.has(String(t.id)),i=Nn!=null&&String(Nn)===String(t.id);return(0,F.jsxs)(`div`,{className:v(`group/task-row relative flex items-center border-b px-2 sm:px-4 hover:bg-accent/50 cursor-pointer transition-colors`,i&&`bg-accent/50`),style:{height:z,touchAction:`manipulation`},role:`treeitem`,"data-testid":`gantt-task-row-${t.id}`,"aria-level":e.depth+1,"aria-selected":i,"aria-expanded":e.hasChildren?!r:void 0,draggable:!!mt&&!n&&!t.locked,onDragStart:mt?e=>{e.dataTransfer.setData(`text/plain`,String(t.id)),e.dataTransfer.effectAllowed=`move`}:void 0,onDragOver:mt?e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`}:void 0,onDrop:mt?e=>{e.preventDefault();let n=e.dataTransfer.getData(`text/plain`);if(!n||n===String(t.id))return;let r=Ut.get(n);r&&String(r.parent??``)===String(t.parent??``)&&mt(r,t)}:void 0,onContextMenu:e=>In(t,e),onClick:()=>{Pn(t.id),n||Or(e.start,e.end,t.id)},onDoubleClick:()=>{n||(ht&&I&&!e.isSummary&&!t.locked?(Lt(t.id),zt({title:t.title,start:t.start.toLocaleDateString(`en-CA`),end:t.end.toLocaleDateString(`en-CA`),progress:String(t.progress)})):a?.(t))},children:[(0,F.jsxs)(`div`,{className:`flex-1 truncate font-medium text-xs sm:text-sm flex items-center gap-2`,style:e.depth>0?{paddingLeft:e.depth*14}:void 0,children:[e.hasChildren?(0,F.jsx)(`button`,{type:`button`,className:`h-4 w-4 shrink-0 flex items-center justify-center text-muted-foreground hover:text-foreground`,style:{marginLeft:-4},onClick:e=>{e.stopPropagation(),Bn(t.id)},"aria-expanded":!r,"aria-label":M(r?`gantt.row.expand`:`gantt.row.collapse`),"data-testid":`gantt-row-toggle-${t.id}`,children:r?(0,F.jsx)(se,{className:`h-3.5 w-3.5`}):(0,F.jsx)(_,{className:`h-3.5 w-3.5`})}):(0,F.jsx)(`span`,{className:`w-3 shrink-0`,style:{marginLeft:-4},"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`w-2 h-2 rounded-full shrink-0`,style:{backgroundColor:t.color||`#3b82f6`}}),n?(0,F.jsx)(`input`,{className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.title||``,onChange:e=>zt(t=>({...t,title:e.target.value})),onKeyDown:e=>{e.key===`Enter`?(en([{task:t,changes:{title:Rt.title,start:new Date(Rt.start),end:new Date(Rt.end),progress:Number(Rt.progress)||0}}]),Lt(null)):e.key===`Escape`&&Lt(null)},onClick:e=>e.stopPropagation(),autoFocus:!0}):(0,F.jsxs)(`span`,{className:`flex flex-col min-w-0`,children:[(0,F.jsx)(`span`,{className:v(`truncate`,e.isSummary&&`font-semibold`),children:t.title}),(0,F.jsxs)(`span`,{className:`text-[10px] text-muted-foreground gantt-sm-hidden`,children:[e.start.toLocaleDateString(N,{month:`numeric`,day:`numeric`}),` → `,e.end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})]})]})]}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block`,hidden:!Ft,style:Ft?void 0:{display:`none`},children:n?(0,F.jsx)(`input`,{type:`date`,className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.start||``,onChange:e=>zt(t=>({...t,start:e.target.value})),onClick:e=>e.stopPropagation()}):e.start.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block`,hidden:!Ft,style:Ft?void 0:{display:`none`},children:n?(0,F.jsx)(`input`,{type:`date`,className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.end||``,onChange:e=>zt(t=>({...t,end:e.target.value})),onClick:e=>e.stopPropagation()}):e.end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}),a&&(0,F.jsx)(`div`,{className:`w-6 shrink-0 hidden sm:block`,style:{marginLeft:4},children:!n&&(0,F.jsx)(`button`,{type:`button`,title:M(`gantt.row.open`),"aria-label":M(`gantt.row.open`),"data-testid":`gantt-row-open-${t.id}`,className:`gantt-row-open-btn h-6 w-6 rounded-md flex items-center justify-center hover:bg-accent text-muted-foreground hover:text-foreground`,onClick:e=>{e.stopPropagation(),a(t)},children:(0,F.jsx)(Se,{className:`h-3.5 w-3.5`})})})]},t.id)}),Q.endIdx<K.length&&(0,F.jsx)(`div`,{style:{height:(K.length-Q.endIdx)*z},"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-auto bg-background/50 relative [-webkit-overflow-scrolling:touch]`,ref:e=>{rr.current=e,Z.current=e},onScroll:Wr,onTouchStart:xr,onTouchMove:Sr,onTouchEnd:Cr,"data-testid":`gantt-timeline`,children:(0,F.jsxs)(`div`,{className:`relative`,style:{width:Kn},children:[wr!=null&&(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px z-20 pointer-events-none`,style:{left:wr,backgroundColor:`rgba(239, 68, 68, 0.8)`},"data-testid":`gantt-today-marker`,"aria-label":M(`gantt.toolbar.today`),children:(0,F.jsx)(`div`,{className:`absolute -translate-x-1/2 left-0 text-[10px] font-semibold text-white rounded-sm px-1 py-0.5 whitespace-nowrap z-30`,style:{top:2,backgroundColor:`#ef4444`},children:M(`gantt.toolbar.today`)})}),er.map(e=>(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px z-20 pointer-events-none`,style:{left:e.left,backgroundColor:e.color},"data-testid":`gantt-marker-${e.index}`,"aria-label":e.label,children:e.label&&(0,F.jsx)(`div`,{className:`absolute -translate-x-1/2 left-0 text-[10px] font-semibold text-white rounded-sm px-1 py-0.5 whitespace-nowrap z-30`,style:{top:2,backgroundColor:e.color},children:e.label})},e.index)),(0,F.jsxs)(`div`,{className:`relative`,ref:yn,children:[(0,F.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,style:{zIndex:0},children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t;return(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 border-r`,style:{left:Y[n],width:e.width,backgroundColor:e.bandColor?`color-mix(in srgb, ${e.bandColor} 8%, transparent)`:e.isWeekend?`hsl(var(--muted) / 0.4)`:void 0}},n)})}),Un&&S&&S.showMidnight&&(0,F.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,style:{zIndex:0},children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t,r=e.realMs??0;if(!r)return null;let i=e.date.getTime(),a=e.date,o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1,0,0,0,0).getTime();return o<=i||o>=i+r?null:(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0`,style:{left:Y[n]+(o-i)/r*e.width,borderLeft:`1px dashed hsl(var(--muted-foreground) / 0.4)`},"data-testid":`gantt-midnight-${n}`,"aria-hidden":`true`},`midnight-${n}`)})}),Q.startIdx>0&&(0,F.jsx)(`div`,{style:{height:Q.startIdx*z},"aria-hidden":`true`}),K.slice(Q.startIdx,Q.endIdx).map((e,t)=>{let n=e.task,r=Q.startIdx+t,i=mi(n.id),a=Kr(e.start,e.end),o=ue&&n.baselineStart&&n.baselineEnd?Kr(n.baselineStart,n.baselineEnd):null,s=o?(0,F.jsx)(`div`,{className:`absolute pointer-events-none rounded-[1px]`,style:{left:o.left,width:Math.max(2,o.width),top:oi,height:ai,backgroundColor:si,border:`1px solid ${ci}`},"data-testid":`gantt-baseline-${n.id}`,"aria-hidden":`true`}):null,c=W?.taskId===n.id,l=Jr?.has(String(n.id))??!1,u=Yr?.has(String(n.id))??!1,d=c||l||u?Xr(e):a,f=!!n.locked,p=!!I&&!e.isSummary&&!f,m=p&&He,h=p&&We,g=p&&Ge,_=m||h,ee=P||f,te=G!=null&&G.targetId!=null&&String(G.targetId)===String(n.id)&&String(G.sourceId)!==String(n.id),ne=G?e=>{let t=e.currentTarget.getBoundingClientRect(),r=t.width>0&&e.clientX-t.left>t.width/2?`end`:`start`;bn(e=>e&&vn(e.sourceId,n)?{...e,targetId:n.id,targetEnd:r}:e)}:void 0,re=G?e=>{e.target===e.currentTarget&&bn(e=>e&&{...e,targetId:null,targetEnd:null})}:void 0,y=Math.max(1,Math.round((e.end.getTime()-e.start.getTime())/nt)),b=(r+1)*z+300>gr&&r*z>300,ie=Bt===n.id&&!W&&!mn&&!G?(0,F.jsxs)(`div`,{className:`absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2.5 py-1.5 text-xs shadow-md whitespace-nowrap`,style:{left:Math.max(d.left+8,4),...b?{bottom:z-8}:{top:z-8}},role:`tooltip`,"data-testid":`gantt-tooltip-${n.id}`,children:[(0,F.jsx)(`div`,{className:`font-semibold`,children:n.title}),n.fields&&n.fields.length>0?(0,F.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`auto 1fr`,columnGap:10,rowGap:2,marginTop:4},children:n.fields.map((e,t)=>(0,F.jsxs)(D.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,F.jsx)(`span`,{style:{fontWeight:500},children:e.value})]},t))}):(0,F.jsxs)(`div`,{className:`text-muted-foreground`,children:[e.start.toLocaleDateString(N,{month:`short`,day:`numeric`}),` → `,e.end.toLocaleDateString(N,{month:`short`,day:`numeric`}),` · `,y,M(`gantt.tooltip.days`),` · `,Math.round(e.progress),`%`]}),n.locked||P&&!I?(0,F.jsxs)(`div`,{className:`text-muted-foreground`,style:{marginTop:4},"data-testid":`gantt-tooltip-locked-${n.id}`,children:[`🚫 `,M(`gantt.lockedHint`)]}):null]}):null;if(n.type===`group`)return(0,F.jsx)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:ie},n.id);if(e.isSummary){let t=n.color||`#0d9488`,r=ve===`self`&&n.hasOwnDates!==!1,a=!!I&&He&&!f,o=!!I&&We&&r&&!f;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:[s,(0,F.jsxs)(`div`,{className:v(`gantt-bar-hover absolute rounded-sm border shadow-sm flex items-center px-2 select-none group`,a&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left,width:d.width,top:ii,height:ri,cursor:a||o?void 0:ee?`not-allowed`:`pointer`,backgroundColor:t,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-summary-bar-${n.id}`,"data-progress":Math.round(e.progress),onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),onPointerMove:ne,onPointerDown:t=>{if(t.button===0){if(o){let e=Ye(t.clientX,t.currentTarget.getBoundingClientRect());if(e!==`move`){pn(n,e,t);return}}a&&pn(n,`move`,t,{group:!0,originStart:e.start,originEnd:e.end})}},onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),children:[(0,F.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 pointer-events-none`,style:{width:`${Math.round(e.progress)}%`,backgroundColor:`rgba(0, 0, 0, 0.2)`,borderTopLeftRadius:`var(--radius-sm)`,borderBottomLeftRadius:`var(--radius-sm)`}}),o&&d.width>=14&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute left-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-left-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-left`,e)},onClick:e=>e.stopPropagation()}),(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute right-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-right-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-right`,e)},onClick:e=>e.stopPropagation()})]}),(0,F.jsx)(`span`,{className:`relative text-[10px] text-white font-medium truncate pointer-events-none`,children:n.title}),R&&!f&&[`start`,`end`].map(e=>{let t=G!=null&&String(G.sourceId)===String(n.id)&&G.sourceEnd===e,r=t||Bt===n.id,i=r&&G==null;return(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity`,style:{[e===`start`?`left`:`right`]:-28,height:24,width:30,cursor:`crosshair`,opacity:+!!r,pointerEvents:i?`auto`:`none`,justifyContent:e===`start`?`flex-start`:`flex-end`,paddingLeft:e===`start`?4:0,paddingRight:e===`end`?4:0},"data-testid":`gantt-link-dot-${e}-${n.id}`,onPointerDown:t=>{if(t.button!==0)return;t.stopPropagation(),t.preventDefault();let r=yn.current?.getBoundingClientRect();bn({sourceId:n.id,sourceEnd:e,x:r?t.clientX-r.left:0,y:r?t.clientY-r.top:0,targetId:null,targetEnd:null})},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{className:`rounded-full`,style:{height:12,width:12,backgroundColor:`hsl(var(--background))`,border:`2px solid hsl(var(--primary))`,boxShadow:t?`0 0 0 3px hsl(var(--primary) / 0.25)`:`0 1px 2px rgba(0,0,0,0.25)`}})},e)})]}),c&&W&&(0,F.jsxs)(`div`,{className:`absolute z-30 pointer-events-none rounded border bg-popover text-popover-foreground px-1.5 py-0.5 text-[10px] shadow whitespace-nowrap`,style:{left:Math.max(d.left,4),top:ii+ri+2},"data-testid":`gantt-summary-drag-chip-${n.id}`,children:[Jt(W).start.toLocaleDateString(N,{month:`numeric`,day:`numeric`}),` → `,Jt(W).end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})]}),ie]},n.id)}if(e.isMilestone){let e=ti;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:[s,(0,F.jsx)(`div`,{className:v(`gantt-bar-hover absolute rotate-45 rounded-[2px] border shadow-sm select-none`,m&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left-e/2,top:(z-e)/2,width:e,height:e,cursor:m?void 0:ee?`not-allowed`:`pointer`,backgroundColor:i?$:n.color||`#3b82f6`,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-milestone-${n.id}`,onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),onPointerMove:ne,onPointerDown:m?e=>{e.button===0&&pn(n,`move`,e)}:void 0}),ie]},n.id)}let ae=mn&&mn.taskId===n.id?mn.value:n.progress;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),children:[c&&(0,F.jsx)(`div`,{className:`absolute rounded-sm border border-dashed pointer-events-none`,style:{left:a.left,width:a.width,top:Qr,height:$r,opacity:.35,borderColor:`hsl(var(--primary) / 0.6)`},"aria-hidden":`true`}),s,(0,F.jsxs)(`div`,{className:v(`gantt-bar-hover absolute rounded-sm bg-primary border shadow-sm flex items-center px-2 group select-none`,_&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left,width:d.width,top:Qr,height:$r,cursor:_?void 0:ee?`not-allowed`:`pointer`,backgroundColor:n.color||`#3b82f6`,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-task-bar-${n.id}`,onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),onPointerMove:ne,onPointerDown:_?e=>{if(e.button!==0)return;let t=Ye(e.clientX,e.currentTarget.getBoundingClientRect()),r=t!==`move`&&h?t:m?`move`:null;r&&pn(n,r,e)}:void 0,children:[h&&d.width>=14&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute left-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-left-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-left`,e)},onClick:e=>e.stopPropagation()}),(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute right-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-right-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-right`,e)},onClick:e=>e.stopPropagation()})]}),ae>0&&(0,F.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 pointer-events-none`,style:{width:`${ae}%`,backgroundColor:`rgba(0, 0, 0, 0.2)`,borderTopLeftRadius:`var(--radius-sm)`,borderBottomLeftRadius:`var(--radius-sm)`}}),g&&d.width>=30&&(0,F.jsx)(`div`,{className:v(`absolute bottom-0 h-1/2 w-4 -translate-x-1/2 cursor-col-resize flex items-end justify-center pb-px`,mn?.taskId===n.id?`opacity-100`:`opacity-0 group-hover:opacity-100 transition-opacity`),style:{left:`${ae}%`},"data-testid":`gantt-progress-handle-${n.id}`,onPointerDown:e=>{e.button===0&&(e.stopPropagation(),e.preventDefault(),hn({taskId:n.id,originClientX:e.clientX,originProgress:n.progress,barWidth:d.width,value:n.progress}))},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{style:{width:0,height:0,borderLeft:`5px solid transparent`,borderRight:`5px solid transparent`,borderBottom:`7px solid #fff`,filter:`drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35))`}})}),R&&!f&&[`start`,`end`].map(e=>{let t=G!=null&&String(G.sourceId)===String(n.id)&&G.sourceEnd===e,r=t||Bt===n.id,i=r&&G==null;return(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity`,style:{[e===`start`?`left`:`right`]:-28,height:24,width:30,cursor:`crosshair`,opacity:+!!r,pointerEvents:i?`auto`:`none`,justifyContent:e===`start`?`flex-start`:`flex-end`,paddingLeft:e===`start`?4:0,paddingRight:e===`end`?4:0},"data-testid":`gantt-link-dot-${e}-${n.id}`,onPointerDown:t=>{if(t.button!==0)return;t.stopPropagation(),t.preventDefault();let r=yn.current?.getBoundingClientRect();bn({sourceId:n.id,sourceEnd:e,x:r?t.clientX-r.left:0,y:r?t.clientY-r.top:0,targetId:null,targetEnd:null})},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{className:`rounded-full`,style:{height:12,width:12,backgroundColor:`hsl(var(--background))`,border:`2px solid hsl(var(--primary))`,boxShadow:t?`0 0 0 3px hsl(var(--primary) / 0.25)`:`0 1px 2px rgba(0,0,0,0.25)`}})},e)}),(0,F.jsx)(`span`,{className:`relative text-[10px] text-white font-medium truncate pointer-events-none group-hover:opacity-0 transition-opacity`,children:n.title}),(0,F.jsx)(`span`,{className:`absolute inset-0 flex items-center px-2 text-[10px] text-white font-medium truncate opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none`,children:c?`${Jt(W).start.toLocaleDateString(N,{month:`numeric`,day:`numeric`})} → ${Jt(W).end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}`:`${Math.round(ae)}%`})]}),ie]},n.id)}),Q.endIdx<K.length&&(0,F.jsx)(`div`,{style:{height:(K.length-Q.endIdx)*z},"aria-hidden":`true`}),(Zr.length>0||G)&&(0,F.jsxs)(`svg`,{className:`absolute top-0 left-0 pointer-events-none z-10`,width:Kn,height:gr,"data-testid":`gantt-links`,"aria-hidden":`true`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(`marker`,{id:`gantt-link-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`hsl(var(--muted-foreground))`})}),(0,F.jsx)(`marker`,{id:`gantt-link-arrow-active`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`hsl(var(--primary))`})}),(0,F.jsx)(`marker`,{id:`gantt-link-arrow-critical`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:$})})]}),Zr.map(e=>{let t=Math.min(e.sourceIndex,e.targetIndex);if(Math.max(e.sourceIndex,e.targetIndex)<Q.startIdx-6||t>Q.endIdx+6)return null;let n=li(e);if(!n)return null;let r=ui!=null&&(String(e.sourceId)===String(ui)||String(e.targetId)===String(ui)),i=pi?.criticalEdges.has(`${String(e.sourceId)}->${String(e.targetId)}`)??!1,a=i?`gantt-link-arrow-critical`:r?`gantt-link-arrow-active`:`gantt-link-arrow`,o=!!(pt||R);return(0,F.jsxs)(D.Fragment,{children:[(0,F.jsx)(`path`,{d:n,fill:`none`,stroke:i?$:r?`hsl(var(--primary))`:`hsl(var(--muted-foreground))`,strokeOpacity:i||r?1:.7,strokeWidth:i||r?2:1.5,markerEnd:`url(#${a})`,"data-testid":`gantt-link-${e.sourceId}-${e.targetId}`,"data-link-type":e.type,"data-active":r?`true`:`false`,"data-critical":i?`true`:void 0}),o&&(0,F.jsx)(`path`,{d:n,fill:`none`,stroke:`transparent`,strokeWidth:10,style:{pointerEvents:`stroke`,cursor:`context-menu`},"data-testid":`gantt-link-hit-${e.sourceId}-${e.targetId}`,onContextMenu:t=>Ln(e.sourceId,e.targetId,e.type,t)})]},e.key)}),G&&(()=>{let e=K.findIndex(e=>String(e.task.id)===String(G.sourceId));if(e<0)return null;let t=Xr(K[e]),n=K[e].isMilestone?t.left+(G.sourceEnd===`start`?-ni:ni):G.sourceEnd===`start`?t.left:t.left+t.width,r=e*z+z/2;return(0,F.jsx)(`path`,{d:`M ${Math.round(n)} ${Math.round(r)} L ${Math.round(G.x)} ${Math.round(G.y)}`,fill:`none`,stroke:`hsl(var(--primary))`,strokeWidth:1.5,strokeDasharray:`4 3`,"data-testid":`gantt-link-draft`})})()]}),G&&(()=>{let e=A.find(e=>String(e.id)===String(G.sourceId));if(!e)return null;let t=G.targetId==null?null:A.find(e=>String(e.id)===String(G.targetId)),n=e=>M(`gantt.linkEnd.${e}`),r=t?`${e.title} (${n(G.sourceEnd)}) → ${t.title} (${n(G.targetEnd??`start`)})`:`${e.title} (${n(G.sourceEnd)})`;return(0,F.jsx)(`div`,{className:`absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2 py-1 text-[11px] font-medium shadow-md whitespace-nowrap`,style:{left:G.x+12,top:G.y+12},"data-testid":`gantt-link-draft-hint`,children:r})})()]})]})}),(0,F.jsx)(`div`,{ref:Fr,className:`shrink-0 border-l bg-card/95 select-none`,style:{width:14,display:`none`},"data-testid":`gantt-vscrollbar`,children:(0,F.jsx)(`div`,{ref:Ir,className:`relative h-full`,onPointerDown:Ur,role:`scrollbar`,"aria-controls":`gantt-timeline`,"aria-orientation":`vertical`,children:(0,F.jsx)(`div`,{ref:Lr,className:`absolute rounded-full`,style:{left:2,right:2,top:0,height:0,backgroundColor:`rgba(130,130,130,0.55)`,cursor:`grab`},"data-testid":`gantt-vscrollbar-thumb`,onPointerDown:Hr})})})]}),(0,F.jsx)(`div`,{ref:jr,className:`shrink-0 border-t bg-card/95 select-none`,style:{position:`sticky`,bottom:0,zIndex:30,display:`none`},"data-testid":`gantt-hscrollbar`,children:(0,F.jsx)(`div`,{ref:Mr,className:`relative`,style:{marginLeft:V,height:14},onPointerDown:Vr,role:`scrollbar`,"aria-controls":`gantt-timeline`,"aria-orientation":`horizontal`,children:(0,F.jsx)(`div`,{ref:Nr,className:`absolute rounded-full`,style:{top:2,bottom:2,left:0,width:0,backgroundColor:`rgba(130,130,130,0.55)`,cursor:`grab`},"data-testid":`gantt-hscrollbar-thumb`,onPointerDown:Br})})})]}),Sn&&(()=>{let e=A.find(e=>String(e.id)===String(Sn.taskId));if(!e)return null;let t=K.find(e=>String(e.task.id)===String(Sn.taskId)),n=`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none`;return(0,F.jsxs)(`div`,{ref:wn,className:`fixed z-50 min-w-[160px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:Sn.x,top:Sn.y},role:`menu`,"data-testid":`gantt-context-menu`,children:[a&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-view`,onClick:()=>{Cn(null),a(e)},children:M(`gantt.menu.view`)}),ht&&I&&t&&!t.isSummary&&!e.locked&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-edit`,onClick:()=>{Cn(null),Lt(e.id),zt({title:e.title,start:e.start.toLocaleDateString(`en-CA`),end:e.end.toLocaleDateString(`en-CA`),progress:String(e.progress)})},children:M(`gantt.menu.edit`)}),R&&t&&!t.isMilestone&&!e.locked&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-add-predecessor`,onClick:()=>{let t=Sn;Cn(null),jn(``),kn({x:t.x,y:t.y,taskId:e.id,relation:`pred`})},children:M(`gantt.menu.addPredecessor`)}),(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-add-successor`,onClick:()=>{let t=Sn;Cn(null),jn(``),kn({x:t.x,y:t.y,taskId:e.id,relation:`succ`})},children:M(`gantt.menu.addSuccessor`)})]}),ut&&!e.locked&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:v(n,`text-destructive`),"data-testid":`gantt-context-menu-delete`,onClick:()=>{Cn(null),ut(e)},children:M(`gantt.menu.delete`)})]})})(),Tn&&(()=>{let e=A.find(e=>String(e.id)===String(Tn.sourceId)),t=A.find(e=>String(e.id)===String(Tn.targetId));if(!e||!t)return null;let n=`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none`,r=[`fs`,`ss`,`ff`,`sf`],i=!!t.locked;return(0,F.jsxs)(`div`,{ref:Dn,className:`fixed z-50 min-w-[180px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:Tn.x,top:Tn.y},role:`menu`,"data-testid":`gantt-link-context-menu`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground truncate`,children:[e.title,` → `,t.title]}),i&&(0,F.jsxs)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,"data-testid":`gantt-link-menu-locked`,children:[`🚫 `,M(`gantt.lockedHint`)]}),R&&Te&&r.map(r=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Tn.type===r,disabled:i,className:v(n,Tn.type===r&&`font-semibold`,i&&`opacity-50 cursor-not-allowed hover:bg-transparent`),"data-testid":`gantt-link-menu-type-${r}`,onClick:()=>{i||(En(null),r!==Tn.type&&R(e,t,r))},children:[Tn.type===r?`✓ `:`\xA0\xA0`,M(`gantt.linkType.${r}`)]},r)),pt&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`my-1 border-t`}),(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:i,className:v(n,`text-destructive`,i&&`opacity-50 cursor-not-allowed hover:bg-transparent`),"data-testid":`gantt-link-menu-remove`,onClick:()=>{i||(En(null),pt(e,t))},children:M(`gantt.menu.removeDependency`)})]})]})})(),On&&R&&(()=>{let e=A.find(e=>String(e.id)===String(On.taskId));if(!e)return null;let t=new Set(Zr.map(e=>`${String(e.sourceId)}->${String(e.targetId)}`)),n=A.filter(n=>{if(String(n.id)===String(e.id)||n.type===`group`||n.locked)return!1;let r=On.relation===`pred`?`${String(n.id)}->${String(e.id)}`:`${String(e.id)}->${String(n.id)}`;return!t.has(r)}),r=An.trim().toLowerCase(),i=r?n.filter(e=>String(e.title??``).toLowerCase().includes(r)):n;return(0,F.jsxs)(`div`,{ref:Mn,className:`fixed z-50 min-w-[200px] max-h-[280px] overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:On.x,top:On.y},role:`menu`,"data-testid":`gantt-dep-picker`,children:[(0,F.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,children:On.relation===`pred`?M(`gantt.menu.addPredecessor`):M(`gantt.menu.addSuccessor`)}),(0,F.jsx)(`div`,{className:`px-2 pb-1`,children:(0,F.jsx)(`input`,{className:`border rounded px-2 py-1 text-sm w-full bg-background`,value:An,onChange:e=>jn(e.target.value),placeholder:M(`gantt.menu.searchTasks`),"data-testid":`gantt-dep-picker-search`,autoFocus:!0})}),i.length===0?(0,F.jsx)(`div`,{className:`px-3 py-1.5 text-muted-foreground`,children:M(`gantt.menu.noCandidates`)}):i.map(t=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none truncate`,"data-testid":`gantt-dep-picker-option-${t.id}`,onClick:()=>{kn(null),On.relation===`pred`?R(t,e,`fs`):R(e,t,`fs`)},children:t.title},String(t.id)))]})})(),hi&&(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/30`,"data-testid":`gantt-autoschedule-overlay`,onClick:()=>gi(null),children:(0,F.jsxs)(`div`,{className:`min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4`,role:`alertdialog`,"aria-modal":`true`,"data-testid":`gantt-autoschedule-dialog`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`text-sm font-semibold mb-1`,"data-testid":`gantt-autoschedule-title`,children:M(`gantt.autoScheduleDlg.title`)}),(0,F.jsxs)(`div`,{className:`text-sm text-muted-foreground mb-3`,children:[M(`gantt.autoScheduleDlg.body`).replace(`{count}`,String(hi.changes.length)),hi.skipped>0&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{"data-testid":`gantt-autoschedule-skipped`,children:M(`gantt.autoScheduleDlg.skipped`).replace(`{count}`,String(hi.skipped))})]})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none`,"data-testid":`gantt-autoschedule-cancel`,onClick:()=>gi(null),children:M(`gantt.autoScheduleDlg.cancel`)}),(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none`,"data-testid":`gantt-autoschedule-confirm`,onClick:bi,children:M(`gantt.autoScheduleDlg.confirm`)})]})]})}),_i&&(0,F.jsx)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-[60] rounded-md border bg-popover text-popover-foreground px-3 py-1.5 text-sm shadow-md`,role:`status`,"data-testid":`gantt-autoschedule-clean`,children:M(`gantt.autoScheduleDlg.none`)}),tn&&(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/30`,"data-testid":`gantt-conflict-overlay`,onClick:()=>nn(null),children:(0,F.jsxs)(`div`,{className:`min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4`,role:`alertdialog`,"aria-modal":`true`,"data-testid":`gantt-conflict-dialog`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`text-sm font-semibold mb-1`,"data-testid":`gantt-conflict-title`,children:M(`gantt.conflict.title`)}),(0,F.jsx)(`div`,{className:`text-sm text-muted-foreground mb-3`,children:M(`gantt.conflict.body`).replace(`{count}`,String(tn.length))}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none`,"data-testid":`gantt-conflict-cancel`,onClick:()=>nn(null),children:M(`gantt.conflict.cancel`)}),(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none`,"data-testid":`gantt-conflict-confirm`,onClick:sn,children:M(`gantt.conflict.confirm`)})]})]})})]})}function pt(e,t,n,r){return t.getTime()===e.getTime()?e.getTime()>=n.getTime()&&e.getTime()<r.getTime():e.getTime()<r.getTime()&&t.getTime()>n.getTime()}function mt(e,t,n){let{assignee:r,effort:i,capacity:a=1,unassignedLabel:o=`Unassigned`}=n,s=e=>typeof a==`function`?a(e):a,c=e=>{let t=i?i(e):1;return Number.isFinite(t)&&t>0?t:0},l=new Map;for(let t of e){let e=r(t),n=e?String(e.key):`__unassigned__`,i=e?e.label:o,a=l.get(n);a||(a={key:n,label:i,items:[]},l.set(n,a)),a.items.push(t)}let u=[];for(let e of l.values()){let n=s(e.key),r=0,i=0,a=t.map(t=>{let a=0;for(let n of e.items)pt(n.start,n.end,t.start,t.end)&&(a+=c(n));a>r&&(r=a);let o=a>n+1e-9;return o&&i++,{load:a,capacity:n,overloaded:o}});u.push({key:e.key,label:e.label,capacity:n,cells:a,peak:r,overloadedCount:i})}return u}var ht={day:26,week:56,month:76,quarter:88,year:104},gt=48,_t=34,z=180;function vt(e,t,n){return t===`day`?String(e.getDate()):t===`week`?e.toLocaleDateString(n,{month:`numeric`,day:`numeric`}):t===`month`?e.toLocaleDateString(n,{month:`short`}):t===`year`?String(e.getFullYear()):`Q${Math.floor(e.getMonth()/3)+1}`}function yt({tasks:e,assignee:t,effort:n,capacity:r=1,viewMode:i=`day`,unassignedLabel:a=`Unassigned`,className:o}){let{t:s,language:c}=qe(),l=c||void 0,u=ht[i],d=D.useMemo(()=>{if(!e.length)return[];let t=new Date(Math.min(...e.map(e=>e.start.getTime()))),n=new Date(Math.max(...e.map(e=>e.end.getTime()))),r=L(t,i),a=at(L(n,i),1,i),o=[],s=0;for(;r<a&&s++<4e3;){let e=at(r,1,i);o.push({date:new Date(r),col:{start:new Date(r),end:new Date(e)},label:vt(r,i,l)}),r=e}return o},[e,i,l]),f=D.useMemo(()=>mt(e,d.map(e=>e.col),{assignee:t,effort:n,capacity:r,unassignedLabel:a}),[e,d,t,n,r,a]),p=D.useMemo(()=>{let e=0;for(let t of f)e=Math.max(e,t.peak,t.capacity);return e||1},[f]),m=d.length*u;return e.length?(0,F.jsx)(`div`,{className:o,"data-testid":`resource-workload`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`auto`},children:(0,F.jsxs)(`div`,{style:{display:`flex`,minWidth:z+m},children:[(0,F.jsxs)(`div`,{style:{width:z,flexShrink:0},children:[(0,F.jsx)(`div`,{style:{height:28,display:`flex`,alignItems:`center`,padding:`0 12px`,fontSize:12,fontWeight:600,borderBottom:`1px solid hsl(var(--border))`},children:s(`gantt.resource.header`)}),f.map(e=>(0,F.jsxs)(`div`,{"data-testid":`resource-row-${e.key}`,style:{height:gt,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:`0 12px`,borderBottom:`1px solid hsl(var(--border) / 0.5)`},children:[(0,F.jsx)(`span`,{style:{fontSize:13,fontWeight:500,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.label}),(0,F.jsxs)(`span`,{"data-testid":`resource-peak-${e.key}`,"data-overloaded":e.overloadedCount>0?`true`:void 0,style:{fontSize:10,color:e.overloadedCount>0?`hsl(var(--destructive))`:`hsl(var(--muted-foreground))`},children:[s(`gantt.resource.peak`),`: `,Math.round(e.peak*100)/100,` / `,e.capacity,e.overloadedCount>0?` · ${e.overloadedCount} ${s(`gantt.resource.over`)}`:``]})]},e.key))]}),(0,F.jsxs)(`div`,{style:{flex:1},children:[(0,F.jsx)(`div`,{style:{display:`flex`,height:28,borderBottom:`1px solid hsl(var(--border))`},children:d.map((e,t)=>(0,F.jsx)(`div`,{style:{width:u,flexShrink:0,textAlign:`center`,fontSize:10,color:`hsl(var(--muted-foreground))`,borderLeft:`1px solid hsl(var(--border) / 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.label},t))}),f.map(e=>{let t=_t*(1-Math.min(e.capacity/p,1));return(0,F.jsxs)(`div`,{style:{position:`relative`,display:`flex`,height:gt,borderBottom:`1px solid hsl(var(--border) / 0.5)`},children:[(0,F.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,left:0,right:0,top:(gt-_t)/2+t,borderTop:`1px dashed hsl(var(--muted-foreground) / 0.6)`,pointerEvents:`none`,zIndex:1}}),e.cells.map((t,n)=>{let r=Math.max(t.load>0?2:0,_t*Math.min(t.load/p,1));return(0,F.jsx)(`div`,{"data-testid":`resource-cell-${e.key}-${n}`,"data-load":t.load,"data-overloaded":t.overloaded?`true`:void 0,title:`${d[n]?.date.toLocaleDateString(l)} — ${Math.round(t.load*100)/100} / ${t.capacity}`,style:{width:u,flexShrink:0,position:`relative`,borderLeft:`1px solid hsl(var(--border) / 0.4)`,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,paddingBottom:(gt-_t)/2},children:t.load>0&&(0,F.jsx)(`div`,{style:{width:u-6,height:r,borderRadius:2,backgroundColor:t.overloaded?`hsl(var(--destructive))`:`hsl(var(--primary))`,opacity:t.overloaded?.9:.75}})},n)})]},e.key)})]})]})}):(0,F.jsx)(`div`,{className:o,"data-testid":`resource-workload`,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-40 text-sm text-muted-foreground`,children:s(`gantt.resource.empty`)})})}var bt={display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8,padding:`8px 12px`,borderBottom:`1px solid hsl(var(--border))`,background:`hsl(var(--background))`,fontSize:13},xt={display:`inline-flex`,alignItems:`center`,gap:6,height:30,padding:`0 10px`,borderRadius:6,border:`1px solid hsl(var(--border))`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`,cursor:`pointer`,whiteSpace:`nowrap`,lineHeight:`28px`},St={position:`absolute`,top:`calc(100% + 4px)`,left:0,zIndex:50,minWidth:200,maxHeight:320,overflowY:`auto`,padding:4,borderRadius:8,border:`1px solid hsl(var(--border))`,background:`hsl(var(--popover, var(--background)))`,color:`hsl(var(--popover-foreground, var(--foreground)))`,boxShadow:`0 8px 24px rgba(0,0,0,0.18)`},Ct={display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,borderRadius:6,cursor:`pointer`,userSelect:`none`};function wt({checked:e}){return(0,F.jsx)(`span`,{"aria-hidden":!0,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:15,height:15,flex:`0 0 auto`,borderRadius:3,border:`1px solid ${e?`hsl(var(--primary))`:`hsl(var(--border))`}`,background:e?`hsl(var(--primary))`:`transparent`,color:`hsl(var(--primary-foreground, var(--background)))`,fontSize:11,lineHeight:1},children:e?`✓`:``})}function B({filter:e,selected:t,onChange:n,labels:r}){let[i,a]=(0,D.useState)(!1),o=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=new Set(t),c=t.length,l=e.options.length>0&&c===e.options.length,u=t=>{let r=new Set(s);r.has(t)?r.delete(t):r.add(t),r.size===e.options.length?n([]):n([...r])},d=()=>{n(c>0?[]:e.options.map(e=>e.value))},f=c===0?e.label:c===1?`${e.label}: ${e.options.find(e=>e.value===t[0])?.label??t[0]}`:`${e.label} · ${c}`;return(0,F.jsxs)(`div`,{ref:o,style:{position:`relative`},"data-testid":`quick-filter-${e.field}`,children:[(0,F.jsxs)(`button`,{type:`button`,style:{...xt,borderColor:c>0?`hsl(var(--primary))`:`hsl(var(--border))`,color:c>0?`hsl(var(--primary))`:`hsl(var(--foreground))`},"aria-haspopup":`listbox`,"aria-expanded":i,"data-testid":`quick-filter-trigger-${e.field}`,onClick:()=>a(e=>!e),children:[(0,F.jsx)(`span`,{children:f}),(0,F.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:10,opacity:.7},children:`▾`})]}),i&&(0,F.jsx)(`div`,{role:`listbox`,style:St,"data-testid":`quick-filter-panel-${e.field}`,children:e.options.length===0?(0,F.jsx)(`div`,{style:{...Ct,cursor:`default`,opacity:.6},children:r.empty}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{role:`option`,"aria-selected":l,style:{...Ct,fontWeight:600},"data-testid":`quick-filter-all-${e.field}`,onClick:()=>d(),children:[(0,F.jsx)(wt,{checked:l}),(0,F.jsx)(`span`,{children:r.all})]}),(0,F.jsx)(`div`,{style:{height:1,background:`hsl(var(--border))`,margin:`2px 0`}}),e.options.map(t=>{let n=s.has(t.value);return(0,F.jsxs)(`div`,{role:`option`,"aria-selected":n,style:{...Ct,background:n?`hsl(var(--accent, var(--muted)))`:`transparent`},"data-testid":`quick-filter-option-${e.field}-${t.value}`,onClick:()=>u(t.value),children:[(0,F.jsx)(wt,{checked:n}),(0,F.jsx)(`span`,{children:t.label})]},t.value)})]})})]})}var Tt=({filters:e,value:t,onChange:n,onClear:r,resultCount:i,totalCount:a,labels:o,className:s})=>{if(!e.length)return null;let c=o?.all??`All`,l=o?.empty??`No options`,u=o?.clear??`Clear`,d=e.some(e=>(t[e.field]?.length??0)>0);return(0,F.jsxs)(`div`,{style:bt,className:s,"data-testid":`quick-filter-bar`,children:[e.map(e=>(0,F.jsx)(B,{filter:e,selected:t[e.field]??[],onChange:t=>n(e.field,t),labels:{all:c,empty:l}},e.field)),d&&(0,F.jsx)(`button`,{type:`button`,style:{...xt,height:28,color:`hsl(var(--muted-foreground))`},"data-testid":`quick-filter-clear`,onClick:r,children:u}),o?.resultSummary&&i!=null&&a!=null&&(0,F.jsx)(`span`,{"data-testid":`quick-filter-summary`,style:{marginLeft:`auto`,color:`hsl(var(--muted-foreground))`},children:o.resultSummary(i,a)})]})};function Et(e){if(e==null)return;let t=String(e).toLowerCase().trim();if(t===`milestone`)return`milestone`;if(t===`group`||t===`folder`)return`group`;if(t===`summary`||t===`project`||t===`phase`)return`summary`;if(t===`task`)return`task`}var Dt={fs:`fs`,ss:`ss`,ff:`ff`,sf:`sf`,finish_to_start:`fs`,start_to_start:`ss`,finish_to_finish:`ff`,start_to_finish:`sf`,end_to_start:`fs`,end_to_end:`ff`,start_to_end:`sf`};function Ot(e){if(e==null||e===``)return[];if(typeof e==`string`)return e.split(`,`).map(e=>e.trim()).filter(Boolean);if(typeof e==`number`)return[e];if(!Array.isArray(e))return[];let t=[];for(let n of e)if(!(n==null||n===``))if(typeof n==`object`){let e=n.id??n._id??n.task??n.target;if(e==null||e===``)continue;let r=Dt[String(n.type??``).toLowerCase().replace(/-/g,`_`)];t.push(r?{id:e,type:r}:{id:e})}else t.push(n);return t}function kt(e){return e.data?e.data:e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function At(e){if(e){if(typeof e==`string`){let t=e.split(` `),n=t[0],r=t[1]?.toLowerCase()===`desc`?`desc`:`asc`;return{[n]:r}}if(Array.isArray(e))return e.reduce((e,t)=>(t.field&&t.order&&(e[t.field]=t.order),e),{})}}function jt(e){let t=e instanceof Error?e.message:String(e??``),n=t.indexOf(`{`);if(n>=0)try{let e=JSON.parse(t.slice(n)),r=e?.message??e?.error;if(typeof r==`string`&&r.trim())return r}catch{}return null}function Mt(e){let t=null;if(e.startDateField&&e.endDateField)return t={startDateField:e.startDateField,endDateField:e.endDateField,titleField:e.titleField||`name`,progressField:e.progressField,dependenciesField:e.dependenciesField||e.dependencyField,colorField:e.colorField,borderColorField:e.borderColorField,parentField:e.parentField,typeField:e.typeField,lockField:e.lockField,objectField:e.objectField,summaryExtent:e.summaryExtent,defaultCollapsedDepth:e.defaultCollapsedDepth,tooltipFields:e.tooltipFields,baselineStartField:e.baselineStartField,baselineEndField:e.baselineEndField,groupByField:e.groupByField,resourceView:e.resourceView,assigneeField:e.assigneeField,effortField:e.effortField,capacity:e.capacity,quickFilters:e.quickFilters,autoZoomToFilter:e.autoZoomToFilter,timeSegments:e.timeSegments,interactions:e.interactions,exportFileName:e.exportFileName,timeZone:e.timeZone,dependencyTypes:e.dependencyTypes},t;if(e.gantt&&(t=e.gantt),t){let e=f.safeParse(t);return e.success||console.warn(`[ObjectGantt] Invalid gantt configuration:`,e.error.format()),t}return null}var V=({schema:e,dataSource:t,className:n,onTaskClick:r,onRowClick:u,onBeforeTaskUpdate:d,...f})=>{let[p,m]=(0,D.useState)([]),[_,te]=(0,D.useState)(!0),[ne,re]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),{currency:ie}=ee(),{t:S}=qe(),se=(0,D.useCallback)(e=>{De.error(S(`gantt.writeFailed`),{description:jt(e)??void 0})},[S]),ce=kt(e),C=(0,D.useMemo)(()=>ce,[JSON.stringify(ce)]),w=Mt(e),le=C?.provider===`value`,de=(0,D.useContext)(l)?.apiFetch,T=(0,D.useMemo)(()=>o(C,t??null,{fetch:de}),[C,t,de]),E=C?.provider===`object`?C.object:e.objectName??``,[ge,xe]=(0,D.useState)(!1),Se=(0,D.useRef)(0),Ee=(0,D.useCallback)(async({silent:t=!1}={})=>{let n=++Se.current,r=()=>Se.current===n;try{if(t?xe(!0):te(!0),f.data&&Array.isArray(f.data)){r()&&m(f.data);return}if(le&&C?.provider===`value`){r()&&m(C.items);return}if(!T||typeof T.find!=`function`)throw Error(`DataSource required for object/api providers`);let n=s(y?.fields),a=await T.find(E,{$filter:e.filter,$orderby:At(e.sort),...n.length>0?{$expand:n}:{}});r()&&m(i(a))}catch(e){t?console.error(`[ObjectGantt] Failed to refresh data:`,e):r()&&re(e)}finally{t?xe(!1):te(!1)}},[T,E,le,C,e.filter,e.sort,y]);(0,D.useEffect)(()=>{Ee()},[Ee]),(0,D.useEffect)(()=>{!le&&T&&(async()=>{try{if(!T||!E)return;let e=await T.getObjectSchema(E);b(e)}catch(e){console.error(`Failed to fetch object schema:`,e)}})()},[E,T,le,C]);let O=(0,D.useMemo)(()=>{if(!w||!p.length)return[];let{startDateField:e,endDateField:t,titleField:n,progressField:r,dependenciesField:i,colorField:a,borderColorField:o,parentField:s,typeField:l,lockField:u,tooltipFields:d,baselineStartField:f,baselineEndField:m,quickFilters:h}=w,g=y?.fields??{},_=new Map;for(let e of h??[]){if(!e?.field||!Array.isArray(e.options)||!e.options.length)continue;let t=new Map;for(let n of e.options)typeof n==`string`?t.set(n,n):n&&n.value!=null&&t.set(String(n.value),n.label??String(n.value));t.size&&_.set(e.field,t)}let ee=(e,t)=>{if(!t)return;let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},te=e=>{let t=[ee(e,n),e?.account?.name,e?.opportunity?.name,e?.contact&&[e.contact.first_name,e.contact.last_name].filter(Boolean).join(` `)];for(let e of t)if(e!=null&&String(e).trim()!==``)return String(e);return c(y,e)},ne=(e,t)=>{if(t)return t;let n=g[e]??g[e.split(`.`)[0]];return n?.label?n.label:me(e)},re=(e,t)=>{if(e==null||e===``)return`—`;let n=g[t]??g[t.split(`.`)[0]],r=n?.type,i=n?.options;if(Array.isArray(i)&&i.length){let t=i.find(t=>String(t.value)===String(e));if(t)return t.label}if(typeof e!=`object`){let n=_.get(t)?.get(String(e));if(n!=null)return n}if(r==null&&typeof e==`string`){if(/^\d{4}-\d{2}-\d{2}$/.test(e))return ue(e);if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(e)&&!isNaN(new Date(e).getTime()))return ye(e)}switch(r){case`date`:return ue(e);case`datetime`:return ye(e);case`number`:case`integer`:case`float`:case`decimal`:return pe(Number(e));case`currency`:return he(Number(e),ae(n,ie));case`percent`:return _e(Number(e));case`boolean`:case`checkbox`:return e?`Yes`:`No`;default:if(Array.isArray(e)){let t=e.map(e=>{if(e==null)return``;if(typeof e==`object`){let t=e;return String(t.name??t.label??t.title??t.id??``)}return String(e)}).filter(Boolean);return t.length?t.join(`, `):`—`}if(typeof e==`object`){let t=e;return String(t.name??t.label??t.title??t.id??`—`)}return String(e)}},v=e=>{if(!d||!d.length)return;let t=[];for(let n of d){let r=typeof n==`string`?n:n?.field;if(!r)continue;let i=typeof n==`object`?n.label:void 0,a=ee(e,r);a==null||a===``||Array.isArray(a)&&a.length===0||t.push({label:ne(r,i),value:re(a,r)})}return t.length?t:void 0};return p.map((n,c)=>{let d=n[e],p=n[t],h=f?n[f]:void 0,g=m?n[m]:void 0,_=h?new Date(h):void 0,ee=g?new Date(g):void 0,ne=te(n),re=r?n[r]:0,y=i?n[i]:[],b=a?n[a]:void 0;if(!b){let e=n.status??n.state??n.priority??n.severity;if(e!=null&&e!==``){let t=be(void 0,e);t&&(b=ve(t))}}let ie=o?n[o]:void 0,ae=ie!=null&&ie!==``?ve(String(ie),String(ie)):void 0;return{id:n.id||n._id||`task-${c}`,title:ne,start:d?new Date(d):new Date,end:p?new Date(p):new Date,hasOwnDates:!!(d&&p),progress:Math.min(100,Math.max(0,re||0)),dependencies:Ot(y),parent:s?n[s]??null:void 0,type:l?Et(n[l]):void 0,locked:u?!!n[u]:void 0,color:b,borderColor:ae,baselineStart:_&&!isNaN(_.getTime())?_:void 0,baselineEnd:ee&&!isNaN(ee.getTime())?ee:void 0,fields:v(n),data:n}}).filter(e=>!isNaN(e.start.getTime())&&!isNaN(e.end.getTime()))},[p,w,y]),k=(0,D.useMemo)(()=>{let e=w?.groupByField;if(!e)return;let t=y?.fields??{},n=(e,t)=>{if(!t)return;let n=e;for(let e of t.split(`.`)){if(n==null)return;n=n[e]}return n},r=n=>{let r=(t[e]??t[e.split(`.`)[0]])?.options;if(Array.isArray(r)&&r.length){let e=r.find(e=>String(e.value)===String(n));if(e)return e.label}if(typeof n==`object`&&n){let e=n;return String(e.name??e.label??e.title??e.id??n)}return String(n)};return t=>{let i=n(t.data,e);return i==null||i===``?null:{key:typeof i==`object`&&i?String(i.id??i._id??r(i)):i,label:r(i)}}},[w?.groupByField,y]),A=(0,D.useMemo)(()=>{let e=w?.assigneeField;if(!e)return;let t=y?.fields??{},n=(e,t)=>{if(!t)return;let n=e;for(let e of t.split(`.`)){if(n==null)return;n=n[e]}return n},r=n=>{let r=(t[e]??t[e.split(`.`)[0]])?.options;if(Array.isArray(r)&&r.length){let e=r.find(e=>String(e.value)===String(n));if(e)return e.label}if(typeof n==`object`&&n){let e=n;return String(e.name??e.label??e.title??e.id??n)}return String(n)};return t=>{let i=n(t.data,e);return i==null||i===``?null:{key:typeof i==`object`&&i?String(i.id??i._id??r(i)):i,label:r(i)}}},[w?.assigneeField,y]),j=(0,D.useMemo)(()=>{let e=w?.effortField;if(e)return t=>{let n=t.data?.[e],r=Number(n);return Number.isFinite(r)&&r>0?r:1}},[w?.effortField]),Ae=(0,D.useMemo)(()=>{let t=e.skipWeekends,n=e.holidays;if(!(!t&&(!n||n.length===0)))return{skipWeekends:!!t,holidays:n&&n.length?new Set(n):void 0}},[e]),je=(0,D.useMemo)(()=>He(w?.timeSegments),[w?.timeSegments]),M=(0,D.useCallback)((e,t)=>{if(!e||!t)return null;let n=e;for(let e of t.split(`.`)){if(n==null)return null;n=n[e]}if(n==null||n===``)return null;if(typeof n==`object`){let e=n;return String(e.id??e._id??e.value??e.name??``)}return String(n)},[]),Me=w?.quickFilters,[N,Ne]=(0,D.useState)({});(0,D.useEffect)(()=>{if(!Me?.length||!t||typeof t.find!=`function`)return;let e=y?.fields??{},n=!1;return(async()=>{let r={};for(let n of Me){if(n.options)continue;let a=e[n.field]??e[n.field.split(`.`)[0]],o=a?.type;if(o!==`lookup`&&o!==`master_detail`)continue;let s=a?.reference_to??a?.reference??a?.referenceTo;if(s)try{let e=i(await t.find(s,{$top:1e3}));r[n.field]=e.map(e=>({value:String(e.id??e._id??e.value??``),label:String(e.name??e.label??e.title??e.id??e._id??``)}))}catch(e){console.warn(`[ObjectGantt] Failed to load quick-filter options for "${n.field}":`,e)}}n||Ne(e=>({...e,...r}))})(),()=>{n=!0}},[JSON.stringify(Me),t,y]);let Pe=(0,D.useMemo)(()=>{if(!Me?.length)return[];let e=y?.fields??{};return Me.map(t=>{let n=e[t.field]??e[t.field.split(`.`)[0]],r=t.label??n?.label??me(t.field),i;if(t.options?.length)i=t.options.map(e=>typeof e==`object`?{value:String(e.value),label:String(e.label??e.value)}:{value:String(e),label:String(e)});else if(Array.isArray(n?.options)&&n.options.length)i=n.options.map(e=>({value:String(e.value??e),label:String(e.label??e.value??e)}));else if(N[t.field]?.length)i=N[t.field];else{let e=new Map;for(let n of p){let r=M(n,t.field);if(r!=null&&!e.has(r)){let i=n;for(let e of t.field.split(`.`))i=i?.[e];let a=i&&typeof i==`object`?String(i.name??i.label??i.title??r):r;e.set(r,a)}}i=[...e.entries()].map(([e,t])=>({value:e,label:t}))}return{field:t.field,label:r,options:i}})},[Me,y,N,p,M]),Fe=e.persistLayout===!1?void 0:`${e.objectName||(C?.provider===`object`?C.object:``)||`gantt`}:${e.viewName||`default`}`,Ie=Fe?`gantt-layout:${Fe}:filters`:null,[Le,Re]=(0,D.useState)(()=>{if(!Ie||typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(Ie)||`null`);if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))Array.isArray(r)&&(t[n]=r.filter(e=>typeof e==`string`));return t}catch{return{}}}),ze=(0,D.useCallback)(()=>{if(!(!Ie||typeof window>`u`))try{window.localStorage.setItem(Ie,JSON.stringify(Le))}catch{}},[Ie,Le]),Be=(0,D.useCallback)((e,t)=>{Re(n=>({...n,[e]:t}))},[]),Ve=(0,D.useCallback)(()=>Re({}),[]),P=(0,D.useCallback)(e=>!!w?.objectField&&!String(e?.[w.objectField]??``).trim(),[w?.objectField]),Ue=(0,D.useCallback)(e=>{let t=(w?.objectField?String(e[w.objectField]??``).trim():``)||E,n=e.id??e._id;if(!t||n==null)return null;let r=E?ke(E,n):null;return{objectName:t,recordId:n,href:!E||t===E?r:r?.replace(`/${E}/record/`,`/${t}/record/`)??null}},[w?.objectField,E]),We=(0,D.useMemo)(()=>{let e=Object.entries(Le).filter(([,e])=>e.length>0);if(!e.length)return O;let t=new Map(O.map(e=>[String(e.id),e])),n=new Set;for(let r of O){if(!e.every(([e,t])=>{let n=M(r.data,e);return n!=null&&t.includes(n)}))continue;let i=r;for(;i&&!n.has(String(i.id));)n.add(String(i.id)),i=i.parent==null?void 0:t.get(String(i.parent))}return O.filter(e=>n.has(String(e.id)))},[O,Le,M]),Ge=(0,D.useMemo)(()=>{if(w?.autoZoomToFilter!==!1||!O.length)return null;let e=O[0].start.getTime(),t=O[0].end.getTime();for(let n of O)e=Math.min(e,n.start.getTime()),t=Math.max(t,n.end.getTime());return{start:new Date(e),end:new Date(t)}},[O,w?.autoZoomToFilter]),Ke=e.navigation??{mode:`drawer`,width:`min(960px, 60vw)`},Je=Ke.mode===`drawer`||Ke.mode===`modal`||Ke.mode===`split`||Ke.mode===`popover`,Ye=a({navigation:Ke,objectName:e.objectName,onRowClick:Je?void 0:u}),[Xe,Ze]=(0,D.useState)(null),Qe=Ye.isOverlay&&Ye.isOpen?Ye.selectedRecord:null;(0,D.useEffect)(()=>{if(!Qe){Ze(null);return}let e=Ue(Qe);if(!e){Ze(null);return}let{objectName:n,recordId:r}=e;if(!(C?.provider===`api`||n!==E)||!t||typeof t.findOne!=`function`){Ze(null);return}let i=`${n}:${r}`,a=!1;return(async()=>{try{let[e,o]=await Promise.all([t.findOne(n,String(r)),typeof t.getObjectSchema==`function`?t.getObjectSchema(n).catch(()=>null):Promise.resolve(null)]);a||Ze(e?{key:i,record:e,schema:o}:null)}catch(e){console.error(`[ObjectGantt] Failed to fetch drawer record, falling back to row payload:`,e),a||Ze(null)}})(),()=>{a=!0}},[Qe,Ue,C?.provider,E,t]);let $e=(0,D.useCallback)(async(e,t)=>{if(!w||!T||typeof T.update!=`function`)return;let{startDateField:n,endDateField:r,titleField:i,progressField:a}=w,o={};if(t.start instanceof Date&&(o[n]=t.start.toISOString()),t.end instanceof Date&&(o[r]=t.end.toISOString()),typeof t.title==`string`&&i&&(o[i]=t.title),typeof t.progress==`number`&&a&&(o[a]=t.progress),Object.keys(o).length===0)return;let s=e.data?.id??e.data?._id??e.id;if(s==null)return;let c=p;m(e=>e.map(e=>String(e.id??e._id)===String(s)?{...e,...o}:e));try{await T.update(E,String(s),o),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to persist task update:`,e),m(c),se(e)}},[w,T,E,p,Ee,se]),et=(e,t)=>{let n=t.some(e=>typeof e==`object`&&e.type&&e.type!==`fs`);return!n&&typeof e==`string`?t.map(e=>String(typeof e==`object`?e.id:e)).join(`,`):n?t.map(e=>typeof e==`object`?e.type&&e.type!==`fs`?{id:e.id,type:e.type}:e.id:e):t.map(e=>typeof e==`object`?e.id:e)},tt=(0,D.useCallback)(async(e,t,n)=>{let r=w?.dependenciesField;if(!r||!T||typeof T.update!=`function`)return;let i=et(t,n),a=p;m(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[r]:i}:t));try{await T.update(E,String(e),{[r]:i}),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to persist dependency:`,e),m(a),se(e)}},[w,T,E,p,Ee,se]),nt=(0,D.useCallback)(async(e,t,n=`fs`)=>{let r=e.data?.id??e.data?._id??e.id,i=t.data?.id??t.data?._id??t.id;if(r==null||i==null)return;let a=w?.dependenciesField;if(!a)return;let o=p.find(e=>String(e.id??e._id)===String(i))?.[a],s=Ot(o),c=e=>String(typeof e==`object`?e.id:e),l=s.find(e=>c(e)===String(r)),u=l&&typeof l==`object`?l.type??`fs`:`fs`;if(l&&u===n)return;let d=n===`fs`?r:{id:r,type:n},f=l?s.map(e=>c(e)===String(r)?d:e):[...s,d];await tt(i,o,f)},[w,p,tt]),I=(0,D.useCallback)(async(e,t)=>{let n=e.data?.id??e.data?._id??e.id,r=t.data?.id??t.data?._id??t.id;if(n==null||r==null)return;let i=w?.dependenciesField;if(!i)return;let a=p.find(e=>String(e.id??e._id)===String(r))?.[i],o=Ot(a),s=e=>String(typeof e==`object`?e.id:e),c=o.filter(e=>s(e)!==String(n));c.length!==o.length&&await tt(r,a,c)},[w,p,tt]),[rt,L]=(0,D.useState)(null),[it,at]=(0,D.useState)(!1),ot=(0,D.useCallback)(e=>{L(e)},[]),st=(0,D.useCallback)(async()=>{if(!rt)return;if(!T?.delete){L(null);return}let e=rt.data?.id??rt.data?._id??rt.id;if(e==null){L(null);return}at(!0);let t=p;m(t=>t.filter(t=>String(t.id??t._id)!==String(e)));try{if(await T.delete(E,String(e))===!1)throw Error(S(`gantt.writeFailed`));L(null),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to delete:`,e),m(t),L(null),se(e)}finally{at(!1)}},[rt,T,E,p,Ee,se,S]);return _?(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading Gantt chart...`})})}):ne?(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,ne.message]})})}):w?(0,F.jsxs)(`div`,{className:v(`flex h-full min-h-0 flex-col`,n),children:[Pe.length>0&&(0,F.jsx)(Tt,{filters:Pe,value:Le,onChange:Be,onClear:Ve,resultCount:We.length,totalCount:O.length,labels:{all:`全部`,clear:`清除筛选`,empty:`无可选项`,resultSummary:(e,t)=>`显示 ${e} / ${t} 项任务`}}),(0,F.jsx)(`div`,{className:`flex-1 min-h-[420px]`,children:w?.resourceView&&A?(0,F.jsx)(yt,{tasks:We,assignee:A,effort:j,capacity:w?.capacity??1,viewMode:e.viewMode||`day`}):(0,F.jsx)(R,{tasks:We,startDate:Ge?.start,endDate:Ge?.end,onTaskClick:e=>{P(e.data)||Ye.handleClick(e.data),r?.(e.data)},onTaskUpdate:$e,onTaskDelete:ot,onDependencyCreate:w?.dependenciesField?nt:void 0,onDependencyDelete:w?.dependenciesField?I:void 0,markers:e.markers,autoSchedule:!!w?.dependenciesField,rescheduleOnConflict:!!w?.dependenciesField,criticalPathDefault:!!e.criticalPath,workingCalendar:Ae,shiftSegments:je,showBaselines:e.showBaselines!==!1,readOnly:!!e.readOnly,mobileReadOnly:e.mobileReadOnly!==!1,persistLayoutKey:Fe,onLayoutChange:Ie?ze:void 0,groupBy:k,defaultCollapsedDepth:w?.defaultCollapsedDepth,summaryExtent:w?.summaryExtent,interactions:w?.interactions,dependencyTypes:w?.dependencyTypes,timeZone:w?.timeZone,onBeforeTaskUpdate:d,exportFileName:String(w?.exportFileName??e.label??y?.label??e.objectName??``)||void 0,inlineEdit:!0,onRefresh:(C?.provider===`object`||C?.provider===`api`)&&typeof T?.find==`function`?()=>Ee({silent:!0}):void 0,refreshing:ge})}),Ye.isOverlay&&Ye.isOpen&&Ye.selectedRecord&&(()=>{let n=Ye.selectedRecord,r=Ue(n);if(!r||P(n))return null;let{objectName:i,recordId:a}=r,o=r.href??void 0,s=w?.titleField?String(n[w.titleField]??S(`gantt.drawer.fallbackTitle`)):S(`gantt.drawer.fallbackTitle`),c=!!e.readOnly||(w?.lockField?!!n[w.lockField]:!1),l=Xe?.key===`${i}:${a}`?Xe:null,u=l?.record??n,d=l?.schema??(i===E?y:void 0),f=l&&t?t:T;return(0,F.jsx)(Oe,{open:!0,onClose:Ye.close,title:s,record:u,objectName:i,recordId:a,dataSource:f??void 0,objectSchema:d,width:Ye.width,fullPageHref:o,onFieldSave:c?void 0:async(e,t)=>{if(f?.update){try{await f.update(i,String(a),{[e]:t})}catch(e){let t=jt(e);throw t?Error(t):e}l&&Ze(n=>n&&n.key===l.key?{...n,record:{...n.record,[e]:t}}:n),m(n=>n.map(n=>String(n.id??n._id)===String(a)?{...n,[e]:t}:n)),Ee({silent:!0})}},onDelete:c?void 0:async()=>{if(T?.delete){try{if(await T.delete(i,String(a))===!1)throw Error(S(`gantt.writeFailed`))}catch(e){throw se(e),e}m(e=>e.filter(e=>String(e.id??e._id)!==String(a)))}}})})(),(0,F.jsx)(Te,{open:!!rt,onOpenChange:e=>{!e&&!it&&L(null)},children:(0,F.jsxs)(oe,{children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(g,{children:S(`gantt.delete.title`)}),(0,F.jsx)(h,{children:rt?S(`gantt.delete.body`,{title:rt.title}):null})]}),(0,F.jsxs)(Ce,{children:[(0,F.jsx)(we,{disabled:it,children:S(`gantt.delete.cancel`)}),(0,F.jsx)(fe,{onClick:e=>{e.preventDefault(),st()},disabled:it,"data-testid":`gantt-delete-confirm`,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(it?`gantt.delete.deleting`:`gantt.delete.confirm`)})]})]})})]}):(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsx)(`div`,{className:`text-muted-foreground`,children:`Gantt configuration required. Please specify startDateField, endDateField, and titleField.`})})})},Nt=t({GanttView:()=>R,ObjectGantt:()=>V,ObjectGanttRenderer:()=>H,QuickFilterBar:()=>Tt,ResourceWorkload:()=>yt,bandAt:()=>We,computeWorkload:()=>mt,normalizeDependencies:()=>Ot,normalizeShiftSegments:()=>He,normalizeTaskType:()=>Et,parseHHMM:()=>P,shiftDayStart:()=>Ue}),H=({schema:e})=>{let{dataSource:t}=d()||{};return(0,F.jsx)(V,{schema:e,dataSource:t})};u.register(`object-gantt`,H,{namespace:`plugin-gantt`,label:`Object Gantt`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`gantt`,type:`object`,label:`Gantt Config`,description:`startDateField, endDateField, titleField, progressField, percentageField, colorField, dependenciesField`}]}),u.register(`gantt`,H,{namespace:`view`,label:`Gantt View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`gantt`,type:`object`,label:`Gantt Config`,description:`startDateField, endDateField, titleField, progressField, percentageField, colorField, dependenciesField`}]});export{Nt as t};
63
+ `}),(0,F.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 p-2 border-b bg-card`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":M(`gantt.toolbar.prevPeriod`),children:(0,F.jsx)(_,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":M(`gantt.toolbar.nextPeriod`),children:(0,F.jsx)(se,{className:`h-4 w-4`})}),(0,F.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:q.start.toLocaleDateString(N,{month:`long`,year:`numeric`})}),P&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,"data-testid":`gantt-readonly-badge`,title:M(`gantt.readOnlyHint`),children:[(0,F.jsx)(te,{className:`h-3 w-3`}),M(`gantt.readOnly`)]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex bg-muted rounded-md p-1`,role:`group`,"aria-label":M(`gantt.toolbar.viewMode`),children:et.map(e=>(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:v(`h-6 px-1.5 sm:px-2 text-xs`,B===e&&`bg-background shadow-sm hover:bg-background`),onClick:()=>Xn(e),"aria-pressed":B===e,"data-testid":`gantt-view-mode-${e}`,children:M(`gantt.viewMode.${e}`)},e))}),(0,F.jsxs)(`div`,{className:`flex bg-muted rounded-md p-1`,children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{if(H>15)St(Math.max(15,H-10));else{let e=et.indexOf(B);e<et.length-1&&(Xn(et[e+1]),St(vt))}},"aria-label":M(`gantt.toolbar.zoomOut`),children:(0,F.jsx)(ge,{className:`h-3 w-3`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-6 w-6`,onClick:()=>{if(H<120)St(Math.min(120,H+10));else{let e=et.indexOf(B);e>0&&(Xn(et[e-1]),St(vt))}},"aria-label":M(`gantt.toolbar.zoomIn`),children:(0,F.jsx)(y,{className:`h-3 w-3`})})]}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>At(e=>!e),"aria-label":M(kt?`gantt.toolbar.showTaskList`:`gantt.toolbar.hideTaskList`),"aria-pressed":kt,"data-testid":`gantt-toggle-task-list`,children:kt?(0,F.jsx)(xe,{className:`h-4 w-4`}):(0,F.jsx)(T,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:Tr,disabled:wr==null,"aria-label":M(`gantt.toolbar.jumpToToday`),"data-testid":`gantt-jump-today`,children:M(`gantt.toolbar.today`)}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:kr,"aria-label":M(`gantt.toolbar.thisWeek`),"data-testid":`gantt-jump-week`,children:M(`gantt.toolbar.thisWeek`)}),(0,F.jsx)(b,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-xs`,onClick:Ar,"aria-label":M(`gantt.toolbar.thisMonth`),"data-testid":`gantt-jump-month`,children:M(`gantt.toolbar.thisMonth`)}),Ce?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>void Ce(),disabled:we,"aria-label":M(`gantt.toolbar.refresh`),"aria-busy":we,"data-testid":`gantt-refresh`,children:(0,F.jsx)(ce,{className:`h-4 w-4`})}):null,I?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:ln,disabled:!dn,"aria-label":M(`gantt.toolbar.undo`),"data-testid":`gantt-undo`,children:(0,F.jsx)(w,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:un,disabled:!fn,"aria-label":M(`gantt.toolbar.redo`),"data-testid":`gantt-redo`,children:(0,F.jsx)(le,{className:`h-4 w-4`})})]}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>fi(e=>!e),"aria-label":M(`gantt.toolbar.criticalPath`),"aria-pressed":di,"data-testid":`gantt-critical-path`,style:di?{color:$}:void 0,children:(0,F.jsx)(E,{className:`h-4 w-4`})}),gt&&I?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:yi,"aria-label":M(`gantt.toolbar.autoSchedule`),"data-testid":`gantt-auto-schedule`,children:(0,F.jsx)(m,{className:`h-4 w-4`})}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:Ci,"aria-label":M(`gantt.toolbar.exportPng`),"data-testid":`gantt-export-png`,children:(0,F.jsx)(de,{className:`h-4 w-4`})}),(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:wi,"aria-label":M(`gantt.toolbar.exportPdf`),"data-testid":`gantt-export-pdf`,children:(0,F.jsx)(C,{className:`h-4 w-4`})}),be||ye?(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:Di,"aria-label":M(`gantt.toolbar.saveLayout`),"aria-pressed":Ti,"data-testid":`gantt-save-layout`,style:Ti?{color:$}:void 0,children:(0,F.jsx)(Ee,{className:`h-4 w-4`})}):null,(0,F.jsx)(b,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:yr,"aria-label":M(_r?`gantt.toolbar.exitFullscreen`:`gantt.toolbar.enterFullscreen`),"aria-pressed":_r,"data-testid":`gantt-fullscreen`,children:_r?(0,F.jsx)(ie,{className:`h-4 w-4`}):(0,F.jsx)(p,{className:`h-4 w-4`})})]})]}),(0,F.jsxs)(`div`,{className:`relative flex flex-col flex-1 overflow-hidden outline-none focus-visible:ring-1 focus-visible:ring-ring`,tabIndex:0,onKeyDown:Hn,"data-testid":`gantt-body`,children:[!kt&&V>0&&(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 z-30 group/splitter`,style:{left:V-3,width:7,cursor:`col-resize`},"data-testid":`gantt-list-resize`,role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=V,r=Math.max(160,Be-200),i=e=>{let i=Math.max(160,Math.min(n+(e.clientX-t),r));wt(i)},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a),document.body.style.cursor=``};document.body.style.cursor=`col-resize`,window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},onDoubleClick:()=>wt(null),children:(0,F.jsx)(`div`,{className:`absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border group-hover/splitter:w-[3px] group-hover/splitter:bg-primary transition-all`})}),(0,F.jsxs)(`div`,{className:`flex border-b bg-muted/30 shrink-0 h-10 gantt-sm-h50`,children:[(0,F.jsxs)(`div`,{className:`flex items-center font-medium text-xs text-muted-foreground px-2 sm:px-4 border-r bg-card z-20 shadow-sm`,style:{width:V,minWidth:V},children:[(0,F.jsx)(`div`,{className:`flex-1 truncate`,children:M(`gantt.column.taskName`)}),Ft&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right`,children:M(`gantt.column.start`)}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right`,children:M(`gantt.column.end`)})]}),a&&(0,F.jsx)(`div`,{className:`w-6 shrink-0 hidden sm:block`,style:{marginLeft:4},"aria-hidden":`true`,"data-testid":`gantt-header-open-spacer`})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-hidden`,ref:tr,children:(0,F.jsxs)(`div`,{className:`flex flex-col h-full`,style:{width:Kn},children:[(0,F.jsx)(`div`,{className:`relative border-b`,style:{height:`45%`},"data-testid":`gantt-header-groups`,children:$n.slice(hr.start,hr.end).map(e=>(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 flex items-center justify-center border-r text-[10px] font-medium text-muted-foreground overflow-hidden`,style:{left:e.offset,width:e.width},children:(0,F.jsx)(`span`,{className:`truncate px-1`,children:e.label})},e.key))}),(0,F.jsx)(`div`,{className:`relative flex-1`,"data-testid":`gantt-header-units`,children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t;return(0,F.jsxs)(`div`,{className:v(`absolute top-0 bottom-0 flex items-center justify-center gap-1 border-r text-xs text-muted-foreground overflow-hidden`,e.isWeekend&&`bg-muted/50`),style:{left:Y[n],width:e.width,backgroundColor:e.bandColor?`color-mix(in srgb, ${e.bandColor} 16%, transparent)`:void 0},children:[(0,F.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:e.label}),e.sublabel&&H>=32&&(0,F.jsx)(`span`,{className:`text-[10px] opacity-70`,children:e.sublabel})]},n)})})]})})]}),(0,F.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`gantt-task-list overflow-y-auto overflow-x-hidden border-r bg-card z-10 shadow-sm`,ref:nr,onScroll:Gr,style:{width:V,minWidth:V},role:`tree`,"aria-label":M(`gantt.aria.taskList`),children:[Q.startIdx>0&&(0,F.jsx)(`div`,{style:{height:Q.startIdx*z},"aria-hidden":`true`}),K.slice(Q.startIdx,Q.endIdx).map(e=>{let t=e.task,n=ht&&It===t.id,r=Rn.has(String(t.id)),i=Nn!=null&&String(Nn)===String(t.id);return(0,F.jsxs)(`div`,{className:v(`group/task-row relative flex items-center border-b px-2 sm:px-4 hover:bg-accent/50 cursor-pointer transition-colors`,i&&`bg-accent/50`),style:{height:z,touchAction:`manipulation`},role:`treeitem`,"data-testid":`gantt-task-row-${t.id}`,"aria-level":e.depth+1,"aria-selected":i,"aria-expanded":e.hasChildren?!r:void 0,draggable:!!mt&&!n&&!t.locked,onDragStart:mt?e=>{e.dataTransfer.setData(`text/plain`,String(t.id)),e.dataTransfer.effectAllowed=`move`}:void 0,onDragOver:mt?e=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`}:void 0,onDrop:mt?e=>{e.preventDefault();let n=e.dataTransfer.getData(`text/plain`);if(!n||n===String(t.id))return;let r=Ut.get(n);r&&String(r.parent??``)===String(t.parent??``)&&mt(r,t)}:void 0,onContextMenu:e=>In(t,e),onClick:()=>{Pn(t.id),n||Or(e.start,e.end,t.id)},onDoubleClick:()=>{n||(ht&&I&&!e.isSummary&&!t.locked?(Lt(t.id),zt({title:t.title,start:t.start.toLocaleDateString(`en-CA`),end:t.end.toLocaleDateString(`en-CA`),progress:String(t.progress)})):a?.(t))},children:[(0,F.jsxs)(`div`,{className:`flex-1 truncate font-medium text-xs sm:text-sm flex items-center gap-2`,style:e.depth>0?{paddingLeft:e.depth*14}:void 0,children:[e.hasChildren?(0,F.jsx)(`button`,{type:`button`,className:`h-4 w-4 shrink-0 flex items-center justify-center text-muted-foreground hover:text-foreground`,style:{marginLeft:-4},onClick:e=>{e.stopPropagation(),Bn(t.id)},"aria-expanded":!r,"aria-label":M(r?`gantt.row.expand`:`gantt.row.collapse`),"data-testid":`gantt-row-toggle-${t.id}`,children:r?(0,F.jsx)(se,{className:`h-3.5 w-3.5`}):(0,F.jsx)(ne,{className:`h-3.5 w-3.5`})}):(0,F.jsx)(`span`,{className:`w-3 shrink-0`,style:{marginLeft:-4},"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`w-2 h-2 rounded-full shrink-0`,style:{backgroundColor:t.color||`#3b82f6`}}),n?(0,F.jsx)(`input`,{className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.title||``,onChange:e=>zt(t=>({...t,title:e.target.value})),onKeyDown:e=>{e.key===`Enter`?(en([{task:t,changes:{title:Rt.title,start:new Date(Rt.start),end:new Date(Rt.end),progress:Number(Rt.progress)||0}}]),Lt(null)):e.key===`Escape`&&Lt(null)},onClick:e=>e.stopPropagation(),autoFocus:!0}):(0,F.jsxs)(`span`,{className:`flex flex-col min-w-0`,children:[(0,F.jsx)(`span`,{className:v(`truncate`,e.isSummary&&`font-semibold`),children:t.title}),(0,F.jsxs)(`span`,{className:`text-[10px] text-muted-foreground gantt-sm-hidden`,children:[e.start.toLocaleDateString(N,{month:`numeric`,day:`numeric`}),` → `,e.end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})]})]})]}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block`,hidden:!Ft,style:Ft?void 0:{display:`none`},children:n?(0,F.jsx)(`input`,{type:`date`,className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.start||``,onChange:e=>zt(t=>({...t,start:e.target.value})),onClick:e=>e.stopPropagation()}):e.start.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}),(0,F.jsx)(`div`,{className:`w-16 gantt-sm-w20 text-right text-xs text-muted-foreground hidden sm:block`,hidden:!Ft,style:Ft?void 0:{display:`none`},children:n?(0,F.jsx)(`input`,{type:`date`,className:`border rounded px-1 py-0.5 text-xs w-full bg-background`,value:Rt.end||``,onChange:e=>zt(t=>({...t,end:e.target.value})),onClick:e=>e.stopPropagation()}):e.end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}),a&&(0,F.jsx)(`div`,{className:`w-6 shrink-0 hidden sm:block`,style:{marginLeft:4},children:!n&&(0,F.jsx)(`button`,{type:`button`,title:M(`gantt.row.open`),"aria-label":M(`gantt.row.open`),"data-testid":`gantt-row-open-${t.id}`,className:`gantt-row-open-btn h-6 w-6 rounded-md flex items-center justify-center hover:bg-accent text-muted-foreground hover:text-foreground`,onClick:e=>{e.stopPropagation(),a(t)},children:(0,F.jsx)(Se,{className:`h-3.5 w-3.5`})})})]},t.id)}),Q.endIdx<K.length&&(0,F.jsx)(`div`,{style:{height:(K.length-Q.endIdx)*z},"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`flex-1 overflow-auto bg-background/50 relative [-webkit-overflow-scrolling:touch]`,ref:e=>{rr.current=e,Z.current=e},onScroll:Wr,onTouchStart:xr,onTouchMove:Sr,onTouchEnd:Cr,"data-testid":`gantt-timeline`,children:(0,F.jsxs)(`div`,{className:`relative`,style:{width:Kn},children:[wr!=null&&(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px z-20 pointer-events-none`,style:{left:wr,backgroundColor:`rgba(239, 68, 68, 0.8)`},"data-testid":`gantt-today-marker`,"aria-label":M(`gantt.toolbar.today`),children:(0,F.jsx)(`div`,{className:`absolute -translate-x-1/2 left-0 text-[10px] font-semibold text-white rounded-sm px-1 py-0.5 whitespace-nowrap z-30`,style:{top:2,backgroundColor:`#ef4444`},children:M(`gantt.toolbar.today`)})}),er.map(e=>(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 w-px z-20 pointer-events-none`,style:{left:e.left,backgroundColor:e.color},"data-testid":`gantt-marker-${e.index}`,"aria-label":e.label,children:e.label&&(0,F.jsx)(`div`,{className:`absolute -translate-x-1/2 left-0 text-[10px] font-semibold text-white rounded-sm px-1 py-0.5 whitespace-nowrap z-30`,style:{top:2,backgroundColor:e.color},children:e.label})},e.index)),(0,F.jsxs)(`div`,{className:`relative`,ref:yn,children:[(0,F.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,style:{zIndex:0},children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t;return(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0 border-r`,style:{left:Y[n],width:e.width,backgroundColor:e.bandColor?`color-mix(in srgb, ${e.bandColor} 8%, transparent)`:e.isWeekend?`hsl(var(--muted) / 0.4)`:void 0}},n)})}),Un&&S&&S.showMidnight&&(0,F.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,style:{zIndex:0},children:J.slice(pr.start,pr.end).map((e,t)=>{let n=pr.start+t,r=e.realMs??0;if(!r)return null;let i=e.date.getTime(),a=e.date,o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1,0,0,0,0).getTime();return o<=i||o>=i+r?null:(0,F.jsx)(`div`,{className:`absolute top-0 bottom-0`,style:{left:Y[n]+(o-i)/r*e.width,borderLeft:`1px dashed hsl(var(--muted-foreground) / 0.4)`},"data-testid":`gantt-midnight-${n}`,"aria-hidden":`true`},`midnight-${n}`)})}),Q.startIdx>0&&(0,F.jsx)(`div`,{style:{height:Q.startIdx*z},"aria-hidden":`true`}),K.slice(Q.startIdx,Q.endIdx).map((e,t)=>{let n=e.task,r=Q.startIdx+t,i=mi(n.id),a=Kr(e.start,e.end),o=ue&&n.baselineStart&&n.baselineEnd?Kr(n.baselineStart,n.baselineEnd):null,s=o?(0,F.jsx)(`div`,{className:`absolute pointer-events-none rounded-[1px]`,style:{left:o.left,width:Math.max(2,o.width),top:oi,height:ai,backgroundColor:si,border:`1px solid ${ci}`},"data-testid":`gantt-baseline-${n.id}`,"aria-hidden":`true`}):null,c=W?.taskId===n.id,l=Jr?.has(String(n.id))??!1,u=Yr?.has(String(n.id))??!1,d=c||l||u?Xr(e):a,f=!!n.locked,p=!!I&&!e.isSummary&&!f,m=p&&He,h=p&&We,g=p&&Ge,_=m||h,ee=P||f,te=G!=null&&G.targetId!=null&&String(G.targetId)===String(n.id)&&String(G.sourceId)!==String(n.id),ne=G?e=>{let t=e.currentTarget.getBoundingClientRect(),r=t.width>0&&e.clientX-t.left>t.width/2?`end`:`start`;bn(e=>e&&vn(e.sourceId,n)?{...e,targetId:n.id,targetEnd:r}:e)}:void 0,re=G?e=>{e.target===e.currentTarget&&bn(e=>e&&{...e,targetId:null,targetEnd:null})}:void 0,y=Math.max(1,Math.round((e.end.getTime()-e.start.getTime())/nt)),b=(r+1)*z+300>gr&&r*z>300,ie=Bt===n.id&&!W&&!mn&&!G?(0,F.jsxs)(`div`,{className:`absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2.5 py-1.5 text-xs shadow-md whitespace-nowrap`,style:{left:Math.max(d.left+8,4),...b?{bottom:z-8}:{top:z-8}},role:`tooltip`,"data-testid":`gantt-tooltip-${n.id}`,children:[(0,F.jsx)(`div`,{className:`font-semibold`,children:n.title}),n.fields&&n.fields.length>0?(0,F.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`auto 1fr`,columnGap:10,rowGap:2,marginTop:4},children:n.fields.map((e,t)=>(0,F.jsxs)(D.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,F.jsx)(`span`,{style:{fontWeight:500},children:e.value})]},t))}):(0,F.jsxs)(`div`,{className:`text-muted-foreground`,children:[e.start.toLocaleDateString(N,{month:`short`,day:`numeric`}),` → `,e.end.toLocaleDateString(N,{month:`short`,day:`numeric`}),` · `,y,M(`gantt.tooltip.days`),` · `,Math.round(e.progress),`%`]}),n.locked||P&&!I?(0,F.jsxs)(`div`,{className:`text-muted-foreground`,style:{marginTop:4},"data-testid":`gantt-tooltip-locked-${n.id}`,children:[`🚫 `,M(`gantt.lockedHint`)]}):null]}):null;if(n.type===`group`)return(0,F.jsx)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:ie},n.id);if(e.isSummary){let t=n.color||`#0d9488`,r=ve===`self`&&n.hasOwnDates!==!1,a=!!I&&He&&!f,o=!!I&&We&&r&&!f;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:[s,(0,F.jsxs)(`div`,{className:v(`gantt-bar-hover absolute rounded-sm border shadow-sm flex items-center px-2 select-none group`,a&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left,width:d.width,top:ii,height:ri,cursor:a||o?void 0:ee?`not-allowed`:`pointer`,backgroundColor:t,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-summary-bar-${n.id}`,"data-progress":Math.round(e.progress),onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),onPointerMove:ne,onPointerDown:t=>{if(t.button===0){if(o){let e=Ye(t.clientX,t.currentTarget.getBoundingClientRect());if(e!==`move`){pn(n,e,t);return}}a&&pn(n,`move`,t,{group:!0,originStart:e.start,originEnd:e.end})}},onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),children:[(0,F.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 pointer-events-none`,style:{width:`${Math.round(e.progress)}%`,backgroundColor:`rgba(0, 0, 0, 0.2)`,borderTopLeftRadius:`var(--radius-sm)`,borderBottomLeftRadius:`var(--radius-sm)`}}),o&&d.width>=14&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute left-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-left-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-left`,e)},onClick:e=>e.stopPropagation()}),(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute right-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-right-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-right`,e)},onClick:e=>e.stopPropagation()})]}),(0,F.jsx)(`span`,{className:`relative text-[10px] text-white font-medium truncate pointer-events-none`,children:n.title}),R&&!f&&[`start`,`end`].map(e=>{let t=G!=null&&String(G.sourceId)===String(n.id)&&G.sourceEnd===e,r=t||Bt===n.id,i=r&&G==null;return(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity`,style:{[e===`start`?`left`:`right`]:-28,height:24,width:30,cursor:`crosshair`,opacity:+!!r,pointerEvents:i?`auto`:`none`,justifyContent:e===`start`?`flex-start`:`flex-end`,paddingLeft:e===`start`?4:0,paddingRight:e===`end`?4:0},"data-testid":`gantt-link-dot-${e}-${n.id}`,onPointerDown:t=>{if(t.button!==0)return;t.stopPropagation(),t.preventDefault();let r=yn.current?.getBoundingClientRect();bn({sourceId:n.id,sourceEnd:e,x:r?t.clientX-r.left:0,y:r?t.clientY-r.top:0,targetId:null,targetEnd:null})},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{className:`rounded-full`,style:{height:12,width:12,backgroundColor:`hsl(var(--background))`,border:`2px solid hsl(var(--primary))`,boxShadow:t?`0 0 0 3px hsl(var(--primary) / 0.25)`:`0 1px 2px rgba(0,0,0,0.25)`}})},e)})]}),c&&W&&(0,F.jsxs)(`div`,{className:`absolute z-30 pointer-events-none rounded border bg-popover text-popover-foreground px-1.5 py-0.5 text-[10px] shadow whitespace-nowrap`,style:{left:Math.max(d.left,4),top:ii+ri+2},"data-testid":`gantt-summary-drag-chip-${n.id}`,children:[Jt(W).start.toLocaleDateString(N,{month:`numeric`,day:`numeric`}),` → `,Jt(W).end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})]}),ie]},n.id)}if(e.isMilestone){let e=ti;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,children:[s,(0,F.jsx)(`div`,{className:v(`gantt-bar-hover absolute rotate-45 rounded-[2px] border shadow-sm select-none`,m&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left-e/2,top:(z-e)/2,width:e,height:e,cursor:m?void 0:ee?`not-allowed`:`pointer`,backgroundColor:i?$:n.color||`#3b82f6`,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-milestone-${n.id}`,onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),onPointerMove:ne,onPointerDown:m?e=>{e.button===0&&pn(n,`move`,e)}:void 0}),ie]},n.id)}let ae=mn&&mn.taskId===n.id?mn.value:n.progress;return(0,F.jsxs)(`div`,{className:`relative border-b hover:bg-accent/50`,style:{height:z},onPointerMove:re,onMouseEnter:()=>Vt(n.id),onMouseLeave:()=>Vt(e=>e===n.id?null:e),children:[c&&(0,F.jsx)(`div`,{className:`absolute rounded-sm border border-dashed pointer-events-none`,style:{left:a.left,width:a.width,top:Qr,height:$r,opacity:.35,borderColor:`hsl(var(--primary) / 0.6)`},"aria-hidden":`true`}),s,(0,F.jsxs)(`div`,{className:v(`gantt-bar-hover absolute rounded-sm bg-primary border shadow-sm flex items-center px-2 group select-none`,_&&`cursor-grab active:cursor-grabbing`,c&&`ring-2 ring-primary z-10`,te&&`ring-2 ring-primary`,ir===n.id&&`gantt-flash z-10`),style:{left:d.left,width:d.width,top:Qr,height:$r,cursor:_?void 0:ee?`not-allowed`:`pointer`,backgroundColor:n.color||`#3b82f6`,borderColor:i?$:n.borderColor||`hsl(var(--primary-foreground) / 0.2)`,boxShadow:i?`0 0 0 2px ${$}`:n.borderColor?`0 0 0 2px ${n.borderColor}`:void 0},"data-critical":i?`true`:void 0,"data-testid":`gantt-task-bar-${n.id}`,onClick:()=>{qt.current||Pn(n.id)},onContextMenu:e=>In(n,e),onPointerMove:ne,onPointerDown:_?e=>{if(e.button!==0)return;let t=Ye(e.clientX,e.currentTarget.getBoundingClientRect()),r=t!==`move`&&h?t:m?`move`:null;r&&pn(n,r,e)}:void 0,children:[h&&d.width>=14&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute left-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-left-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-left`,e)},onClick:e=>e.stopPropagation()}),(0,F.jsx)(`div`,{className:`gantt-resize-handle absolute right-0 top-0`,style:{width:Je,height:ei,cursor:`ew-resize`},"data-testid":`gantt-task-resize-right-${n.id}`,onPointerDown:e=>{e.button===0&&pn(n,`resize-right`,e)},onClick:e=>e.stopPropagation()})]}),ae>0&&(0,F.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 pointer-events-none`,style:{width:`${ae}%`,backgroundColor:`rgba(0, 0, 0, 0.2)`,borderTopLeftRadius:`var(--radius-sm)`,borderBottomLeftRadius:`var(--radius-sm)`}}),g&&d.width>=30&&(0,F.jsx)(`div`,{className:v(`absolute bottom-0 h-1/2 w-4 -translate-x-1/2 cursor-col-resize flex items-end justify-center pb-px`,mn?.taskId===n.id?`opacity-100`:`opacity-0 group-hover:opacity-100 transition-opacity`),style:{left:`${ae}%`},"data-testid":`gantt-progress-handle-${n.id}`,onPointerDown:e=>{e.button===0&&(e.stopPropagation(),e.preventDefault(),hn({taskId:n.id,originClientX:e.clientX,originProgress:n.progress,barWidth:d.width,value:n.progress}))},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{style:{width:0,height:0,borderLeft:`5px solid transparent`,borderRight:`5px solid transparent`,borderBottom:`7px solid #fff`,filter:`drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35))`}})}),R&&!f&&[`start`,`end`].map(e=>{let t=G!=null&&String(G.sourceId)===String(n.id)&&G.sourceEnd===e,r=t||Bt===n.id,i=r&&G==null;return(0,F.jsx)(`div`,{className:`absolute top-1/2 -translate-y-1/2 z-20 flex items-center transition-opacity`,style:{[e===`start`?`left`:`right`]:-28,height:24,width:30,cursor:`crosshair`,opacity:+!!r,pointerEvents:i?`auto`:`none`,justifyContent:e===`start`?`flex-start`:`flex-end`,paddingLeft:e===`start`?4:0,paddingRight:e===`end`?4:0},"data-testid":`gantt-link-dot-${e}-${n.id}`,onPointerDown:t=>{if(t.button!==0)return;t.stopPropagation(),t.preventDefault();let r=yn.current?.getBoundingClientRect();bn({sourceId:n.id,sourceEnd:e,x:r?t.clientX-r.left:0,y:r?t.clientY-r.top:0,targetId:null,targetEnd:null})},onClick:e=>e.stopPropagation(),children:(0,F.jsx)(`div`,{className:`rounded-full`,style:{height:12,width:12,backgroundColor:`hsl(var(--background))`,border:`2px solid hsl(var(--primary))`,boxShadow:t?`0 0 0 3px hsl(var(--primary) / 0.25)`:`0 1px 2px rgba(0,0,0,0.25)`}})},e)}),(0,F.jsx)(`span`,{className:`relative text-[10px] text-white font-medium truncate pointer-events-none group-hover:opacity-0 transition-opacity`,children:n.title}),(0,F.jsx)(`span`,{className:`absolute inset-0 flex items-center px-2 text-[10px] text-white font-medium truncate opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none`,children:c?`${Jt(W).start.toLocaleDateString(N,{month:`numeric`,day:`numeric`})} → ${Jt(W).end.toLocaleDateString(N,{month:`numeric`,day:`numeric`})}`:`${Math.round(ae)}%`})]}),ie]},n.id)}),Q.endIdx<K.length&&(0,F.jsx)(`div`,{style:{height:(K.length-Q.endIdx)*z},"aria-hidden":`true`}),(Zr.length>0||G)&&(0,F.jsxs)(`svg`,{className:`absolute top-0 left-0 pointer-events-none z-10`,width:Kn,height:gr,"data-testid":`gantt-links`,"aria-hidden":`true`,children:[(0,F.jsxs)(`defs`,{children:[(0,F.jsx)(`marker`,{id:`gantt-link-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`hsl(var(--muted-foreground))`})}),(0,F.jsx)(`marker`,{id:`gantt-link-arrow-active`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:`hsl(var(--primary))`})}),(0,F.jsx)(`marker`,{id:`gantt-link-arrow-critical`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,F.jsx)(`path`,{d:`M 0 0 L 8 4 L 0 8 z`,fill:$})})]}),Zr.map(e=>{let t=Math.min(e.sourceIndex,e.targetIndex);if(Math.max(e.sourceIndex,e.targetIndex)<Q.startIdx-6||t>Q.endIdx+6)return null;let n=li(e);if(!n)return null;let r=ui!=null&&(String(e.sourceId)===String(ui)||String(e.targetId)===String(ui)),i=pi?.criticalEdges.has(`${String(e.sourceId)}->${String(e.targetId)}`)??!1,a=i?`gantt-link-arrow-critical`:r?`gantt-link-arrow-active`:`gantt-link-arrow`,o=!!(pt||R);return(0,F.jsxs)(D.Fragment,{children:[(0,F.jsx)(`path`,{d:n,fill:`none`,stroke:i?$:r?`hsl(var(--primary))`:`hsl(var(--muted-foreground))`,strokeOpacity:i||r?1:.7,strokeWidth:i||r?2:1.5,markerEnd:`url(#${a})`,"data-testid":`gantt-link-${e.sourceId}-${e.targetId}`,"data-link-type":e.type,"data-active":r?`true`:`false`,"data-critical":i?`true`:void 0}),o&&(0,F.jsx)(`path`,{d:n,fill:`none`,stroke:`transparent`,strokeWidth:10,style:{pointerEvents:`stroke`,cursor:`context-menu`},"data-testid":`gantt-link-hit-${e.sourceId}-${e.targetId}`,onContextMenu:t=>Ln(e.sourceId,e.targetId,e.type,t)})]},e.key)}),G&&(()=>{let e=K.findIndex(e=>String(e.task.id)===String(G.sourceId));if(e<0)return null;let t=Xr(K[e]),n=K[e].isMilestone?t.left+(G.sourceEnd===`start`?-ni:ni):G.sourceEnd===`start`?t.left:t.left+t.width,r=e*z+z/2;return(0,F.jsx)(`path`,{d:`M ${Math.round(n)} ${Math.round(r)} L ${Math.round(G.x)} ${Math.round(G.y)}`,fill:`none`,stroke:`hsl(var(--primary))`,strokeWidth:1.5,strokeDasharray:`4 3`,"data-testid":`gantt-link-draft`})})()]}),G&&(()=>{let e=A.find(e=>String(e.id)===String(G.sourceId));if(!e)return null;let t=G.targetId==null?null:A.find(e=>String(e.id)===String(G.targetId)),n=e=>M(`gantt.linkEnd.${e}`),r=t?`${e.title} (${n(G.sourceEnd)}) → ${t.title} (${n(G.targetEnd??`start`)})`:`${e.title} (${n(G.sourceEnd)})`;return(0,F.jsx)(`div`,{className:`absolute z-30 pointer-events-none rounded-md border bg-popover text-popover-foreground px-2 py-1 text-[11px] font-medium shadow-md whitespace-nowrap`,style:{left:G.x+12,top:G.y+12},"data-testid":`gantt-link-draft-hint`,children:r})})()]})]})}),(0,F.jsx)(`div`,{ref:Fr,className:`shrink-0 border-l bg-card/95 select-none`,style:{width:14,display:`none`},"data-testid":`gantt-vscrollbar`,children:(0,F.jsx)(`div`,{ref:Ir,className:`relative h-full`,onPointerDown:Ur,role:`scrollbar`,"aria-controls":`gantt-timeline`,"aria-orientation":`vertical`,children:(0,F.jsx)(`div`,{ref:Lr,className:`absolute rounded-full`,style:{left:2,right:2,top:0,height:0,backgroundColor:`rgba(130,130,130,0.55)`,cursor:`grab`},"data-testid":`gantt-vscrollbar-thumb`,onPointerDown:Hr})})})]}),(0,F.jsx)(`div`,{ref:jr,className:`shrink-0 border-t bg-card/95 select-none`,style:{position:`sticky`,bottom:0,zIndex:30,display:`none`},"data-testid":`gantt-hscrollbar`,children:(0,F.jsx)(`div`,{ref:Mr,className:`relative`,style:{marginLeft:V,height:14},onPointerDown:Vr,role:`scrollbar`,"aria-controls":`gantt-timeline`,"aria-orientation":`horizontal`,children:(0,F.jsx)(`div`,{ref:Nr,className:`absolute rounded-full`,style:{top:2,bottom:2,left:0,width:0,backgroundColor:`rgba(130,130,130,0.55)`,cursor:`grab`},"data-testid":`gantt-hscrollbar-thumb`,onPointerDown:Br})})})]}),Sn&&(()=>{let e=A.find(e=>String(e.id)===String(Sn.taskId));if(!e)return null;let t=K.find(e=>String(e.task.id)===String(Sn.taskId)),n=`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none`;return(0,F.jsxs)(`div`,{ref:wn,className:`fixed z-50 min-w-[160px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:Sn.x,top:Sn.y},role:`menu`,"data-testid":`gantt-context-menu`,children:[a&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-view`,onClick:()=>{Cn(null),a(e)},children:M(`gantt.menu.view`)}),ht&&I&&t&&!t.isSummary&&!e.locked&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-edit`,onClick:()=>{Cn(null),Lt(e.id),zt({title:e.title,start:e.start.toLocaleDateString(`en-CA`),end:e.end.toLocaleDateString(`en-CA`),progress:String(e.progress)})},children:M(`gantt.menu.edit`)}),R&&t&&!t.isMilestone&&!e.locked&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-add-predecessor`,onClick:()=>{let t=Sn;Cn(null),jn(``),kn({x:t.x,y:t.y,taskId:e.id,relation:`pred`})},children:M(`gantt.menu.addPredecessor`)}),(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:n,"data-testid":`gantt-context-menu-add-successor`,onClick:()=>{let t=Sn;Cn(null),jn(``),kn({x:t.x,y:t.y,taskId:e.id,relation:`succ`})},children:M(`gantt.menu.addSuccessor`)})]}),ut&&!e.locked&&(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:v(n,`text-destructive`),"data-testid":`gantt-context-menu-delete`,onClick:()=>{Cn(null),ut(e)},children:M(`gantt.menu.delete`)})]})})(),Tn&&(()=>{let e=A.find(e=>String(e.id)===String(Tn.sourceId)),t=A.find(e=>String(e.id)===String(Tn.targetId));if(!e||!t)return null;let n=`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none`,r=[`fs`,`ss`,`ff`,`sf`],i=!!t.locked;return(0,F.jsxs)(`div`,{ref:Dn,className:`fixed z-50 min-w-[180px] rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:Tn.x,top:Tn.y},role:`menu`,"data-testid":`gantt-link-context-menu`,children:[(0,F.jsxs)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground truncate`,children:[e.title,` → `,t.title]}),i&&(0,F.jsxs)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,"data-testid":`gantt-link-menu-locked`,children:[`🚫 `,M(`gantt.lockedHint`)]}),R&&Te&&r.map(r=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":Tn.type===r,disabled:i,className:v(n,Tn.type===r&&`font-semibold`,i&&`opacity-50 cursor-not-allowed hover:bg-transparent`),"data-testid":`gantt-link-menu-type-${r}`,onClick:()=>{i||(En(null),r!==Tn.type&&R(e,t,r))},children:[Tn.type===r?`✓ `:`\xA0\xA0`,M(`gantt.linkType.${r}`)]},r)),pt&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`my-1 border-t`}),(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:i,className:v(n,`text-destructive`,i&&`opacity-50 cursor-not-allowed hover:bg-transparent`),"data-testid":`gantt-link-menu-remove`,onClick:()=>{i||(En(null),pt(e,t))},children:M(`gantt.menu.removeDependency`)})]})]})})(),On&&R&&(()=>{let e=A.find(e=>String(e.id)===String(On.taskId));if(!e)return null;let t=new Set(Zr.map(e=>`${String(e.sourceId)}->${String(e.targetId)}`)),n=A.filter(n=>{if(String(n.id)===String(e.id)||n.type===`group`||n.locked)return!1;let r=On.relation===`pred`?`${String(n.id)}->${String(e.id)}`:`${String(e.id)}->${String(n.id)}`;return!t.has(r)}),r=An.trim().toLowerCase(),i=r?n.filter(e=>String(e.title??``).toLowerCase().includes(r)):n;return(0,F.jsxs)(`div`,{ref:Mn,className:`fixed z-50 min-w-[200px] max-h-[280px] overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md py-1 text-sm`,style:{left:On.x,top:On.y},role:`menu`,"data-testid":`gantt-dep-picker`,children:[(0,F.jsx)(`div`,{className:`px-3 py-1 text-xs text-muted-foreground`,children:On.relation===`pred`?M(`gantt.menu.addPredecessor`):M(`gantt.menu.addSuccessor`)}),(0,F.jsx)(`div`,{className:`px-2 pb-1`,children:(0,F.jsx)(`input`,{className:`border rounded px-2 py-1 text-sm w-full bg-background`,value:An,onChange:e=>jn(e.target.value),placeholder:M(`gantt.menu.searchTasks`),"data-testid":`gantt-dep-picker-search`,autoFocus:!0})}),i.length===0?(0,F.jsx)(`div`,{className:`px-3 py-1.5 text-muted-foreground`,children:M(`gantt.menu.noCandidates`)}):i.map(t=>(0,F.jsx)(`button`,{type:`button`,role:`menuitem`,className:`w-full text-left px-3 py-1.5 hover:bg-accent focus:bg-accent outline-none truncate`,"data-testid":`gantt-dep-picker-option-${t.id}`,onClick:()=>{kn(null),On.relation===`pred`?R(t,e,`fs`):R(e,t,`fs`)},children:t.title},String(t.id)))]})})(),hi&&(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/30`,"data-testid":`gantt-autoschedule-overlay`,onClick:()=>gi(null),children:(0,F.jsxs)(`div`,{className:`min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4`,role:`alertdialog`,"aria-modal":`true`,"data-testid":`gantt-autoschedule-dialog`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`text-sm font-semibold mb-1`,"data-testid":`gantt-autoschedule-title`,children:M(`gantt.autoScheduleDlg.title`)}),(0,F.jsxs)(`div`,{className:`text-sm text-muted-foreground mb-3`,children:[M(`gantt.autoScheduleDlg.body`).replace(`{count}`,String(hi.changes.length)),hi.skipped>0&&(0,F.jsxs)(F.Fragment,{children:[` `,(0,F.jsx)(`span`,{"data-testid":`gantt-autoschedule-skipped`,children:M(`gantt.autoScheduleDlg.skipped`).replace(`{count}`,String(hi.skipped))})]})]}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none`,"data-testid":`gantt-autoschedule-cancel`,onClick:()=>gi(null),children:M(`gantt.autoScheduleDlg.cancel`)}),(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none`,"data-testid":`gantt-autoschedule-confirm`,onClick:bi,children:M(`gantt.autoScheduleDlg.confirm`)})]})]})}),_i&&(0,F.jsx)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-[60] rounded-md border bg-popover text-popover-foreground px-3 py-1.5 text-sm shadow-md`,role:`status`,"data-testid":`gantt-autoschedule-clean`,children:M(`gantt.autoScheduleDlg.none`)}),tn&&(0,F.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/30`,"data-testid":`gantt-conflict-overlay`,onClick:()=>nn(null),children:(0,F.jsxs)(`div`,{className:`min-w-[280px] max-w-[360px] rounded-lg border bg-popover text-popover-foreground shadow-lg p-4`,role:`alertdialog`,"aria-modal":`true`,"data-testid":`gantt-conflict-dialog`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`div`,{className:`text-sm font-semibold mb-1`,"data-testid":`gantt-conflict-title`,children:M(`gantt.conflict.title`)}),(0,F.jsx)(`div`,{className:`text-sm text-muted-foreground mb-3`,children:M(`gantt.conflict.body`).replace(`{count}`,String(tn.length))}),(0,F.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md border hover:bg-accent outline-none`,"data-testid":`gantt-conflict-cancel`,onClick:()=>nn(null),children:M(`gantt.conflict.cancel`)}),(0,F.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 text-sm rounded-md bg-primary text-primary-foreground hover:opacity-90 outline-none`,"data-testid":`gantt-conflict-confirm`,onClick:sn,children:M(`gantt.conflict.confirm`)})]})]})})]})}function pt(e,t,n,r){return t.getTime()===e.getTime()?e.getTime()>=n.getTime()&&e.getTime()<r.getTime():e.getTime()<r.getTime()&&t.getTime()>n.getTime()}function mt(e,t,n){let{assignee:r,effort:i,capacity:a=1,unassignedLabel:o=`Unassigned`}=n,s=e=>typeof a==`function`?a(e):a,c=e=>{let t=i?i(e):1;return Number.isFinite(t)&&t>0?t:0},l=new Map;for(let t of e){let e=r(t),n=e?String(e.key):`__unassigned__`,i=e?e.label:o,a=l.get(n);a||(a={key:n,label:i,items:[]},l.set(n,a)),a.items.push(t)}let u=[];for(let e of l.values()){let n=s(e.key),r=0,i=0,a=t.map(t=>{let a=0;for(let n of e.items)pt(n.start,n.end,t.start,t.end)&&(a+=c(n));a>r&&(r=a);let o=a>n+1e-9;return o&&i++,{load:a,capacity:n,overloaded:o}});u.push({key:e.key,label:e.label,capacity:n,cells:a,peak:r,overloadedCount:i})}return u}var ht={day:26,week:56,month:76,quarter:88,year:104},gt=48,_t=34,z=180;function vt(e,t,n){return t===`day`?String(e.getDate()):t===`week`?e.toLocaleDateString(n,{month:`numeric`,day:`numeric`}):t===`month`?e.toLocaleDateString(n,{month:`short`}):t===`year`?String(e.getFullYear()):`Q${Math.floor(e.getMonth()/3)+1}`}function yt({tasks:e,assignee:t,effort:n,capacity:r=1,viewMode:i=`day`,unassignedLabel:a=`Unassigned`,className:o}){let{t:s,language:c}=qe(),l=c||void 0,u=ht[i],d=D.useMemo(()=>{if(!e.length)return[];let t=new Date(Math.min(...e.map(e=>e.start.getTime()))),n=new Date(Math.max(...e.map(e=>e.end.getTime()))),r=L(t,i),a=at(L(n,i),1,i),o=[],s=0;for(;r<a&&s++<4e3;){let e=at(r,1,i);o.push({date:new Date(r),col:{start:new Date(r),end:new Date(e)},label:vt(r,i,l)}),r=e}return o},[e,i,l]),f=D.useMemo(()=>mt(e,d.map(e=>e.col),{assignee:t,effort:n,capacity:r,unassignedLabel:a}),[e,d,t,n,r,a]),p=D.useMemo(()=>{let e=0;for(let t of f)e=Math.max(e,t.peak,t.capacity);return e||1},[f]),m=d.length*u;return e.length?(0,F.jsx)(`div`,{className:o,"data-testid":`resource-workload`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`auto`},children:(0,F.jsxs)(`div`,{style:{display:`flex`,minWidth:z+m},children:[(0,F.jsxs)(`div`,{style:{width:z,flexShrink:0},children:[(0,F.jsx)(`div`,{style:{height:28,display:`flex`,alignItems:`center`,padding:`0 12px`,fontSize:12,fontWeight:600,borderBottom:`1px solid hsl(var(--border))`},children:s(`gantt.resource.header`)}),f.map(e=>(0,F.jsxs)(`div`,{"data-testid":`resource-row-${e.key}`,style:{height:gt,display:`flex`,flexDirection:`column`,justifyContent:`center`,padding:`0 12px`,borderBottom:`1px solid hsl(var(--border) / 0.5)`},children:[(0,F.jsx)(`span`,{style:{fontSize:13,fontWeight:500,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:e.label}),(0,F.jsxs)(`span`,{"data-testid":`resource-peak-${e.key}`,"data-overloaded":e.overloadedCount>0?`true`:void 0,style:{fontSize:10,color:e.overloadedCount>0?`hsl(var(--destructive))`:`hsl(var(--muted-foreground))`},children:[s(`gantt.resource.peak`),`: `,Math.round(e.peak*100)/100,` / `,e.capacity,e.overloadedCount>0?` · ${e.overloadedCount} ${s(`gantt.resource.over`)}`:``]})]},e.key))]}),(0,F.jsxs)(`div`,{style:{flex:1},children:[(0,F.jsx)(`div`,{style:{display:`flex`,height:28,borderBottom:`1px solid hsl(var(--border))`},children:d.map((e,t)=>(0,F.jsx)(`div`,{style:{width:u,flexShrink:0,textAlign:`center`,fontSize:10,color:`hsl(var(--muted-foreground))`,borderLeft:`1px solid hsl(var(--border) / 0.4)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:e.label},t))}),f.map(e=>{let t=_t*(1-Math.min(e.capacity/p,1));return(0,F.jsxs)(`div`,{style:{position:`relative`,display:`flex`,height:gt,borderBottom:`1px solid hsl(var(--border) / 0.5)`},children:[(0,F.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,left:0,right:0,top:(gt-_t)/2+t,borderTop:`1px dashed hsl(var(--muted-foreground) / 0.6)`,pointerEvents:`none`,zIndex:1}}),e.cells.map((t,n)=>{let r=Math.max(t.load>0?2:0,_t*Math.min(t.load/p,1));return(0,F.jsx)(`div`,{"data-testid":`resource-cell-${e.key}-${n}`,"data-load":t.load,"data-overloaded":t.overloaded?`true`:void 0,title:`${d[n]?.date.toLocaleDateString(l)} — ${Math.round(t.load*100)/100} / ${t.capacity}`,style:{width:u,flexShrink:0,position:`relative`,borderLeft:`1px solid hsl(var(--border) / 0.4)`,display:`flex`,alignItems:`flex-end`,justifyContent:`center`,paddingBottom:(gt-_t)/2},children:t.load>0&&(0,F.jsx)(`div`,{style:{width:u-6,height:r,borderRadius:2,backgroundColor:t.overloaded?`hsl(var(--destructive))`:`hsl(var(--primary))`,opacity:t.overloaded?.9:.75}})},n)})]},e.key)})]})]})}):(0,F.jsx)(`div`,{className:o,"data-testid":`resource-workload`,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-40 text-sm text-muted-foreground`,children:s(`gantt.resource.empty`)})})}var bt={display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8,padding:`8px 12px`,borderBottom:`1px solid hsl(var(--border))`,background:`hsl(var(--background))`,fontSize:13},xt={display:`inline-flex`,alignItems:`center`,gap:6,height:30,padding:`0 10px`,borderRadius:6,border:`1px solid hsl(var(--border))`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`,cursor:`pointer`,whiteSpace:`nowrap`,lineHeight:`28px`},St={position:`absolute`,top:`calc(100% + 4px)`,left:0,zIndex:50,minWidth:200,maxHeight:320,overflowY:`auto`,padding:4,borderRadius:8,border:`1px solid hsl(var(--border))`,background:`hsl(var(--popover, var(--background)))`,color:`hsl(var(--popover-foreground, var(--foreground)))`,boxShadow:`0 8px 24px rgba(0,0,0,0.18)`},Ct={display:`flex`,alignItems:`center`,gap:8,padding:`6px 8px`,borderRadius:6,cursor:`pointer`,userSelect:`none`};function wt({checked:e}){return(0,F.jsx)(`span`,{"aria-hidden":!0,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:15,height:15,flex:`0 0 auto`,borderRadius:3,border:`1px solid ${e?`hsl(var(--primary))`:`hsl(var(--border))`}`,background:e?`hsl(var(--primary))`:`transparent`,color:`hsl(var(--primary-foreground, var(--background)))`,fontSize:11,lineHeight:1},children:e?`✓`:``})}function B({filter:e,selected:t,onChange:n,labels:r}){let[i,a]=(0,D.useState)(!1),o=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(!i)return;let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=new Set(t),c=t.length,l=e.options.length>0&&c===e.options.length,u=t=>{let r=new Set(s);r.has(t)?r.delete(t):r.add(t),r.size===e.options.length?n([]):n([...r])},d=()=>{n(c>0?[]:e.options.map(e=>e.value))},f=c===0?e.label:c===1?`${e.label}: ${e.options.find(e=>e.value===t[0])?.label??t[0]}`:`${e.label} · ${c}`;return(0,F.jsxs)(`div`,{ref:o,style:{position:`relative`},"data-testid":`quick-filter-${e.field}`,children:[(0,F.jsxs)(`button`,{type:`button`,style:{...xt,borderColor:c>0?`hsl(var(--primary))`:`hsl(var(--border))`,color:c>0?`hsl(var(--primary))`:`hsl(var(--foreground))`},"aria-haspopup":`listbox`,"aria-expanded":i,"data-testid":`quick-filter-trigger-${e.field}`,onClick:()=>a(e=>!e),children:[(0,F.jsx)(`span`,{children:f}),(0,F.jsx)(`span`,{"aria-hidden":!0,style:{fontSize:10,opacity:.7},children:`▾`})]}),i&&(0,F.jsx)(`div`,{role:`listbox`,style:St,"data-testid":`quick-filter-panel-${e.field}`,children:e.options.length===0?(0,F.jsx)(`div`,{style:{...Ct,cursor:`default`,opacity:.6},children:r.empty}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{role:`option`,"aria-selected":l,style:{...Ct,fontWeight:600},"data-testid":`quick-filter-all-${e.field}`,onClick:()=>d(),children:[(0,F.jsx)(wt,{checked:l}),(0,F.jsx)(`span`,{children:r.all})]}),(0,F.jsx)(`div`,{style:{height:1,background:`hsl(var(--border))`,margin:`2px 0`}}),e.options.map(t=>{let n=s.has(t.value);return(0,F.jsxs)(`div`,{role:`option`,"aria-selected":n,style:{...Ct,background:n?`hsl(var(--accent, var(--muted)))`:`transparent`},"data-testid":`quick-filter-option-${e.field}-${t.value}`,onClick:()=>u(t.value),children:[(0,F.jsx)(wt,{checked:n}),(0,F.jsx)(`span`,{children:t.label})]},t.value)})]})})]})}var Tt=({filters:e,value:t,onChange:n,onClear:r,resultCount:i,totalCount:a,labels:o,className:s})=>{if(!e.length)return null;let c=o?.all??`All`,l=o?.empty??`No options`,u=o?.clear??`Clear`,d=e.some(e=>(t[e.field]?.length??0)>0);return(0,F.jsxs)(`div`,{style:bt,className:s,"data-testid":`quick-filter-bar`,children:[e.map(e=>(0,F.jsx)(B,{filter:e,selected:t[e.field]??[],onChange:t=>n(e.field,t),labels:{all:c,empty:l}},e.field)),d&&(0,F.jsx)(`button`,{type:`button`,style:{...xt,height:28,color:`hsl(var(--muted-foreground))`},"data-testid":`quick-filter-clear`,onClick:r,children:u}),o?.resultSummary&&i!=null&&a!=null&&(0,F.jsx)(`span`,{"data-testid":`quick-filter-summary`,style:{marginLeft:`auto`,color:`hsl(var(--muted-foreground))`},children:o.resultSummary(i,a)})]})};function Et(e){if(e==null)return;let t=String(e).toLowerCase().trim();if(t===`milestone`)return`milestone`;if(t===`group`||t===`folder`)return`group`;if(t===`summary`||t===`project`||t===`phase`)return`summary`;if(t===`task`)return`task`}var Dt={fs:`fs`,ss:`ss`,ff:`ff`,sf:`sf`,finish_to_start:`fs`,start_to_start:`ss`,finish_to_finish:`ff`,start_to_finish:`sf`,end_to_start:`fs`,end_to_end:`ff`,start_to_end:`sf`};function Ot(e){if(e==null||e===``)return[];if(typeof e==`string`)return e.split(`,`).map(e=>e.trim()).filter(Boolean);if(typeof e==`number`)return[e];if(!Array.isArray(e))return[];let t=[];for(let n of e)if(!(n==null||n===``))if(typeof n==`object`){let e=n.id??n._id??n.task??n.target;if(e==null||e===``)continue;let r=Dt[String(n.type??``).toLowerCase().replace(/-/g,`_`)];t.push(r?{id:e,type:r}:{id:e})}else t.push(n);return t}function kt(e){return e.data?e.data:e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function At(e){if(e){if(typeof e==`string`){let t=e.split(` `),n=t[0],r=t[1]?.toLowerCase()===`desc`?`desc`:`asc`;return{[n]:r}}if(Array.isArray(e))return e.reduce((e,t)=>(t.field&&t.order&&(e[t.field]=t.order),e),{})}}function jt(e){let t=e instanceof Error?e.message:String(e??``),n=t.indexOf(`{`);if(n>=0)try{let e=JSON.parse(t.slice(n)),r=e?.message??e?.error;if(typeof r==`string`&&r.trim())return r}catch{}return null}function Mt(e){let t=null;if(e.startDateField&&e.endDateField)return t={startDateField:e.startDateField,endDateField:e.endDateField,titleField:e.titleField||`name`,progressField:e.progressField,dependenciesField:e.dependenciesField||e.dependencyField,colorField:e.colorField,borderColorField:e.borderColorField,parentField:e.parentField,typeField:e.typeField,lockField:e.lockField,objectField:e.objectField,summaryExtent:e.summaryExtent,defaultCollapsedDepth:e.defaultCollapsedDepth,tooltipFields:e.tooltipFields,baselineStartField:e.baselineStartField,baselineEndField:e.baselineEndField,groupByField:e.groupByField,resourceView:e.resourceView,assigneeField:e.assigneeField,effortField:e.effortField,capacity:e.capacity,quickFilters:e.quickFilters,autoZoomToFilter:e.autoZoomToFilter,timeSegments:e.timeSegments,interactions:e.interactions,exportFileName:e.exportFileName,timeZone:e.timeZone,dependencyTypes:e.dependencyTypes},t;if(e.gantt&&(t=e.gantt),t){let e=f.safeParse(t);return e.success||console.warn(`[ObjectGantt] Invalid gantt configuration:`,e.error.format()),t}return null}var V=({schema:e,dataSource:t,className:n,onTaskClick:r,onRowClick:u,onBeforeTaskUpdate:d,...f})=>{let[p,m]=(0,D.useState)([]),[_,te]=(0,D.useState)(!0),[ne,re]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),{currency:ie}=ee(),{t:S}=qe(),se=(0,D.useCallback)(e=>{De.error(S(`gantt.writeFailed`),{description:jt(e)??void 0})},[S]),ce=kt(e),C=(0,D.useMemo)(()=>ce,[JSON.stringify(ce)]),w=Mt(e),le=C?.provider===`value`,de=(0,D.useContext)(l)?.apiFetch,T=(0,D.useMemo)(()=>o(C,t??null,{fetch:de}),[C,t,de]),E=C?.provider===`object`?C.object:e.objectName??``,[ge,xe]=(0,D.useState)(!1),Se=(0,D.useRef)(0),Ee=(0,D.useCallback)(async({silent:t=!1}={})=>{let n=++Se.current,r=()=>Se.current===n;try{if(t?xe(!0):te(!0),f.data&&Array.isArray(f.data)){r()&&m(f.data);return}if(le&&C?.provider===`value`){r()&&m(C.items);return}if(!T||typeof T.find!=`function`)throw Error(`DataSource required for object/api providers`);let n=s(y?.fields),a=await T.find(E,{$filter:e.filter,$orderby:At(e.sort),...n.length>0?{$expand:n}:{}});r()&&m(i(a))}catch(e){t?console.error(`[ObjectGantt] Failed to refresh data:`,e):r()&&re(e)}finally{t?xe(!1):te(!1)}},[T,E,le,C,e.filter,e.sort,y]);(0,D.useEffect)(()=>{Ee()},[Ee]),(0,D.useEffect)(()=>{!le&&T&&(async()=>{try{if(!T||!E)return;let e=await T.getObjectSchema(E);b(e)}catch(e){console.error(`Failed to fetch object schema:`,e)}})()},[E,T,le,C]);let O=(0,D.useMemo)(()=>{if(!w||!p.length)return[];let{startDateField:e,endDateField:t,titleField:n,progressField:r,dependenciesField:i,colorField:a,borderColorField:o,parentField:s,typeField:l,lockField:u,tooltipFields:d,baselineStartField:f,baselineEndField:m,quickFilters:h}=w,g=y?.fields??{},_=new Map;for(let e of h??[]){if(!e?.field||!Array.isArray(e.options)||!e.options.length)continue;let t=new Map;for(let n of e.options)typeof n==`string`?t.set(n,n):n&&n.value!=null&&t.set(String(n.value),n.label??String(n.value));t.size&&_.set(e.field,t)}let ee=(e,t)=>{if(!t)return;let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},te=e=>{let t=[ee(e,n),e?.account?.name,e?.opportunity?.name,e?.contact&&[e.contact.first_name,e.contact.last_name].filter(Boolean).join(` `)];for(let e of t)if(e!=null&&String(e).trim()!==``)return String(e);return c(y,e)},ne=(e,t)=>{if(t)return t;let n=g[e]??g[e.split(`.`)[0]];return n?.label?n.label:me(e)},re=(e,t)=>{if(e==null||e===``)return`—`;let n=g[t]??g[t.split(`.`)[0]],r=n?.type,i=n?.options;if(Array.isArray(i)&&i.length){let t=i.find(t=>String(t.value)===String(e));if(t)return t.label}if(typeof e!=`object`){let n=_.get(t)?.get(String(e));if(n!=null)return n}if(r==null&&typeof e==`string`){if(/^\d{4}-\d{2}-\d{2}$/.test(e))return ue(e);if(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/.test(e)&&!isNaN(new Date(e).getTime()))return ye(e)}switch(r){case`date`:return ue(e);case`datetime`:return ye(e);case`number`:case`integer`:case`float`:case`decimal`:return pe(Number(e));case`currency`:return he(Number(e),ae(n,ie));case`percent`:return _e(Number(e));case`boolean`:case`checkbox`:return e?`Yes`:`No`;default:if(Array.isArray(e)){let t=e.map(e=>{if(e==null)return``;if(typeof e==`object`){let t=e;return String(t.name??t.label??t.title??t.id??``)}return String(e)}).filter(Boolean);return t.length?t.join(`, `):`—`}if(typeof e==`object`){let t=e;return String(t.name??t.label??t.title??t.id??`—`)}return String(e)}},v=e=>{if(!d||!d.length)return;let t=[];for(let n of d){let r=typeof n==`string`?n:n?.field;if(!r)continue;let i=typeof n==`object`?n.label:void 0,a=ee(e,r);a==null||a===``||Array.isArray(a)&&a.length===0||t.push({label:ne(r,i),value:re(a,r)})}return t.length?t:void 0};return p.map((n,c)=>{let d=n[e],p=n[t],h=f?n[f]:void 0,g=m?n[m]:void 0,_=h?new Date(h):void 0,ee=g?new Date(g):void 0,ne=te(n),re=r?n[r]:0,y=i?n[i]:[],b=a?n[a]:void 0;if(!b){let e=n.status??n.state??n.priority??n.severity;if(e!=null&&e!==``){let t=be(void 0,e);t&&(b=ve(t))}}let ie=o?n[o]:void 0,ae=ie!=null&&ie!==``?ve(String(ie),String(ie)):void 0;return{id:n.id||n._id||`task-${c}`,title:ne,start:d?new Date(d):new Date,end:p?new Date(p):new Date,hasOwnDates:!!(d&&p),progress:Math.min(100,Math.max(0,re||0)),dependencies:Ot(y),parent:s?n[s]??null:void 0,type:l?Et(n[l]):void 0,locked:u?!!n[u]:void 0,color:b,borderColor:ae,baselineStart:_&&!isNaN(_.getTime())?_:void 0,baselineEnd:ee&&!isNaN(ee.getTime())?ee:void 0,fields:v(n),data:n}}).filter(e=>!isNaN(e.start.getTime())&&!isNaN(e.end.getTime()))},[p,w,y]),k=(0,D.useMemo)(()=>{let e=w?.groupByField;if(!e)return;let t=y?.fields??{},n=(e,t)=>{if(!t)return;let n=e;for(let e of t.split(`.`)){if(n==null)return;n=n[e]}return n},r=n=>{let r=(t[e]??t[e.split(`.`)[0]])?.options;if(Array.isArray(r)&&r.length){let e=r.find(e=>String(e.value)===String(n));if(e)return e.label}if(typeof n==`object`&&n){let e=n;return String(e.name??e.label??e.title??e.id??n)}return String(n)};return t=>{let i=n(t.data,e);return i==null||i===``?null:{key:typeof i==`object`&&i?String(i.id??i._id??r(i)):i,label:r(i)}}},[w?.groupByField,y]),A=(0,D.useMemo)(()=>{let e=w?.assigneeField;if(!e)return;let t=y?.fields??{},n=(e,t)=>{if(!t)return;let n=e;for(let e of t.split(`.`)){if(n==null)return;n=n[e]}return n},r=n=>{let r=(t[e]??t[e.split(`.`)[0]])?.options;if(Array.isArray(r)&&r.length){let e=r.find(e=>String(e.value)===String(n));if(e)return e.label}if(typeof n==`object`&&n){let e=n;return String(e.name??e.label??e.title??e.id??n)}return String(n)};return t=>{let i=n(t.data,e);return i==null||i===``?null:{key:typeof i==`object`&&i?String(i.id??i._id??r(i)):i,label:r(i)}}},[w?.assigneeField,y]),j=(0,D.useMemo)(()=>{let e=w?.effortField;if(e)return t=>{let n=t.data?.[e],r=Number(n);return Number.isFinite(r)&&r>0?r:1}},[w?.effortField]),Ae=(0,D.useMemo)(()=>{let t=e.skipWeekends,n=e.holidays;if(!(!t&&(!n||n.length===0)))return{skipWeekends:!!t,holidays:n&&n.length?new Set(n):void 0}},[e]),je=(0,D.useMemo)(()=>He(w?.timeSegments),[w?.timeSegments]),M=(0,D.useCallback)((e,t)=>{if(!e||!t)return null;let n=e;for(let e of t.split(`.`)){if(n==null)return null;n=n[e]}if(n==null||n===``)return null;if(typeof n==`object`){let e=n;return String(e.id??e._id??e.value??e.name??``)}return String(n)},[]),Me=w?.quickFilters,[N,Ne]=(0,D.useState)({});(0,D.useEffect)(()=>{if(!Me?.length||!t||typeof t.find!=`function`)return;let e=y?.fields??{},n=!1;return(async()=>{let r={};for(let n of Me){if(n.options)continue;let a=e[n.field]??e[n.field.split(`.`)[0]],o=a?.type;if(o!==`lookup`&&o!==`master_detail`)continue;let s=a?.reference_to??a?.reference??a?.referenceTo;if(s)try{let e=i(await t.find(s,{$top:1e3}));r[n.field]=e.map(e=>({value:String(e.id??e._id??e.value??``),label:String(e.name??e.label??e.title??e.id??e._id??``)}))}catch(e){console.warn(`[ObjectGantt] Failed to load quick-filter options for "${n.field}":`,e)}}n||Ne(e=>({...e,...r}))})(),()=>{n=!0}},[JSON.stringify(Me),t,y]);let Pe=(0,D.useMemo)(()=>{if(!Me?.length)return[];let e=y?.fields??{};return Me.map(t=>{let n=e[t.field]??e[t.field.split(`.`)[0]],r=t.label??n?.label??me(t.field),i;if(t.options?.length)i=t.options.map(e=>typeof e==`object`?{value:String(e.value),label:String(e.label??e.value)}:{value:String(e),label:String(e)});else if(Array.isArray(n?.options)&&n.options.length)i=n.options.map(e=>({value:String(e.value??e),label:String(e.label??e.value??e)}));else if(N[t.field]?.length)i=N[t.field];else{let e=new Map;for(let n of p){let r=M(n,t.field);if(r!=null&&!e.has(r)){let i=n;for(let e of t.field.split(`.`))i=i?.[e];let a=i&&typeof i==`object`?String(i.name??i.label??i.title??r):r;e.set(r,a)}}i=[...e.entries()].map(([e,t])=>({value:e,label:t}))}return{field:t.field,label:r,options:i}})},[Me,y,N,p,M]),Fe=e.persistLayout===!1?void 0:`${e.objectName||(C?.provider===`object`?C.object:``)||`gantt`}:${e.viewName||`default`}`,Ie=Fe?`gantt-layout:${Fe}:filters`:null,[Le,Re]=(0,D.useState)(()=>{if(!Ie||typeof window>`u`)return{};try{let e=JSON.parse(window.localStorage.getItem(Ie)||`null`);if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))Array.isArray(r)&&(t[n]=r.filter(e=>typeof e==`string`));return t}catch{return{}}}),ze=(0,D.useCallback)(()=>{if(!(!Ie||typeof window>`u`))try{window.localStorage.setItem(Ie,JSON.stringify(Le))}catch{}},[Ie,Le]),Be=(0,D.useCallback)((e,t)=>{Re(n=>({...n,[e]:t}))},[]),Ve=(0,D.useCallback)(()=>Re({}),[]),P=(0,D.useCallback)(e=>!!w?.objectField&&!String(e?.[w.objectField]??``).trim(),[w?.objectField]),Ue=(0,D.useCallback)(e=>{let t=(w?.objectField?String(e[w.objectField]??``).trim():``)||E,n=e.id??e._id;if(!t||n==null)return null;let r=E?ke(E,n):null;return{objectName:t,recordId:n,href:!E||t===E?r:r?.replace(`/${E}/record/`,`/${t}/record/`)??null}},[w?.objectField,E]),We=(0,D.useMemo)(()=>{let e=Object.entries(Le).filter(([,e])=>e.length>0);if(!e.length)return O;let t=new Map(O.map(e=>[String(e.id),e])),n=new Set;for(let r of O){if(!e.every(([e,t])=>{let n=M(r.data,e);return n!=null&&t.includes(n)}))continue;let i=r;for(;i&&!n.has(String(i.id));)n.add(String(i.id)),i=i.parent==null?void 0:t.get(String(i.parent))}return O.filter(e=>n.has(String(e.id)))},[O,Le,M]),Ge=(0,D.useMemo)(()=>{if(w?.autoZoomToFilter!==!1||!O.length)return null;let e=O[0].start.getTime(),t=O[0].end.getTime();for(let n of O)e=Math.min(e,n.start.getTime()),t=Math.max(t,n.end.getTime());return{start:new Date(e),end:new Date(t)}},[O,w?.autoZoomToFilter]),Ke=e.navigation??{mode:`drawer`,width:`min(960px, 60vw)`},Je=Ke.mode===`drawer`||Ke.mode===`modal`||Ke.mode===`split`||Ke.mode===`popover`,Ye=a({navigation:Ke,objectName:e.objectName,onRowClick:Je?void 0:u}),[Xe,Ze]=(0,D.useState)(null),Qe=Ye.isOverlay&&Ye.isOpen?Ye.selectedRecord:null;(0,D.useEffect)(()=>{if(!Qe){Ze(null);return}let e=Ue(Qe);if(!e){Ze(null);return}let{objectName:n,recordId:r}=e;if(!(C?.provider===`api`||n!==E)||!t||typeof t.findOne!=`function`){Ze(null);return}let i=`${n}:${r}`,a=!1;return(async()=>{try{let[e,o]=await Promise.all([t.findOne(n,String(r)),typeof t.getObjectSchema==`function`?t.getObjectSchema(n).catch(()=>null):Promise.resolve(null)]);a||Ze(e?{key:i,record:e,schema:o}:null)}catch(e){console.error(`[ObjectGantt] Failed to fetch drawer record, falling back to row payload:`,e),a||Ze(null)}})(),()=>{a=!0}},[Qe,Ue,C?.provider,E,t]);let $e=(0,D.useCallback)(async(e,t)=>{if(!w||!T||typeof T.update!=`function`)return;let{startDateField:n,endDateField:r,titleField:i,progressField:a}=w,o={};if(t.start instanceof Date&&(o[n]=t.start.toISOString()),t.end instanceof Date&&(o[r]=t.end.toISOString()),typeof t.title==`string`&&i&&(o[i]=t.title),typeof t.progress==`number`&&a&&(o[a]=t.progress),Object.keys(o).length===0)return;let s=e.data?.id??e.data?._id??e.id;if(s==null)return;let c=p;m(e=>e.map(e=>String(e.id??e._id)===String(s)?{...e,...o}:e));try{await T.update(E,String(s),o),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to persist task update:`,e),m(c),se(e)}},[w,T,E,p,Ee,se]),et=(e,t)=>{let n=t.some(e=>typeof e==`object`&&e.type&&e.type!==`fs`);return!n&&typeof e==`string`?t.map(e=>String(typeof e==`object`?e.id:e)).join(`,`):n?t.map(e=>typeof e==`object`?e.type&&e.type!==`fs`?{id:e.id,type:e.type}:e.id:e):t.map(e=>typeof e==`object`?e.id:e)},tt=(0,D.useCallback)(async(e,t,n)=>{let r=w?.dependenciesField;if(!r||!T||typeof T.update!=`function`)return;let i=et(t,n),a=p;m(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[r]:i}:t));try{await T.update(E,String(e),{[r]:i}),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to persist dependency:`,e),m(a),se(e)}},[w,T,E,p,Ee,se]),nt=(0,D.useCallback)(async(e,t,n=`fs`)=>{let r=e.data?.id??e.data?._id??e.id,i=t.data?.id??t.data?._id??t.id;if(r==null||i==null)return;let a=w?.dependenciesField;if(!a)return;let o=p.find(e=>String(e.id??e._id)===String(i))?.[a],s=Ot(o),c=e=>String(typeof e==`object`?e.id:e),l=s.find(e=>c(e)===String(r)),u=l&&typeof l==`object`?l.type??`fs`:`fs`;if(l&&u===n)return;let d=n===`fs`?r:{id:r,type:n},f=l?s.map(e=>c(e)===String(r)?d:e):[...s,d];await tt(i,o,f)},[w,p,tt]),I=(0,D.useCallback)(async(e,t)=>{let n=e.data?.id??e.data?._id??e.id,r=t.data?.id??t.data?._id??t.id;if(n==null||r==null)return;let i=w?.dependenciesField;if(!i)return;let a=p.find(e=>String(e.id??e._id)===String(r))?.[i],o=Ot(a),s=e=>String(typeof e==`object`?e.id:e),c=o.filter(e=>s(e)!==String(n));c.length!==o.length&&await tt(r,a,c)},[w,p,tt]),[rt,L]=(0,D.useState)(null),[it,at]=(0,D.useState)(!1),ot=(0,D.useCallback)(e=>{L(e)},[]),st=(0,D.useCallback)(async()=>{if(!rt)return;if(!T?.delete){L(null);return}let e=rt.data?.id??rt.data?._id??rt.id;if(e==null){L(null);return}at(!0);let t=p;m(t=>t.filter(t=>String(t.id??t._id)!==String(e)));try{if(await T.delete(E,String(e))===!1)throw Error(S(`gantt.writeFailed`));L(null),Ee({silent:!0})}catch(e){console.error(`[ObjectGantt] Failed to delete:`,e),m(t),L(null),se(e)}finally{at(!1)}},[rt,T,E,p,Ee,se,S]);return _?(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading Gantt chart...`})})}):ne?(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,ne.message]})})}):w?(0,F.jsxs)(`div`,{className:v(`flex h-full min-h-0 flex-col`,n),children:[Pe.length>0&&(0,F.jsx)(Tt,{filters:Pe,value:Le,onChange:Be,onClear:Ve,resultCount:We.length,totalCount:O.length,labels:{all:`全部`,clear:`清除筛选`,empty:`无可选项`,resultSummary:(e,t)=>`显示 ${e} / ${t} 项任务`}}),(0,F.jsx)(`div`,{className:`flex-1 min-h-[420px]`,children:w?.resourceView&&A?(0,F.jsx)(yt,{tasks:We,assignee:A,effort:j,capacity:w?.capacity??1,viewMode:e.viewMode||`day`}):(0,F.jsx)(R,{tasks:We,startDate:Ge?.start,endDate:Ge?.end,onTaskClick:e=>{P(e.data)||Ye.handleClick(e.data),r?.(e.data)},onTaskUpdate:$e,onTaskDelete:ot,onDependencyCreate:w?.dependenciesField?nt:void 0,onDependencyDelete:w?.dependenciesField?I:void 0,markers:e.markers,autoSchedule:!!w?.dependenciesField,rescheduleOnConflict:!!w?.dependenciesField,criticalPathDefault:!!e.criticalPath,workingCalendar:Ae,shiftSegments:je,showBaselines:e.showBaselines!==!1,readOnly:!!e.readOnly,mobileReadOnly:e.mobileReadOnly!==!1,persistLayoutKey:Fe,onLayoutChange:Ie?ze:void 0,groupBy:k,defaultCollapsedDepth:w?.defaultCollapsedDepth,summaryExtent:w?.summaryExtent,interactions:w?.interactions,dependencyTypes:w?.dependencyTypes,timeZone:w?.timeZone,onBeforeTaskUpdate:d,exportFileName:String(w?.exportFileName??e.label??y?.label??e.objectName??``)||void 0,inlineEdit:!0,onRefresh:(C?.provider===`object`||C?.provider===`api`)&&typeof T?.find==`function`?()=>Ee({silent:!0}):void 0,refreshing:ge})}),Ye.isOverlay&&Ye.isOpen&&Ye.selectedRecord&&(()=>{let n=Ye.selectedRecord,r=Ue(n);if(!r||P(n))return null;let{objectName:i,recordId:a}=r,o=r.href??void 0,s=w?.titleField?String(n[w.titleField]??S(`gantt.drawer.fallbackTitle`)):S(`gantt.drawer.fallbackTitle`),c=!!e.readOnly||(w?.lockField?!!n[w.lockField]:!1),l=Xe?.key===`${i}:${a}`?Xe:null,u=l?.record??n,d=l?.schema??(i===E?y:void 0),f=l&&t?t:T;return(0,F.jsx)(Oe,{open:!0,onClose:Ye.close,title:s,record:u,objectName:i,recordId:a,dataSource:f??void 0,objectSchema:d,width:Ye.width,fullPageHref:o,onFieldSave:c?void 0:async(e,t)=>{if(f?.update){try{await f.update(i,String(a),{[e]:t})}catch(e){let t=jt(e);throw t?Error(t):e}l&&Ze(n=>n&&n.key===l.key?{...n,record:{...n.record,[e]:t}}:n),m(n=>n.map(n=>String(n.id??n._id)===String(a)?{...n,[e]:t}:n)),Ee({silent:!0})}},onDelete:c?void 0:async()=>{if(T?.delete){try{if(await T.delete(i,String(a))===!1)throw Error(S(`gantt.writeFailed`))}catch(e){throw se(e),e}m(e=>e.filter(e=>String(e.id??e._id)!==String(a)))}}})})(),(0,F.jsx)(Te,{open:!!rt,onOpenChange:e=>{!e&&!it&&L(null)},children:(0,F.jsxs)(oe,{children:[(0,F.jsxs)(x,{children:[(0,F.jsx)(g,{children:S(`gantt.delete.title`)}),(0,F.jsx)(h,{children:rt?S(`gantt.delete.body`,{title:rt.title}):null})]}),(0,F.jsxs)(Ce,{children:[(0,F.jsx)(we,{disabled:it,children:S(`gantt.delete.cancel`)}),(0,F.jsx)(fe,{onClick:e=>{e.preventDefault(),st()},disabled:it,"data-testid":`gantt-delete-confirm`,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:S(it?`gantt.delete.deleting`:`gantt.delete.confirm`)})]})]})})]}):(0,F.jsx)(`div`,{className:n,children:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-96`,children:(0,F.jsx)(`div`,{className:`text-muted-foreground`,children:`Gantt configuration required. Please specify startDateField, endDateField, and titleField.`})})})},Nt=t({GanttView:()=>R,ObjectGantt:()=>V,ObjectGanttRenderer:()=>H,QuickFilterBar:()=>Tt,ResourceWorkload:()=>yt,bandAt:()=>We,computeWorkload:()=>mt,normalizeDependencies:()=>Ot,normalizeShiftSegments:()=>He,normalizeTaskType:()=>Et,parseHHMM:()=>P,shiftDayStart:()=>Ue}),H=({schema:e})=>{let{dataSource:t}=d()||{};return(0,F.jsx)(V,{schema:e,dataSource:t})};u.register(`object-gantt`,H,{namespace:`plugin-gantt`,label:`Object Gantt`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`gantt`,type:`object`,label:`Gantt Config`,description:`startDateField, endDateField, titleField, progressField, percentageField, colorField, dependenciesField`}]}),u.register(`gantt`,H,{namespace:`view`,label:`Gantt View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`gantt`,type:`object`,label:`Gantt Config`,description:`startDateField, endDateField, titleField, progressField, percentageField, colorField, dependenciesField`}]});export{Nt as t};