@libxai/board 0.17.371 → 0.17.373
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[m,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(S=>{a({search:S.target.value});},[a]),y=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),l=react.useCallback(S=>{r({by:S.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),v&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!T&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:S=>{let k=S.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Hg.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let k=S.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let k=S.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:S=>C(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>g(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>g(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Xs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Js={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Qs={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsxRuntime.jsx(vn.Provider,{value:n,children:e})}function go(){let e=react.useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Kr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ye[e]||Ye.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Ye[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ye[e].bgSecondary),bgGrid:r("--theme-bg-card",Ye[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ye[e].bgWeekend),border:r("--theme-border-primary",Ye[e].border),borderLight:r("--theme-border-subtle",Ye[e].borderLight),textPrimary:r("--theme-text-primary",Ye[e].textPrimary),textSecondary:r("--theme-text-secondary",Ye[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ye[e].textTertiary),accent:r("--theme-accent-primary",Ye[e].accent),accentHover:r("--theme-accent-hover",Ye[e].accentHover),accentLight:r("--theme-accent-primary",Ye[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ye[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ye[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ye[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ye[e].dependency),dependencyHover:r("--theme-border-secondary",Ye[e].dependencyHover),criticalPath:r("--theme-error",Ye[e].criticalPath),criticalPathLight:r("--theme-error",Ye[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ye[e].today):e==="neutral"?r("--theme-text-primary",Ye[e].today):r("--theme-error",Ye[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ye[e].todayLight):e==="neutral"?r("--theme-text-primary",Ye[e].todayLight):r("--theme-error",Ye[e].todayLight),milestone:r("--theme-warning",Ye[e].milestone),milestoneLight:r("--theme-warning",Ye[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ye[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ye[e].statusInProgress),statusCompleted:r("--theme-success",Ye[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ye[e].hoverBg),focusRing:r("--theme-accent-primary",Ye[e].focusRing)}}var xn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hd={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ho=react.createContext(xn);function bo(){return react.useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function vf({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),S=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(vf,{options:k,value:t,onChange:R=>a(R),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{theme:e,value:p,onChange:m}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||v.toolbar.createTask})]}),(S||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(yf,{options:w,value:s,onChange:R=>n(R),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Rt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(l=>{h.current=l;},[]),T=react.useCallback(l=>{let x=[],v=S=>{for(let k of S)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let S=c();if(!S){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===S.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let R=v[w];a(R.id,x);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&k){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:S,onDeleteRequest:k,onTaskReparent:w}){let R=react.useContext(ho),[M,D]=react.useState(null),[I,B]=react.useState(null),[K,te]=react.useState(""),ie=react.useRef(null),[de,be]=react.useState(null),[$,J]=react.useState(0),[U,G]=react.useState(0),[A,Q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[X,H]=react.useState(null),[Ce,Me]=react.useState(null),[Oe,ve]=react.useState(null),Ke=react.useRef(0),We=5,et=react.useRef(false),[vt,Mt]=react.useState(null),[mt,O]=react.useState(false),[le,xe]=react.useState(null),[Pe,ze]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{function _(ae){at.current&&!at.current.contains(ae.target)&&ze(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),react.useEffect(()=>{I&&ie.current&&(ie.current.focus(),ie.current.select());},[I]),react.useEffect(()=>{if(!de)return;let _=Ee=>{let Ue=Ee.clientX-$,He=U+Ue;g?.(de,He);},ae=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[de,$,U,g]);let{selectedTaskIds:Et,handleTaskClick:Fe,isTaskSelected:Xt}=tc(),{setIsEditing:Ot}=Zd({tasks:e,selectedTaskIds:Et,onTaskSelect:(_,ae)=>{let Ue=vo(e).map(He=>He.id);Fe(_,Ue,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&ue(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&S&&S(ae);},enableKeyboard:true}),Nt=(_,ae=0)=>{let Ee=[];for(let Ue of _)Ee.push({task:Ue,level:ae}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&Ee.push(...Nt(Ue.subtasks,ae+1));return Ee},ct=Nt(e),Jt=48,Ea=Math.max(ct.length*a,600-Jt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ue=_=>{B(_.id),te(_.name),Ot(true);},pa=_=>{K.trim()&&K!==e.find(ae=>ae.id===_)?.name&&x?.(_,K.trim()),B(null),te(""),Ot(false);},ya=()=>{B(null),te(""),Ot(false);},N=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},ee=(_,ae)=>{ae.preventDefault(),Ke.current=ae.clientY,H(_),et.current=false,O(false),Mt({x:ae.clientX,y:ae.clientY});},se=_=>{if(!X||(Math.abs(_.clientY-Ke.current)>We&&!et.current&&(et.current=true,O(true)),Mt({x:_.clientX,y:_.clientY}),!et.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ue=null,He=null;Ee.forEach(W=>{let ce=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==X&&_.clientY>=ce.top&&_.clientY<=ce.bottom){Ue=Ie;let Dt=_.clientY-ce.top,Je=ce.height;Dt<Je*.25?He="above":Dt>Je*.75?He="below":He="child";}}),Me(Ue),ve(He);},De=()=>{if(et.current&&X&&Ce&&Oe){if(Oe==="child")w?.(X,Ce);else if(Oe==="above"||Oe==="below"){let _=(Ue,He,W=null)=>{for(let ce of Ue){if(ce.id===He)return W;if(ce.subtasks){let Ie=_(ce.subtasks,He,ce.id);if(Ie!==void 0)return Ie}}},ae=_(e,Ce,null),Ee=(Ue,He)=>{let W=Ue.findIndex(ce=>ce.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ue=Ee(e,Ce);w?.(X,null,Ue);}else {let Ue=ct.find(He=>He.task.id===ae)?.task;if(Ue?.subtasks){let He=Ee(Ue.subtasks,Ce);w?.(X,ae,He);}}}}H(null),Me(null),ve(null),Mt(null),et.current=false,O(false);};react.useEffect(()=>{if(X)return document.addEventListener("mousemove",se),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[X,Ce,Oe]);let $e=(_,ae,Ee)=>{switch(_.id){case "name":let Ue=I===ae.id,He=M===ae.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:q=>ee(ae.id,q),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ue?jsxRuntime.jsx("input",{ref:ie,type:"text",value:K,onChange:q=>te(q.target.value),onKeyDown:q=>{q.key==="Enter"?pa(ae.id):q.key==="Escape"&&ya();},onBlur:()=>pa(ae.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>N(ae,q),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),ue(ae);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let ce=_.id==="startDate"?"startDate":"endDate",Ie=ae[ce],Dt=le?.taskId===ae.id&&le?.field===ce,Je=q=>q?(typeof q=="string"?new Date(q):q).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:q=>{if(Dt)xe(null);else {let Ae=q.currentTarget.getBoundingClientRect();xe({taskId:ae.id,field:ce,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Je(Ie)})]}),Dt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>xe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:le?.position.top,left:le?.position.left},onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,Ae=new Date(q);Ae.setDate(q.getDate()+1);let ot=new Date(q);ot.setDate(q.getDate()+7);let ne=new Date(q);return ne.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((xt,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:At=>At.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:xt.date}),xe(null);},children:xt.label},Le))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:void 0}),xe(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:le?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((q,Ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},Ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=le?.month||new Date,Ae=q.getFullYear(),ot=q.getMonth(),ne=new Date(Ae,ot,1).getDay(),Re=new Date(Ae,ot+1,0).getDate(),xt=new Date,Le=[];for(let st=ne-1;st>=0;st--)Le.push({day:new Date(Ae,ot,-st).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Re;st++)Le.push({day:st,date:new Date(Ae,ot,st),isCurrentMonth:true});let At=42-Le.length;for(let st=1;st<=At;st++)Le.push({day:st,date:new Date(Ae,ot+1,st),isCurrentMonth:false});return Le.map((st,ga)=>{let zt=st.date.toDateString()===xt.toDateString(),kt=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===st.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:st.isCurrentMonth?kt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:kt?"#3B82F6":"transparent",boxShadow:zt&&!kt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[ce]:st.date}),xe(null);},children:st.day},ga)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:oe(ae)})});case "assignees":let va=r.filter(q=>ae.assignees?.some(Ae=>Ae.name===q.name||Ae.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:q=>{let Ae=q.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ae.status||"todo",onChange:q=>{h?.(ae.id,{status:q,progress:q==="completed"?100:ae.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ae.progress}%`,backgroundColor:ae.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ae.progress,"%"]})]});case "priority":let ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ye=ua[ae.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(zr,{priority:ye,onChange:q=>{q&&h?.(ae.id,{priority:E[q]||"medium"});}})});default:return null}},tt=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],Be=u.filter(_=>_.visible),rt=Be.reduce((_,ae)=>_+ae.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((_,ae)=>{let Ee=ae===Be.length-1,Ue=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),Q({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),be(_.id),J(He.clientX),G(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(Cn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>ze(!Pe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Pe&&jsxRuntime.jsxs("div",{ref:at,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>ze(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:ct.map(({task:_,level:ae},Ee)=>{let Ue=Xt(_.id),He=Ce===_.id,W=He&&Oe==="above",ce=He&&Oe==="below",Ie=He&&Oe==="child",Dt={};return Ie&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${X===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:Ie?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>D(_.id),onMouseLeave:()=>D(null),onClick:Je=>{let ua=vo(e).map(q=>q.id),ye=navigator.platform.toUpperCase().indexOf("MAC")>=0?Je.metaKey:Je.ctrlKey;Fe(_.id,ua,ye,Je.shiftKey),s?.(_);},onDoubleClick:Je=>{Je.stopPropagation(),n?.(_);},onContextMenu:Je=>{Je.preventDefault(),Q({isOpen:true,x:Je.clientX,y:Je.clientY,type:"task",task:_}),p?.(_,Je);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ce&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Je,va)=>{let ua=va===Be.length-1,E=Je.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Je.width}px`,minWidth:`${Je.minWidth??(E?200:60)}px`,maxWidth:`${Je.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ua?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:$e(Je,_,E?ae:0)},`${_.id}-${Je.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?tt(A.columnId):A.type==="task"&&A.task?Ge(A.task):[],onClose:()=>Q({...A,isOpen:false}),theme:t}),mt&&vt&&X&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=ct.find(ae=>ae.task.id===X)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[m,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(0),[x,v]=react.useState(0),[S,k]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:S,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),p(K),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=react.useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:S,setGhostX:k,ghostWidth:w,setGhostWidth:R,connectionLine:M,setConnectionLine:D,hoveredTaskId:I,setHoveredTaskId:B,activeZone:K,setActiveZone:te,draggedSegmentIndex:ie,setDraggedSegmentIndex:de,draggedSegmentStartX:be,setDraggedSegmentStartX:$,segmentDragOffsetX:J,setSegmentDragOffsetX:U,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:Q,setIsHovered:X,isDragging:H,isResizing:Ce,isConnecting:Me,resetDragState:Oe}=c,ve=32,Ke=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Mt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},le=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,Pe=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),ze=r<50,at=r<40;react.useEffect(()=>{if(T)if(Q&&!H&&!e.segments){let N=a<100;T({task:e,x:t,y:a,width:r,height:ve,showBelow:N});}else T(null);},[Q,H,e,t,a,r,ve,T]);let Et=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},Xt=N=>Math.round(N/s)*s,Ot=N=>{let ee=Math.round(N/s),se=new Date(n);return se.setDate(se.getDate()+ee),se},Nt=(N,ee)=>{for(let se of h){if(se.id===e.id)continue;let De=5;if(N>=se.x-De&&N<=se.x+se.width+De&&ee>=se.y-De&&ee<=se.y+se.height+De)return se.id}return null},ct=react.useCallback((N,ee,se)=>{N.preventDefault(),N.stopPropagation();let De=b.current?.ownerSVGElement;if(!De)return;let $e=De.createSVGPoint();$e.x=N.clientX,$e.y=N.clientY;let tt=$e.matrixTransform(De.getScreenCTM()?.inverse()),Ge=se!==void 0?se:t,Be=ee;if(!Be){let rt=tt.x-Ge;N.shiftKey?(Be="connect",D({x:t+r,y:a+ve/2})):N.ctrlKey||N.metaKey?Be="move":N.altKey?Be=rt<r/2?"resize-start":"resize-end":at?rt<r/2?Be="move":Be="resize-end":ze?rt<=Pe/2?Be="resize-start":rt>=r-Pe/2?Be="resize-end":Be="move":rt<=Pe?Be="resize-start":rt>=r-Pe?Be="resize-end":Be="move";}l(Be),X(false),te(null),Be==="move"?v(tt.x-Ge):Be==="connect"?D({x:t+r,y:a+ve/2}):v(0),k(Ge),R(r);},[t,r,a,ve]),Jt=react.useCallback(N=>{if(y==="none")return;let ee=b.current?.ownerSVGElement;if(!ee)return;let se=ee.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let De=se.matrixTransform(ee.getScreenCTM()?.inverse());if(y==="connect"){D({x:De.x,y:De.y});let $e=Nt(De.x,De.y);B($e);}else if(y==="move"){let $e=De.x-x,tt=Xt($e);k(tt),R(r);let Ge=Math.round((tt-t)/s);if(C?.(e.id,Ge,true),e.segments&&e.segments.length>0&&ie!==null){let Be=tt-be;U(Be);}}else if(y==="resize-start"){let $e=De.x,tt=Xt($e),Ge=t+r-tt;Ge>=s&&(k(tt),R(Ge));}else if(y==="resize-end"){let $e=De.x,Ge=Xt($e)-t;Ge>=s&&R(Ge);}},[y,t,r,s,x,e,Xt,ie,be,Nt,B,D,k,R,U,C]),Ea=react.useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),D(null),B(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),ee,se,De=true;if(y==="move"){if(ee=Ot(S),se=new Date(ee.getTime()+N),e.segments&&e.segments.length>0&&ie!==null){let $e=Math.round(J/s),tt=e.segments.map((_,ae)=>{if(ae===ie){let Ee=new Date(_.startDate),Ue=new Date(_.endDate);return Ee.setDate(Ee.getDate()+$e),Ue.setDate(Ue.getDate()+$e),{startDate:Ee,endDate:Ue}}return _}),Ge=tt.flatMap(_=>[_.startDate,_.endDate]),Be=new Date(Math.min(...Ge.map(_=>_.getTime()))),rt=new Date(Math.max(...Ge.map(_=>_.getTime())));d?.({...e,segments:tt},Be,rt),Oe(t,r);return}}else y==="resize-start"?(ee=Ot(S),se=e.endDate,ee>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),De=false)):y==="resize-end"?(ee=e.startDate,se=Ot(S+w),se<ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),De=false)):De=false;De&&ee&&se&&(se.getTime()<ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ee,se));}C?.(e.id,0,false),Oe(t,r);}},[y,S,w,e,d,I,g,t,r,s,Ot,J,ie,Oe,C]);react.useEffect(()=>{if(y==="none")return;let N=se=>{Jt(se);},ee=()=>{Ea();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",ee);}},[y,Jt,Ea]);let oe=H&&!Me?S:t,ue=H&&!Me?w:r,pa=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!H&&m?.(e),onDoubleClick:N=>{H||(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!H&&X(true),onMouseLeave:()=>{H||(X(false),te(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ve,fill:"transparent",style:{pointerEvents:"all"}}),Q&&!H&&!ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Pe,height:ve,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:N=>ct(N,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:ve,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:ve,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")})]}),Q&&!H&&at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")}),Q&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:w,height:ve,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:le,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Me?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>ct(N),style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue*(e.progress/100),height:ve,rx:Ke,fill:le,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((N,ee)=>{let se=(N.startDate.getTime()-n.getTime())/864e5*s,$e=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-se+s,tt=H&&y==="move"&&ie===ee,Ge=G===ee,Be=tt?se+J:se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!H&&A(ee),onMouseLeave:()=>!H&&A(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Be,y:a,width:$e,height:ve,rx:Ke,fill:le,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:Ge?.9:.8,scale:Ge&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:rt=>{rt.stopPropagation(),de(ee),$(se),ct(rt,void 0,se);},style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Be,y:a,width:$e*(e.progress/100),height:ve,rx:Ke,fill:le,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ee}`)}),vt&&(We||et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et&&!We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let N=p.taskLabel(e),ee=typeof N=="string"?N:e.name,se=ee.length>Math.floor(ue/8)?`${ee.substring(0,Math.floor(ue/8))}...`:ee;return jsxRuntime.jsx("text",{x:oe+12,y:a+ve/2,dominantBaseline:"middle",fill:Mt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Mt?"line-through":"none"},children:se})})(),ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+ue-12,y:a+ve/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ue>80&&!H&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Q||Ce)&&!Me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe-2,y:a,width:16,height:ve,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+4,y:a+8,width:3,height:ve-16,rx:1.5,fill:K==="resize-start"||y==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe+ue-14,y:a,width:16,height:ve,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+ue-7,y:a+8,width:3,height:ve-16,rx:1.5,fill:K==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ve/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ve/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Me&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:ue+4,height:ve+4,rx:Ke+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:S+w,y1:0,x2:S+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&!T&&(()=>{let se=a<100,De=se?a+ve+13:a-82-13,$e=se?`M ${oe+ue/2-6} ${a+ve+3} L ${oe+ue/2} ${a+ve+13} L ${oe+ue/2+6} ${a+ve+3}`:`M ${oe+ue/2-6} ${a-13} L ${oe+ue/2} ${a-3} L ${oe+ue/2+6} ${a-13}`,tt=De+22,Ge=De+40,Be=De+55,rt=De+70,_=se?De+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:$e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:oe+ue/2-120,y:De,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:oe+ue/2,y:tt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:oe+ue/2-110,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.startDate)}),jsxRuntime.jsx("text",{x:oe+ue/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.endDate)}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+ue/2+65,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+ue/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:oe+ue/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+ue/2-50,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ae=>ae.name).join(", ").substring(0,30),e.assignees.map(ae=>ae.name).join(", ").length>30?"...":""]})]}),!se&&jsxRuntime.jsx("text",{x:oe+ue/2,y:_,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":ze?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let ie=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+ie} ${t}, ${a-ie} ${r}, ${a} ${r}`;}else if(x=a-b,y){let de=e+15,be=a-b,$=h?t+20:t-20;x=be,n==="squared"?l=`M ${e} ${t} L ${de} ${t} L ${de} ${$} L ${be} ${$} L ${be} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t+c} L ${de} ${$-c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$+c} L ${be} ${r-c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t-c} L ${de} ${$+c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$-c} L ${be} ${r+c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,S=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,R="#f87171",M="rgba(248, 113, 113, 0.15)",D=x,I=(t+r)/2;if(u)if(C)D=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let ie=e+15,de=a-b,be=h?t+20:t-20,$=[[e,t,ie,t],[ie,t,ie,be],[ie,be,de,be],[de,be,de,r],[de,r,a,r]],J=1/0,U={x:D,y:I};for(let G of $){let A=B(u.x,u.y,G[0],G[1],G[2],G[3]),Q=Math.hypot(u.x-A.x,u.y-A.y);Q<J&&(J=Q,U=A);}D=U.x,I=U.y;}else {let ie=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],de=1/0,be={x:D,y:I};for(let $ of ie){let J=B(u.x,u.y,$[0],$[1],$[2],$[3]),U=Math.hypot(u.x-J.x,u.y-J.y);U<de&&(de=U,be=J);}D=be.x,I=be.y;}function B(ie,de,be,$,J,U){let G=J-be,A=U-$,Q=G*G+A*A;if(Q===0)return {x:be,y:$};let X=((ie-be)*G+(de-$)*A)/Q;return X=Math.max(0,Math.min(1,X)),{x:be+X*G,y:$+X*A}}let K=ie=>{let de=ie.currentTarget.ownerSVGElement;if(!de)return;let be=de.getBoundingClientRect();d({x:ie.clientX-be.left,y:ie.clientY-be.top});},te=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{onMouseLeave:te,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var fe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=fe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=fe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=fe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Vs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&n.current&&!n.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=i=>{t(i),o(false);},m=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:f("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:f("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Ks({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,p]=react.useState("export"),[m,i]=react.useState("json"),[u,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let h=async()=>{let T=o?.current||void 0,c=await Sl(e,m,T);El(c,m);},C=async T=>{let c=T.target.files?.[0];if(c){try{let b=await Al(c),y=c.name.endsWith(".json")?"json":"csv",l=Ml(b,y);d(l),l.success&&r&&r(l,b);}catch(b){d({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:f("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[n==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(T=>jsxRuntime.jsxs("button",{onClick:()=>i(T),className:f("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:h,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:C,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:f("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:f("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((T,c)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},c))})]})]})]})]})]})}var Hg=["URGENT","HIGH","MEDIUM","LOW"],Wg=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Gg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ys({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:p,availableUsers:m=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(S=>{a({search:S.target.value});},[a]),y=react.useCallback(S=>{a({dateFilter:S.target.value});},[a]),l=react.useCallback(S=>{r({by:S.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),v=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${T?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>c(!T),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:T?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:T?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),v&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!T&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:S=>{let k=S.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Hg.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let k=S.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let k=S.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsxRuntime.jsx("option",{value:S,children:S},S))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:l,className:"filter-bar__select filter-bar__select--sm",children:Wg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),C&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:h,onChange:S=>C(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Gg.map(S=>jsxRuntime.jsx("option",{value:S.value,children:S.label},S.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function qs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:p,onExportGanttCSV:m}){let[i,u]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let h=C=>{d.current&&!d.current.contains(C.target)&&u(false);};return i&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[i]);let g=h=>{h(),u(false);};return jsxRuntime.jsxs("div",{className:f("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",h.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",h.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>g(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>g(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Xs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Js={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Qs={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Kr={dark:Xs,light:Js,neutral:Qs},yn="dark";var vn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=yn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Kr[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${ef(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let g=m.colors[u];g&&p.style.setProperty(d,g);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Kr};return jsxRuntime.jsx(vn.Provider,{value:n,children:e})}function go(){let e=react.useContext(vn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ef(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=go();return e?jsxRuntime.jsxs("div",{className:f("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Kr).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:f("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:n.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Ud(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ye[e]||Ye.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Ye[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ye[e].bgSecondary),bgGrid:r("--theme-bg-card",Ye[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ye[e].bgWeekend),border:r("--theme-border-primary",Ye[e].border),borderLight:r("--theme-border-subtle",Ye[e].borderLight),textPrimary:r("--theme-text-primary",Ye[e].textPrimary),textSecondary:r("--theme-text-secondary",Ye[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ye[e].textTertiary),accent:r("--theme-accent-primary",Ye[e].accent),accentHover:r("--theme-accent-hover",Ye[e].accentHover),accentLight:r("--theme-accent-primary",Ye[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ye[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ye[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ye[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ye[e].dependency),dependencyHover:r("--theme-border-secondary",Ye[e].dependencyHover),criticalPath:r("--theme-error",Ye[e].criticalPath),criticalPathLight:r("--theme-error",Ye[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ye[e].today):e==="neutral"?r("--theme-text-primary",Ye[e].today):r("--theme-error",Ye[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ye[e].todayLight):e==="neutral"?r("--theme-text-primary",Ye[e].todayLight):r("--theme-error",Ye[e].todayLight),milestone:r("--theme-warning",Ye[e].milestone),milestoneLight:r("--theme-warning",Ye[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ye[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ye[e].statusInProgress),statusCompleted:r("--theme-success",Ye[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ye[e].hoverBg),focusRing:r("--theme-accent-primary",Ye[e].focusRing)}}var xn={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filter",filterBy:"Filter by status",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hd={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtrar",filterBy:"Filtrar por estado",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ei={en:xn,es:Hd};function Wd(e){return ei[e]||ei.en}function ti(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ho=react.createContext(xn);function bo(){return react.useContext(ho)}function bf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[p,m]=react.useState(false),[i,u]=react.useState(null),d=react.useRef(null),g=bo();if(react.useEffect(()=>{let c=b=>{d.current&&!d.current.contains(b.target)&&m(false);};return p&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[p]),!(t||a||r||o||s||n))return null;let C=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(c=>c.handler),T=async(c,b)=>{if(b){u(c);try{await b();}catch(y){console.error(`Export ${c} failed:`,y);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:C.map((c,b)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(c.id,c.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:b<C.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:b*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===c.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):c.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:c.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function yf({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function vf({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function xf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=p.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function kf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=bo();react.useEffect(()=>{let i=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let p=[{value:"all",label:n.toolbar.filterAll||"All tasks",description:n.toolbar.filterAllDesc||"Show all tasks"},{value:"incomplete",label:n.toolbar.filterIncomplete||"Incomplete only",description:n.toolbar.filterIncompleteDesc||"Hide completed tasks"},{value:"in_progress",label:n.toolbar.filterInProgress||"In progress",description:n.toolbar.filterInProgressDesc||"Tasks currently being worked on"},{value:"completed",label:n.toolbar.filterCompleted||"Completed",description:n.toolbar.filterCompletedDesc||"Only show finished tasks"}],m=t!=="all";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m||r?e.accentLight:e.bgSecondary,border:`1px solid ${m||r?e.accent:e.borderLight}`,color:m||r?e.accent:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.accentLight,borderColor:e.accent,color:e.accent,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:n.toolbar.filter||"Filter"}),m&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},className:"flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-semibold",style:{backgroundColor:e.accent,color:"#FFFFFF"},children:"1"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:r?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-56 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:e.borderLight},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:e.textTertiary},children:n.toolbar.filterBy||"Filter by status"})}),jsxRuntime.jsx("div",{className:"py-1",children:p.map((i,u)=>{let d=t===i.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-start gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-4 h-4 rounded border mt-0.5 flex-shrink-0",style:{borderColor:d?e.accent:e.border,backgroundColor:d?e.accent:"transparent"},children:d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3",style:{color:"#FFFFFF"}})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium",style:{color:d?e.accent:e.textPrimary},children:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] mt-0.5",style:{color:e.textTertiary},children:i.description})]})]},i.value)})}),m&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t",style:{borderColor:e.borderLight},children:jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>{a("all"),o(false);},className:"w-full text-xs py-1.5 rounded-md",style:{color:e.textTertiary},whileHover:{backgroundColor:e.hoverBg,color:e.textSecondary},children:n.toolbar.clearFilter||"Clear filter"})})]})})]})}function wn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:p,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:g,taskFilter:h="all",onTaskFilterChange:C,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}){let v=bo(),S=T||c||b||y||l||x,k=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],w=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(vf,{options:k,value:t,onChange:R=>a(R),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{theme:e,value:p,onChange:m}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(kf,{theme:e,value:h,onChange:C})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d||v.toolbar.createTask})]}),(S||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:x}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(yf,{options:w,value:s,onChange:R=>n(R),theme:e})]})]})}function Cn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();n({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(lt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,g=8,h=window.innerWidth,C=window.innerHeight,T=t,c=a;t+u+g>h&&(T=t-u,T<g&&(T=g)),a+d+g>C&&(c=C-d-g,c<g&&(c=g)),m({x:T,y:c});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var Rt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Zd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:p,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:g=true}){let h=react.useRef(false),C=react.useCallback(l=>{h.current=l;},[]),T=react.useCallback(l=>{let x=[],v=S=>{for(let k of S)x.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&v(k.subtasks);};return v(l),x},[]),c=react.useCallback(()=>{let l=T(e);for(let x of l)if(t.has(x.id))return x;return null},[e,t,T]),b=react.useCallback((l,x)=>{let v=T(e);if(v.length===0)return;let S=c();if(!S){a(v[0].id,false);return}let k=v.findIndex(M=>M.id===S.id);if(k===-1)return;let w=l==="up"?k-1:k+1;if(w<0||w>=v.length)return;let R=v[w];a(R.id,x);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let x=l.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||h.current){l.key==="Escape"&&(x.blur(),h.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,w=Array.from(t),R=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(R&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!R.isExpanded||l.key==="ArrowLeft"&&R.isExpanded)&&u(R.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){w.length>0&&(l.preventDefault(),n(w,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){w.length>0&&(l.preventDefault(),p(w));return}if(l.key==="Tab"&&l.shiftKey){w.length>0&&(l.preventDefault(),m(w));return}if(l.key==="Enter"&&!l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!k){R&&(l.preventDefault(),r(R.id,"above"));return}if(l.key==="Enter"&&k){R&&(l.preventDefault(),d(R.id));return}if(l.key==="F2"){R&&(l.preventDefault(),i(R.id));return}if(l.key==="Delete"||l.key==="Backspace"&&k){w.length>0&&(l.preventDefault(),o(w));return}if(l.key==="d"&&k&&!l.shiftKey){w.length>0&&(l.preventDefault(),s(w));return}},[g,t,c,b,r,o,s,n,p,m,i,u,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[g,y]),{setIsEditing:C}}function tc(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(d=>{t(new Set([d])),r(d);},[]),s=react.useCallback(d=>{t(g=>{let h=new Set(g);return h.has(d)?h.delete(d):h.add(d),h}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let h=g.indexOf(a),C=g.indexOf(d);if(h===-1||C===-1){o(d);return}let T=Math.min(h,C),c=Math.max(h,C),b=g.slice(T,c+1);t(new Set(b)),r(d);},[a,o]),p=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(h=>{let C=new Set(h);return C.add(d),C}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let p={...r[n],parentId:o,level:s,position:n};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ac(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ac(a.subtasks,t);if(r)return r}}return null}function ii(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ii(a.subtasks,t);if(r)return r}return null}function li(e,t){if(t.length===0)return e;let a=vo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,g)=>{let h=[];return {tasks:d.filter(T=>{if(g.has(T.id))return h.push(T),false;if(T.subtasks){let c=n(T.subtasks,g);T.subtasks=c.tasks,h.push(...c.removed);}return true}),removed:h}},p=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:p(C.subtasks,g,h)}:C),m=new Set(t),{tasks:i,removed:u}=n(e,m);return p(i,s.id,u)}function di(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ii(a,r);if(!o)continue;let s=ii(a,o.id),n=(i,u,d)=>{for(let g=0;g<i.length;g++){let h=i[g];if(h.id===u&&h.subtasks){let C=h.subtasks.findIndex(T=>T.id===d);if(C!==-1){let[T]=h.subtasks.splice(C,1);return T}}if(h.subtasks){let C=n(h.subtasks,u,d);if(C)return C}}return null},p=(i,u,d)=>{let g=i.findIndex(h=>h.id===u);if(g!==-1)return i.splice(g+1,0,d),i;for(let h of i)h.subtasks&&p(h.subtasks,u,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function ci(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,p,m)=>{let i=n.findIndex(d=>d.id===p);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?i-1:i+1;return u<0||u>=n.length?false:([n[i],n[u]]=[n[u],n[i]],true)};return s(r,o,a),r}function mi(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function pi(e,t){let a=[...e];for(let r of t){let o=n=>{let p=n.findIndex(u=>u.id===r);if(p===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let m=n[p],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(p+1,0,i),true},s=n=>n.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function rc(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return m.splice(u,0,n),true};return p(r),{tasks:r,newTask:n}}function ui(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ui(r.subtasks,t,a)}:r)}function gi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:gi(a.subtasks,t)}:a)}function fi(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let g=a(d.subtasks);if(g)return g}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(p),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let p=(m,i)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===i||p(u,i))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let p=r!==void 0?r:n.length;n.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(i=>{if(i.id===a){let u=i.subtasks||[],d=r!==void 0?r:u.length,g=[...u];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:p(i.subtasks)}:i});n=p(n);}return n}function Dn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:p,onTaskToggle:m,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:x,onCreateSubtask:v,onOpenTaskModal:S,onDeleteRequest:k,onTaskReparent:w}){let R=react.useContext(ho),[M,D]=react.useState(null),[I,B]=react.useState(null),[K,te]=react.useState(""),ie=react.useRef(null),[de,be]=react.useState(null),[$,J]=react.useState(0),[U,G]=react.useState(0),[A,Q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[X,H]=react.useState(null),[Ce,Me]=react.useState(null),[Oe,ve]=react.useState(null),Ke=react.useRef(0),We=5,et=react.useRef(false),[vt,Mt]=react.useState(null),[mt,O]=react.useState(false),[le,xe]=react.useState(null),[Pe,ze]=react.useState(false),at=react.useRef(null);react.useEffect(()=>{function _(ae){at.current&&!at.current.contains(ae.target)&&ze(false);}if(Pe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Pe]),react.useEffect(()=>{I&&ie.current&&(ie.current.focus(),ie.current.select());},[I]),react.useEffect(()=>{if(!de)return;let _=Ee=>{let Ue=Ee.clientX-$,He=U+Ue;g?.(de,He);},ae=()=>{be(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ae),document.body.style.cursor="",document.body.style.userSelect="";}},[de,$,U,g]);let{selectedTaskIds:Et,handleTaskClick:Fe,isTaskSelected:Xt}=tc(),{setIsEditing:Ot}=Zd({tasks:e,selectedTaskIds:Et,onTaskSelect:(_,ae)=>{let Ue=vo(e).map(He=>He.id);Fe(_,Ue,ae||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&ue(ae);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let ae=vo(e).find(Ee=>Ee.id===_);ae&&S&&S(ae);},enableKeyboard:true}),Nt=(_,ae=0)=>{let Ee=[];for(let Ue of _)Ee.push({task:Ue,level:ae}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&Ee.push(...Nt(Ue.subtasks,ae+1));return Ee},ct=Nt(e),Jt=48,Ea=Math.max(ct.length*a,600-Jt),oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,ue=_=>{B(_.id),te(_.name),Ot(true);},pa=_=>{K.trim()&&K!==e.find(ae=>ae.id===_)?.name&&x?.(_,K.trim()),B(null),te(""),Ot(false);},ya=()=>{B(null),te(""),Ot(false);},N=(_,ae)=>{ae.stopPropagation(),v?.(_.id);},ee=(_,ae)=>{ae.preventDefault(),Ke.current=ae.clientY,H(_),et.current=false,O(false),Mt({x:ae.clientX,y:ae.clientY});},se=_=>{if(!X||(Math.abs(_.clientY-Ke.current)>We&&!et.current&&(et.current=true,O(true)),Mt({x:_.clientX,y:_.clientY}),!et.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ue=null,He=null;Ee.forEach(W=>{let ce=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==X&&_.clientY>=ce.top&&_.clientY<=ce.bottom){Ue=Ie;let Dt=_.clientY-ce.top,Je=ce.height;Dt<Je*.25?He="above":Dt>Je*.75?He="below":He="child";}}),Me(Ue),ve(He);},De=()=>{if(et.current&&X&&Ce&&Oe){if(Oe==="child")w?.(X,Ce);else if(Oe==="above"||Oe==="below"){let _=(Ue,He,W=null)=>{for(let ce of Ue){if(ce.id===He)return W;if(ce.subtasks){let Ie=_(ce.subtasks,He,ce.id);if(Ie!==void 0)return Ie}}},ae=_(e,Ce,null),Ee=(Ue,He)=>{let W=Ue.findIndex(ce=>ce.id===He);return Oe==="below"?W+1:W};if(ae===null){let Ue=Ee(e,Ce);w?.(X,null,Ue);}else {let Ue=ct.find(He=>He.task.id===ae)?.task;if(Ue?.subtasks){let He=Ee(Ue.subtasks,Ce);w?.(X,ae,He);}}}}H(null),Me(null),ve(null),Mt(null),et.current=false,O(false);};react.useEffect(()=>{if(X)return document.addEventListener("mousemove",se),document.addEventListener("mouseup",De),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",De),document.body.style.cursor="",document.body.style.userSelect="";}},[X,Ce,Oe]);let $e=(_,ae,Ee)=>{switch(_.id){case "name":let Ue=I===ae.id,He=M===ae.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:He?1:.3},onMouseDown:q=>ee(ae.id,q),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),ae.subtasks&&ae.subtasks.length>0?jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),m?.(ae.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ae.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ae.color||"#3B82F6",opacity:ae.parentId?.6:1,borderColor:ae.isMilestone?t.accent:"transparent",borderWidth:ae.isMilestone?"2px":"0px"},title:ae.isMilestone?"Milestone":ae.parentId?"Subtask":"Task"})}),Ue?jsxRuntime.jsx("input",{ref:ie,type:"text",value:K,onChange:q=>te(q.target.value),onKeyDown:q=>{q.key==="Enter"?pa(ae.id):q.key==="Escape"&&ya();},onBlur:()=>pa(ae.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:q=>q.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:ae.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ae.parentId?"13px":"14px",fontWeight:ae.isMilestone?600:ae.parentId?400:600,letterSpacing:ae.parentId?"0":"-0.01em"},title:ae.name,children:ae.name}),He&&!Ue&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:q=>N(ae,q),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:q=>{q.stopPropagation(),ue(ae);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let ce=_.id==="startDate"?"startDate":"endDate",Ie=ae[ce],Dt=le?.taskId===ae.id&&le?.field===ce,Je=q=>q?(typeof q=="string"?new Date(q):q).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:q=>{if(Dt)xe(null);else {let Ae=q.currentTarget.getBoundingClientRect();xe({taskId:ae.id,field:ce,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Ae.bottom+4,left:Ae.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Je(Ie)})]}),Dt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>xe(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:le?.position.top,left:le?.position.left},onClick:q=>q.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,Ae=new Date(q);Ae.setDate(q.getDate()+1);let ot=new Date(q);ot.setDate(q.getDate()+7);let ne=new Date(q);return ne.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:Ae},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:ne}].map((xt,Le)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:At=>At.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:xt.date}),xe(null);},children:xt.label},Le))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(ae.id,{[ce]:void 0}),xe(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:le?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>xe(q=>q?{...q,month:new Date(q.month.getFullYear(),q.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((q,Ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},Ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=le?.month||new Date,Ae=q.getFullYear(),ot=q.getMonth(),ne=new Date(Ae,ot,1).getDay(),Re=new Date(Ae,ot+1,0).getDate(),xt=new Date,Le=[];for(let st=ne-1;st>=0;st--)Le.push({day:new Date(Ae,ot,-st).getDate(),date:new Date(Ae,ot-1,new Date(Ae,ot,-st).getDate()),isCurrentMonth:false});for(let st=1;st<=Re;st++)Le.push({day:st,date:new Date(Ae,ot,st),isCurrentMonth:true});let At=42-Le.length;for(let st=1;st<=At;st++)Le.push({day:st,date:new Date(Ae,ot+1,st),isCurrentMonth:false});return Le.map((st,ga)=>{let zt=st.date.toDateString()===xt.toDateString(),kt=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===st.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:st.isCurrentMonth?kt?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:kt?"#3B82F6":"transparent",boxShadow:zt&&!kt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(ae.id,{[ce]:st.date}),xe(null);},children:st.day},ga)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:oe(ae)})});case "assignees":let va=r.filter(q=>ae.assignees?.some(Ae=>Ae.name===q.name||Ae.initials===q.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Hr,{assignedUsers:va,availableUsers:r,onChange:q=>{let Ae=q.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));h?.(ae.id,{assignees:Ae.length>0?Ae:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:ae.status||"todo",onChange:q=>{h?.(ae.id,{status:q,progress:q==="completed"?100:ae.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ae.progress}%`,backgroundColor:ae.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[ae.progress,"%"]})]});case "priority":let ua={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},E={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ye=ua[ae.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsxRuntime.jsx(zr,{priority:ye,onChange:q=>{q&&h?.(ae.id,{priority:E[q]||"medium"});}})});default:return null}},tt=_=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(_);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{h?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{h?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{h?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{k?k(_.id,_.name):b?.([_.id]);}}],Be=u.filter(_=>_.visible),rt=Be.reduce((_,ae)=>_+ae.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:rt},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${Jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Be.map((_,ae)=>{let Ee=ae===Be.length-1,Ue=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Ue?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:He=>{He.preventDefault(),Q({isOpen:true,x:He.clientX,y:He.clientY,type:"header",columnId:_.id});},onMouseEnter:He=>{He.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:He=>{He.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:de===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:He=>{He.preventDefault(),He.stopPropagation(),be(_.id),J(He.clientX),G(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(Cn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>ze(!Pe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Pe&&jsxRuntime.jsxs("div",{ref:at,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>ze(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ea},children:ct.map(({task:_,level:ae},Ee)=>{let Ue=Xt(_.id),He=Ce===_.id,W=He&&Oe==="above",ce=He&&Oe==="below",Ie=He&&Oe==="child",Dt={};return Ie&&(Dt.backgroundColor=`${t.accent}15`,Dt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${X===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:Ie?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Dt},onMouseEnter:()=>D(_.id),onMouseLeave:()=>D(null),onClick:Je=>{let ua=vo(e).map(q=>q.id),ye=navigator.platform.toUpperCase().indexOf("MAC")>=0?Je.metaKey:Je.ctrlKey;Fe(_.id,ua,ye,Je.shiftKey),s?.(_);},onDoubleClick:Je=>{Je.stopPropagation(),n?.(_);},onContextMenu:Je=>{Je.preventDefault(),Q({isOpen:true,x:Je.clientX,y:Je.clientY,type:"task",task:_}),p?.(_,Je);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[W&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ce&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Be.map((Je,va)=>{let ua=va===Be.length-1,E=Je.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${E?"justify-start":"justify-center"}`,style:{width:`${Je.width}px`,minWidth:`${Je.minWidth??(E?200:60)}px`,maxWidth:`${Je.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ua?"none":`1px solid ${M===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:$e(Je,_,E?ae:0)},`${_.id}-${Je.id}`)})]},_.id)})}),jsxRuntime.jsx(yo,{isOpen:A.isOpen,x:A.x,y:A.y,items:A.type==="header"&&A.columnId?tt(A.columnId):A.type==="task"&&A.task?Ge(A.task):[],onClose:()=>Q({...A,isOpen:false}),theme:t}),mt&&vt&&X&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:vt.x+12,top:vt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=ct.find(ae=>ae.task.id===X)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,p]=react.useState(e),[m,i]=react.useState(t),[u,d]=react.useState(null),[g,h]=react.useState(null),[C,T]=react.useState(null),[c,b]=react.useState(null),[y,l]=react.useState(0),[x,v]=react.useState(0),[S,k]=react.useState(null),[w,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:p,ghostWidth:m,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:x,setSegmentDragOffsetX:v,hoveredSegmentIndex:S,setHoveredSegmentIndex:k,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(K,te)=>{r("none"),d(null),h(null),p(K),i(te),v(0),b(null),l(0);}}}function Sn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:p,onClick:m,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:g,allTaskPositions:h=[],onDragMove:C,onHoverChange:T}){let c=dc(t,r),b=react.useRef(null),{dragMode:y,setDragMode:l,dragOffset:x,setDragOffset:v,ghostX:S,setGhostX:k,ghostWidth:w,setGhostWidth:R,connectionLine:M,setConnectionLine:D,hoveredTaskId:I,setHoveredTaskId:B,activeZone:K,setActiveZone:te,draggedSegmentIndex:ie,setDraggedSegmentIndex:de,draggedSegmentStartX:be,setDraggedSegmentStartX:$,segmentDragOffsetX:J,setSegmentDragOffsetX:U,hoveredSegmentIndex:G,setHoveredSegmentIndex:A,isHovered:Q,setIsHovered:X,isDragging:H,isResizing:Ce,isConnecting:Me,resetDragState:Oe}=c,ve=32,Ke=8,We=e.endDate&&e.endDate<new Date&&e.progress<100,et=e.isCriticalPath,vt=o.name==="neutral"||o.today==="#1C1917",Mt=e.status==="completed"||e.progress===100,mt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},le=e.isCriticalPath||We?"#DC2626":e.color?e.color:e.priority&&mt[e.priority]?mt[e.priority]:o.taskBarPrimary,Pe=(N=>N>=80?20:N>=60?15:N>=50?12:10)(r),ze=r<50,at=r<40;react.useEffect(()=>{if(T)if(Q&&!H&&!e.segments){let N=a<100;T({task:e,x:t,y:a,width:r,height:ve,showBelow:N});}else T(null);},[Q,H,e,t,a,r,ve,T]);let Et=N=>N.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Fe=()=>{let N=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${N} day${N!==1?"s":""}`},Xt=N=>Math.round(N/s)*s,Ot=N=>{let ee=Math.round(N/s),se=new Date(n);return se.setDate(se.getDate()+ee),se},Nt=(N,ee)=>{for(let se of h){if(se.id===e.id)continue;let De=5;if(N>=se.x-De&&N<=se.x+se.width+De&&ee>=se.y-De&&ee<=se.y+se.height+De)return se.id}return null},ct=react.useCallback((N,ee,se)=>{N.preventDefault(),N.stopPropagation();let De=b.current?.ownerSVGElement;if(!De)return;let $e=De.createSVGPoint();$e.x=N.clientX,$e.y=N.clientY;let tt=$e.matrixTransform(De.getScreenCTM()?.inverse()),Ge=se!==void 0?se:t,Be=ee;if(!Be){let rt=tt.x-Ge;N.shiftKey?(Be="connect",D({x:t+r,y:a+ve/2})):N.ctrlKey||N.metaKey?Be="move":N.altKey?Be=rt<r/2?"resize-start":"resize-end":at?rt<r/2?Be="move":Be="resize-end":ze?rt<=Pe/2?Be="resize-start":rt>=r-Pe/2?Be="resize-end":Be="move":rt<=Pe?Be="resize-start":rt>=r-Pe?Be="resize-end":Be="move";}l(Be),X(false),te(null),Be==="move"?v(tt.x-Ge):Be==="connect"?D({x:t+r,y:a+ve/2}):v(0),k(Ge),R(r);},[t,r,a,ve]),Jt=react.useCallback(N=>{if(y==="none")return;let ee=b.current?.ownerSVGElement;if(!ee)return;let se=ee.createSVGPoint();se.x=N.clientX,se.y=N.clientY;let De=se.matrixTransform(ee.getScreenCTM()?.inverse());if(y==="connect"){D({x:De.x,y:De.y});let $e=Nt(De.x,De.y);B($e);}else if(y==="move"){let $e=De.x-x,tt=Xt($e);k(tt),R(r);let Ge=Math.round((tt-t)/s);if(C?.(e.id,Ge,true),e.segments&&e.segments.length>0&&ie!==null){let Be=tt-be;U(Be);}}else if(y==="resize-start"){let $e=De.x,tt=Xt($e),Ge=t+r-tt;Ge>=s&&(k(tt),R(Ge));}else if(y==="resize-end"){let $e=De.x,Ge=Xt($e)-t;Ge>=s&&R(Ge);}},[y,t,r,s,x,e,Xt,ie,be,Nt,B,D,k,R,U,C]),Ea=react.useCallback(()=>{if(y!=="none"){if(y==="connect")I&&g&&g(e,I),D(null),B(null);else {let N=e.endDate.getTime()-e.startDate.getTime(),ee,se,De=true;if(y==="move"){if(ee=Ot(S),se=new Date(ee.getTime()+N),e.segments&&e.segments.length>0&&ie!==null){let $e=Math.round(J/s),tt=e.segments.map((_,ae)=>{if(ae===ie){let Ee=new Date(_.startDate),Ue=new Date(_.endDate);return Ee.setDate(Ee.getDate()+$e),Ue.setDate(Ue.getDate()+$e),{startDate:Ee,endDate:Ue}}return _}),Ge=tt.flatMap(_=>[_.startDate,_.endDate]),Be=new Date(Math.min(...Ge.map(_=>_.getTime()))),rt=new Date(Math.max(...Ge.map(_=>_.getTime())));d?.({...e,segments:tt},Be,rt),Oe(t,r);return}}else y==="resize-start"?(ee=Ot(S),se=e.endDate,ee>se&&(console.warn("Invalid date range: start date must be before or equal to end date"),De=false)):y==="resize-end"?(ee=e.startDate,se=Ot(S+w),se<ee&&(console.warn("Invalid date range: end date must be after or equal to start date"),De=false)):De=false;De&&ee&&se&&(se.getTime()<ee.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,ee,se));}C?.(e.id,0,false),Oe(t,r);}},[y,S,w,e,d,I,g,t,r,s,Ot,J,ie,Oe,C]);react.useEffect(()=>{if(y==="none")return;let N=se=>{Jt(se);},ee=()=>{Ea();};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",ee);}},[y,Jt,Ea]);let oe=H&&!Me?S:t,ue=H&&!Me?w:r,pa=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!H&&m?.(e),onDoubleClick:N=>{H||(N.stopPropagation(),i?.(e));},onContextMenu:N=>{N.preventDefault(),u?.(e,N);},onMouseEnter:()=>!H&&X(true),onMouseLeave:()=>{H||(X(false),te(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:ve,fill:"transparent",style:{pointerEvents:"all"}}),Q&&!H&&!ze&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Pe,height:ve,fill:K==="resize-start"?o.accent:"transparent",opacity:K==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-start"),onMouseDown:N=>ct(N,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Pe,y:a,width:r-Pe*2,height:ve,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r-Pe,y:a,width:Pe,height:ve,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")})]}),Q&&!H&&at&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:ve,fill:K==="move"?o.accent:"transparent",opacity:K==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>te("move"),onMouseDown:N=>ct(N,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:ve,fill:K==="resize-end"?o.accent:"transparent",opacity:K==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>te("resize-end"),onMouseDown:N=>ct(N,"resize-end")}),Q&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ve-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:S,y:a,width:w,height:ve,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:le,"data-task-class":pa,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Me?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:N=>ct(N),style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue*(e.progress/100),height:ve,rx:Ke,fill:le,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((N,ee)=>{let se=(N.startDate.getTime()-n.getTime())/864e5*s,$e=(N.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-se+s,tt=H&&y==="move"&&ie===ee,Ge=G===ee,Be=tt?se+J:se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!H&&A(ee),onMouseLeave:()=>!H&&A(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Be,y:a,width:$e,height:ve,rx:Ke,fill:le,initial:{opacity:0,scale:.95},animate:{opacity:tt||e.parentId?.6:Ge?.9:.8,scale:Ge&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:rt=>{rt.stopPropagation(),de(ee),$(se),ct(rt,void 0,se);},style:{cursor:H?Me?"crosshair":Ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Be,y:a,width:$e*(e.progress/100),height:ve,rx:Ke,fill:le,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ee}`)}),vt&&(We||et)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[et&&!We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),We&&jsxRuntime.jsx("rect",{x:oe,y:a,width:ue,height:ve,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ue>60&&!e.segments&&(()=>{let N=p.taskLabel(e),ee=typeof N=="string"?N:e.name,se=ee.length>Math.floor(ue/8)?`${ee.substring(0,Math.floor(ue/8))}...`:ee;return jsxRuntime.jsx("text",{x:oe+12,y:a+ve/2,dominantBaseline:"middle",fill:Mt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Mt?"line-through":"none"},children:se})})(),ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxRuntime.jsxs("text",{x:oe+ue-12,y:a+ve/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ue>80&&!H&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:oe+ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Q||Ce)&&!Me&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe-2,y:a,width:16,height:ve,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-start"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+4,y:a+8,width:3,height:ve-16,rx:1.5,fill:K==="resize-start"||y==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:oe+ue-14,y:a,width:16,height:ve,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>te("resize-end"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:oe+ue-7,y:a+8,width:3,height:ve-16,rx:1.5,fill:K==="resize-end"||y==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+ve/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>te("connect"),onMouseLeave:()=>te(null),onMouseDown:N=>{N.stopPropagation(),ct(N,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+ve/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:K==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Me&&M&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+ve/2,x2:M.x,y2:M.y,stroke:I?o.statusCompleted:o.accent,strokeWidth:I?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:I?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:M.x,cy:M.y,r:I?8:6,fill:I?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),I&&jsxRuntime.jsx(framerMotion.motion.text,{x:M.x+15,y:M.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:M.x+10},animate:{opacity:1,x:M.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Me&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:oe-2,y:a-2,width:ue+4,height:ve+4,rx:Ke+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:S+w,y1:0,x2:S+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&!T&&(()=>{let se=a<100,De=se?a+ve+13:a-82-13,$e=se?`M ${oe+ue/2-6} ${a+ve+3} L ${oe+ue/2} ${a+ve+13} L ${oe+ue/2+6} ${a+ve+3}`:`M ${oe+ue/2-6} ${a-13} L ${oe+ue/2} ${a-3} L ${oe+ue/2+6} ${a-13}`,tt=De+22,Ge=De+40,Be=De+55,rt=De+70,_=se?De+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:$e,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:oe+ue/2-120,y:De,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:oe+ue/2,y:tt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:oe+ue/2-110,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.startDate)}),jsxRuntime.jsx("text",{x:oe+ue/2-110,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:oe+ue/2-70,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Et(e.endDate)}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:oe+ue/2+65,y:Ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe()}),jsxRuntime.jsx("text",{x:oe+ue/2+10,y:Be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:oe+ue/2+65,y:Be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:oe+ue/2-110,y:rt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:oe+ue/2-50,y:rt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ae=>ae.name).join(", ").substring(0,30),e.assignees.map(ae=>ae.name).join(", ").length>30?"...":""]})]}),!se&&jsxRuntime.jsx("text",{x:oe+ue/2,y:_,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:at?"Left: move \u2022 Right: resize":ze?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function pc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:p}=e,m=82,i=13,u=p?o+n+i:o-m-i,d=p?`M ${r+s/2-6} ${o+n+3} L ${r+s/2} ${o+n+13} L ${r+s/2+6} ${o+n+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,g=u+22,h=u+40,C=u+55,T=u+70,c=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?c(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?c(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:C,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:C,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function Mn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:p=false}){let[m,i]=react.useState(false),[u,d]=react.useState(null),g=r-t,h=g>0,C=Math.abs(g)<5,c=5,b=20,y=!C&&a<=e,l,x;if(C)if(x=(e+a)/2,n==="squared")l=`M ${e} ${t} L ${a} ${r}`;else {let ie=Math.min(Math.abs(a-e)/3,30);l=`M ${e} ${t} C ${e+ie} ${t}, ${a-ie} ${r}, ${a} ${r}`;}else if(x=a-b,y){let de=e+15,be=a-b,$=h?t+20:t-20;x=be,n==="squared"?l=`M ${e} ${t} L ${de} ${t} L ${de} ${$} L ${be} ${$} L ${be} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t+c} L ${de} ${$-c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$+c} L ${be} ${r-c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${de-c} ${t} Q ${de} ${t} ${de} ${t-c} L ${de} ${$+c} Q ${de} ${$} ${de-c} ${$} L ${be+c} ${$} Q ${be} ${$} ${be} ${$-c} L ${be} ${r+c} Q ${be} ${r} ${be+c} ${r} L ${a} ${r}`;}else n==="squared"?l=`M ${e} ${t} L ${x} ${t} L ${x} ${r} L ${a} ${r}`:h?l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t+c} L ${x} ${r-c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`:l=`M ${e} ${t} L ${x-c} ${t} Q ${x} ${t} ${x} ${t-c} L ${x} ${r+c} Q ${x} ${r} ${x+c} ${r} L ${a} ${r}`;let v=5,S=`M ${a} ${r} L ${a-v} ${r-v*.5} M ${a} ${r} L ${a-v} ${r+v*.5}`,k=o.dependency,w=o.dependencyHover||k,R="#f87171",M="rgba(248, 113, 113, 0.15)",D=x,I=(t+r)/2;if(u)if(C)D=Math.max(e+10,Math.min(a-10,u.x)),I=t;else if(y){let ie=e+15,de=a-b,be=h?t+20:t-20,$=[[e,t,ie,t],[ie,t,ie,be],[ie,be,de,be],[de,be,de,r],[de,r,a,r]],J=1/0,U={x:D,y:I};for(let G of $){let A=B(u.x,u.y,G[0],G[1],G[2],G[3]),Q=Math.hypot(u.x-A.x,u.y-A.y);Q<J&&(J=Q,U=A);}D=U.x,I=U.y;}else {let ie=[[e,t,x,t],[x,t,x,r],[x,r,a,r]],de=1/0,be={x:D,y:I};for(let $ of ie){let J=B(u.x,u.y,$[0],$[1],$[2],$[3]),U=Math.hypot(u.x-J.x,u.y-J.y);U<de&&(de=U,be=J);}D=be.x,I=be.y;}function B(ie,de,be,$,J,U){let G=J-be,A=U-$,Q=G*G+A*A;if(Q===0)return {x:be,y:$};let X=((ie-be)*G+(de-$)*A)/Q;return X=Math.max(0,Math.min(1,X)),{x:be+X*G,y:$+X*A}}let K=ie=>{let de=ie.currentTarget.ownerSVGElement;if(!de)return;let be=de.getBoundingClientRect();d({x:ie.clientX-be.left,y:ie.clientY-be.top});},te=()=>{i(false),d(null);};return p?jsxRuntime.jsxs("g",{onMouseLeave:te,onMouseMove:K,children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:l,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:S,fill:"none",stroke:w,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:w,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:K,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:l,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:S,fill:"none",stroke:m?w:k,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?w:k,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:ie=>{ie.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:D,cy:I,r:9,fill:M,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:D-3,y1:I-3,x2:D+3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+3,y1:I-3,x2:D-3,y2:I+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Fn({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),p=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var fe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,p=new Set,m=i=>{if(!n.has(i)){n.add(i),p.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=fe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=fe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=fe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=fe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
112
112
|
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=fe.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=fe.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>fe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=fe.findTaskById(e,t);return !a||!a.dependencies?[]:fe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>fe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>fe.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=fe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>fe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=fe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?fe.formatDate(m.startDate):"N/A",m.endDate?fe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=fe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?fe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?fe.formatDate(m.startDate):"","End Date":m.endDate?fe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=fe.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=fe.getEarliestStartDate(e)||new Date,p=fe.getLatestEndDate(e)||new Date,m=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?fe.calculateDuration(g.startDate,g.endDate):0,c=(g.dependencies||[]).filter(b=>o.has(b)).map(b=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
114
|
<PredecessorUID>${o.get(b)}</PredecessorUID>
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
</Calendars>
|
|
340
340
|
<Tasks>${m}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(fe.calculateCriticalPath(e).includes(t))return 0;let o=fe.getDependentTasks(e,t);if(o.length===0){let p=fe.getLatestEndDate(e);if(!p)return null;let m=fe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>fe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=fe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=fe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=fe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=fe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=fe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=fe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=fe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(D=>D.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,R=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:R,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=fe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),x=react.useCallback($=>{l($);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),S=r==="day"?60:r==="week"?20:8,k=v*S*n,w=$=>{let J=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),U=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-U);let G=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let J=$.getDay();return J===0||J===6},M=react.useCallback($=>{let J=Math.round($/(S*n)),U=new Date(o);return U.setDate(U.getDate()+J),U},[o,S,n]),D=react.useCallback(($,J)=>{if(J.startDate&&J.endDate)return;let U=$.currentTarget.ownerSVGElement;if(!U)return;let G=U.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let A=G.matrixTransform(U.getScreenCTM()?.inverse()),Q=M(A.x),X=new Date(Q);X.setDate(X.getDate()+1),g?.(J,Q,X);},[M,g]),I=react.useMemo(()=>{let $=A=>A.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let X=$(Q.subtasks),H=X.filter(Ce=>Ce.startDate&&Ce.endDate);if(H.length>0){let Ce=H.map(Ke=>Ke.startDate.getTime()),Me=H.map(Ke=>Ke.endDate.getTime()),Oe=new Date(Math.min(...Ce)),ve=new Date(Math.max(...Me));return {...Q,subtasks:X,startDate:Oe,endDate:ve}}return {...Q,subtasks:X}}return Q}),J=(A,Q=[])=>{for(let X of A)Q.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&J(X.subtasks,Q);return Q},U=$(e);return J(U)},[e]),B=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let J=$.startDate.getTime(),U=$.endDate.getTime(),G=o.getTime(),A=(J-G)/(1e3*60*60*24),Q=(U-J)/(1e3*60*60*24),X=A*S*n,H=Math.max(S*n,40),Ce=Math.max(Q*S*n,H);return {x:X,width:Ce}},[o,S,n]),K=react.useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:J,width:U}=B($),A=I.findIndex(Q=>Q.id===$.id)*a+12;return {id:$.id,x:J,y:A,width:U,height:32}}),[I,B]),te=react.useCallback(($,J,U)=>{if(!U||J===0){b([]);return}let G=fe.calculateCascadePreview(e,$,J,I,o,S*n,a,48);b(G);},[e,I,o,S,n,a,48]),ie=react.useMemo(()=>{let $=[],J=new Date(o);for(;J<=s;){let A=(J.getTime()-o.getTime())/864e5*S*n;if(r==="day")$.push({date:new Date(J),label:J.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),J.setDate(J.getDate()+1);else if(r==="week"){let Q=w(J);$.push({date:new Date(J),label:`Week ${Q}`,x:A}),J.setDate(J.getDate()+7);}else $.push({date:new Date(J),label:J.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),J.setMonth(J.getMonth()+1);}return $},[o,s,r,S,n]),de=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*S*n,[o,S,n]),be=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ie.map(($,J)=>jsxRuntime.jsxs("g",{children:[J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${J}`)),de>=0&&de<=k&&jsxRuntime.jsx("circle",{cx:de,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:be,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:be,fill:t.bgPrimary}),ie.map(($,J)=>{let U=ie[J+1]?.x||k,G=R($.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:U-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},J)}),I.map(($,J)=>{let U=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>D(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:de>0?de:100,y:J*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,J)=>{if(!$.startDate||!$.endDate)return null;let{x:U,width:G}=B($),A=J*a+12,Q=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(Fn,{task:$,x:U+G/2,y:A+16,theme:t,onClick:i},$.id):Q?jsxRuntime.jsxs("g",{onClick:()=>i?.($),onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),d?.($,X);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+G,y1:A,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A+32,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:U+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(Sn,{task:$,x:U,y:A,width:G,theme:t,dayWidth:S*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:K,onDragMove:te,onHoverChange:x},$.id)}),I.map(($,J)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(U=>{let G=I.find(ve=>ve.id===U);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(ve=>ve.id===U),Q=B(G),X=B($),H=Q.x+Q.width,Ce=A*a+28,Me=X.x,Oe=J*a+28;return jsxRuntime.jsx(Mn,{x1:H,y1:Ce,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.($.id,U)},`dep-${U}-${$.id}`)})),c.map($=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsxRuntime.jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),de>=0&&de<=k&&jsxRuntime.jsx("line",{x1:de,y1:0,x2:de,y2:be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],hc=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),p0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),u0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),g0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),f0=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,c]=react.useState(""),[b,y]=react.useState(false),[l,x]=react.useState(true),v=react.useRef(null),S=react.useRef(null),k=react.useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:D,suggestions:I=m0,maxHistory:B=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",ie=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let G=localStorage.getItem(te);if(G){let Q=JSON.parse(G).map(X=>({...X,timestamp:new Date(X.timestamp)}));C(Q.slice(-ie));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[K?.enabled,te,ie]),react.useEffect(()=>{if(K?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-ie);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,K?.enabled,te,ie]),react.useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let de=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),be=react.useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(X=>[...X.slice(-(B-1)),A]),c(""),x(false),y(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(X=>[...X,Q]);try{if(D){let X=await D(G,e);C(H=>{let Ce=H.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...Ce,Me]}),de(X);}else C(X=>[...X.filter(Ce=>!Ce.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(X){C(H=>[...H.filter(Me=>!Me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,B,D,e,de]),$=G=>{G.preventDefault(),be(T);},J=G=>{c(G),v.current?.focus();};if(react.useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(Q=>!Q),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=Q=>{let X=Q.target;k.current&&!k.current.contains(X)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let U={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${U[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${U[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(g0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(u0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:I.slice(0,4).map((G,A)=>jsxRuntime.jsx("button",{onClick:()=>J(G),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(f0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:S})]}),jsxRuntime.jsxs("form",{onSubmit:$,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(p0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${fe.formatDate(e.startDate)} - ${fe.formatDate(e.endDate)}`);let a=fe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:S,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:R,onTaskUpdate:M,onProgressChange:D,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:de,onBeforeTaskAdd:be,onAfterTaskAdd:$,onBeforeTaskUpdate:J,onAfterTaskUpdate:U,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,X=react.useContext(vn)?.theme,[H,Ce]=react.useState(X||s||"dark"),[Me,Oe]=react.useState(n),[ve,Ke]=react.useState(p),[We,et]=react.useState(1),[vt,Mt]=react.useState("all"),mt=x??vt,O=v??Mt,[le,xe]=react.useState(0),[Pe,ze]=react.useState(false),[at,Et]=react.useState(null),[Fe,Xt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ot,Nt]=react.useState(null),[ct,Jt]=react.useState(null);react.useEffect(()=>{X&&X!==H&&Ce(X);},[X]),react.useEffect(()=>{s&&s!==H&&Ce(s);},[s]);let Ea=react.useCallback(F=>{Ce(F),S?.(F);},[S]),{state:oe,setState:ue,undo:pa,redo:ya,canUndo:N,canRedo:ee,clearHistory:se}=bc(t,50),De=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=react.useRef(new Map),tt=react.useRef(false);if(!tt.current&&h){tt.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let V=JSON.parse(L);Array.isArray(V)&&($e.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Ge=react.useCallback(()=>{let F=De();if(F)try{let L=Array.from($e.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[De]);react.useEffect(()=>{let F=L=>L.map(V=>{let re=$e.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:F(ge.subtasks)}:ge});$e.current.size>0?ue(F(t)):ue(t);},[t,ue]);let Be=react.useRef(t),rt=react.useRef(true);react.useEffect(()=>{if(rt.current){rt.current=false,Be.current=oe;return}if(!r)return;let F=JSON.stringify(Be.current),L=JSON.stringify(oe);F!==L&&(Be.current=oe,r(oe));},[oe,r]);let _=react.useMemo(()=>ti(T,c),[T,c]),ae=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ue]=react.useState(()=>ae(_));react.useEffect(()=>{Ue(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=react.useMemo(()=>Ee.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[Ee]),W=react.useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),V=W.current;if(L!==V){let re=F.some(Ne=>Ne.id!=="name"),ge=V.includes(",");re?!ge&&re&&Et(null):Et(null),W.current=L;}},[Ee]);let ce=60,Ie=.6,Dt=react.useMemo(()=>{let L=He+ce,V=typeof window<"u"?window.innerWidth*Ie:800,re=Math.max(L,V);return at!==null?Math.max(200,Math.min(at,re)):Math.max(200,L)},[at,He]),Je=react.useRef(null),va=react.useRef(null),ua=react.useRef(null),E=react.useMemo(()=>Ud(H),[H]),ye=react.useMemo(()=>({theme:E,themeName:H}),[E,H]),q=react.useMemo(()=>vc(d),[d]),Ae=react.useMemo(()=>{if(!g)return oe;let F=fe.calculateCriticalPath(oe),L=V=>V.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=react.useMemo(()=>{if(mt==="all")return Ae;let F=L=>{let V=[];for(let re of L){let ge=re.subtasks?.length?F(re.subtasks):void 0,Ne=false;switch(mt){case "incomplete":Ne=re.progress<100;break;case "in_progress":Ne=re.progress>0&&re.progress<100;break;case "completed":Ne=re.progress===100;break}(Ne||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return F(Ae)},[Ae,mt]),ne=D0(ve);yc({undo:pa,redo:ya,canUndo:N,canRedo:ee,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>fe.findTaskById(oe,F),addTask:(F,L)=>{ue(V=>{if(!L)return [...V,{...F,level:0}];let re=ge=>ge.map(Ne=>Ne.id===L?{...Ne,subtasks:[...Ne.subtasks||[],{...F,parentId:L,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},updateTask:(F,L)=>{ue(V=>{let re=ge=>ge.map(Ne=>Ne.id===F?{...Ne,...L}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},deleteTask:F=>{ue(L=>{let V=re=>re.filter(ge=>ge.id===F?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(L)});},deleteTasks:F=>{ue(L=>mi(L,F));},duplicateTask:F=>{ue(L=>pi(L,[F]));},splitTask:(F,L,V=3)=>{ue(re=>fe.splitTask(re,F,L,V));},calculateEndDate:fe.calculateEndDate,calculateDuration:fe.calculateDuration,validateDependency:(F,L)=>!fe.validateDependencies(oe,F,L),getAllTasks:()=>fe.flattenTasks(oe),getTasksByStatus:F=>fe.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{ue(L=>li(L,[F]));},outdentTask:F=>{ue(L=>di(L,[F]));},moveTask:(F,L)=>{ue(V=>ci(V,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:V}=fi(oe,F);if(be){let re=be({...V,parentId:F});if((re instanceof Promise?await re:re)===false)return}ue(L),$&&$({...V,parentId:F});},scrollToTask:F=>{let V=fe.flattenTasks(oe).findIndex(re=>re.id===F);if(V!==-1&&Je.current){let re=V*ne;Je.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},collapseTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},expandAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:pa,redo:ya,canUndo:()=>N,canRedo:()=>ee,clearHistory:se,exportToPNG:async()=>{if(!ua.current||!Je.current||!va.current)throw new Error("Gantt container not found");let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=V.scrollTop,Ne=F.style.overflow,ft=F.style.height;try{let Qt=L?.querySelector(".gantt-taskgrid-content"),xa=V.querySelector("svg"),ka=Qt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||V.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ne,F.style.height=ft,L&&(L.scrollTop=re),V.scrollTop=ge;}},exportToPDF:async F=>{await fe.exportToPDF(oe,F);},exportToExcel:async F=>{await fe.exportToExcel(oe,F);},exportToJSON:()=>fe.exportToJSON(oe),exportToCSV:()=>fe.exportToCSV(oe),importFromJSON:F=>{let L=fe.importFromJSON(F);ue(L);},getTasks:()=>oe,refresh:()=>{ue(F=>[...F]);},clearAll:()=>{ue([]);}}),[oe,pa,ya,N,ee,se,E,ne]);let Re=react.useCallback(F=>{Ue(L=>L.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),xt=react.useCallback((F,L)=>{Ue(V=>V.map(re=>{if(re.id!==F)return re;let ge=re.minWidth??100,Ne=re.maxWidth??800,ft=Math.max(ge,Math.min(Ne,L));return {...re,width:ft}}));},[]),Le=react.useCallback(F=>{ue(L=>{let V=gi(L,F),re=ge=>{for(let Ne of ge){if(Ne.id===F){$e.current.set(F,Ne.isExpanded??true);return}Ne.subtasks?.length&&re(Ne.subtasks);}};return re(V),Ge(),V}),a.onTaskToggleExpand?.(F);},[a,Ge]),At=react.useCallback((F,L)=>{if(J&&J(F,L)===false)return;let re=fe.findTaskById(oe,F)?.progress,ge=ft=>ft.map(Qt=>Qt.id===F?{...Qt,...L}:Qt.subtasks?{...Qt,subtasks:ge(Qt.subtasks)}:Qt);ue(ge(oe));let Ne=fe.findTaskById(ge(oe),F);Ne&&(M?.(Ne),U?.(Ne),L.progress!==void 0&&re!==void 0&&L.progress!==re&&D?.(F,re,L.progress));},[oe,M,J,U,D]),st=react.useCallback(F=>{F.length!==0&&(ue(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),ga=react.useCallback(F=>{F.length!==0&&(ue(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),zt=react.useCallback((F,L,V)=>{ue(re=>oc(re,F,L,V)),a.onTaskReparent?.(F,L,V);},[a]),je=react.useCallback((F,L)=>{F.length!==0&&(ue(V=>ci(V,F,L)),a.onTaskMove?.(F[0],L));},[a]),kt=react.useCallback(async F=>{let L=[];for(let V of F)G&&await Promise.resolve(G(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ue(V=>mi(V,L)),L.forEach(V=>a.onTaskDelete?.(V))),A&&L.forEach(V=>A(V)));},[a,G,A]),ia=react.useCallback(F=>{ue(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=react.useCallback((F,L)=>{ue(V=>{let{tasks:re,newTask:ge}=rc(V,F,L);return be&&be(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),$?.(ge),re)});},[a,be,$]),Hm=react.useCallback((F,L)=>{ue(V=>ui(V,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=react.useCallback(F=>{ue(L=>{let{tasks:V}=fi(L,F);return a.onTaskCreate?.(F,0),V});},[a]),Wm=react.useCallback((F,L,V)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,ge=Qt=>Qt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:V,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:ge(xa.subtasks)}:xa),Ne=ge(oe);Ne=fe.autoScheduleDependents(Ne,F.id,re),ue(Ne);let ft={...F,startDate:L,endDate:V};M?.(ft);},[oe,M]),Gm=react.useCallback((F,L)=>{R?.(F,L),Xt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[R]),_m=react.useCallback((F,L)=>{let V=fe.splitTask(oe,F.id,L);ue(V),Xt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=react.useCallback(F=>{let L=fe.findTaskById(oe,F.id)||F;w?.(L),I||Nt(L);},[oe,w,I]),bl=react.useCallback((F,L,V)=>{let re=new Map,ge=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&ge(Fa.subtasks);});};ge(V);let Ne=re.get(L)||[];re.set(L,[...Ne,F]);let ft=new Set,Qt=new Set,xa=ka=>{if(!ft.has(ka)){ft.add(ka),Qt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ft.has(xr)&&xa(xr))return true;if(Qt.has(xr))return true}}return Qt.delete(ka),false};return xa(L)},[]),yl=react.useCallback((F,L)=>{if(bl(F.id,L,oe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=fe.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let h of i.dependencies){let C=t.find(T=>T.id===h);if(C){o(C);let T=r.get(h)?.ef||0;d=Math.max(d,T);}}let g=d+u;r.set(i.id,{es:d,ef:g});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,p=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?fe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(C=>C.dependencies&&C.dependencies.includes(i.id)),g=s;if(d.length>0)for(let C of d){p(C);let T=n.get(C.id)?.ls||0;g=Math.min(g,T);}let h=g-u;n.set(i.id,{ls:h,lf:g});};a.forEach(p);let m=[];for(let i of a){let u=r.get(i.id),d=n.get(i.id);if(u&&d){let g=d.ls-u.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=fe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(fe.calculateCriticalPath(e).includes(t))return 0;let o=fe.getDependentTasks(e,t);if(o.length===0){let p=fe.getLatestEndDate(e);if(!p)return null;let m=fe.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let n=fe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>fe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=fe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=fe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let p=fe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=fe.calculateEndDate(m,p),u=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=fe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,p)=>{if(a===0)return [];let m=[],i=o.getTime(),u=1e3*60*60*24,d=fe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(h,C,T=new Set)=>{if(T.has(h))return;T.add(h);let c=fe.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(D=>D.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,k=(l-i)/u*s,w=k+C*s,R=Math.max(v*s,s),M=p+y*n+12;m.push({taskId:b.id,taskName:b.name,originalX:k,previewX:w,width:R,y:M,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=fe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:p}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function In({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:p,dependencyLineStyle:m="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),x=react.useCallback($=>{l($);},[]),v=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),S=r==="day"?60:r==="week"?20:8,k=v*S*n,w=$=>{let J=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),U=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-U);let G=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-G.getTime())/864e5+1)/7)},R=$=>{let J=$.getDay();return J===0||J===6},M=react.useCallback($=>{let J=Math.round($/(S*n)),U=new Date(o);return U.setDate(U.getDate()+J),U},[o,S,n]),D=react.useCallback(($,J)=>{if(J.startDate&&J.endDate)return;let U=$.currentTarget.ownerSVGElement;if(!U)return;let G=U.createSVGPoint();G.x=$.clientX,G.y=$.clientY;let A=G.matrixTransform(U.getScreenCTM()?.inverse()),Q=M(A.x),X=new Date(Q);X.setDate(X.getDate()+1),g?.(J,Q,X);},[M,g]),I=react.useMemo(()=>{let $=A=>A.map(Q=>{if(Q.subtasks&&Q.subtasks.length>0){let X=$(Q.subtasks),H=X.filter(Ce=>Ce.startDate&&Ce.endDate);if(H.length>0){let Ce=H.map(Ke=>Ke.startDate.getTime()),Me=H.map(Ke=>Ke.endDate.getTime()),Oe=new Date(Math.min(...Ce)),ve=new Date(Math.max(...Me));return {...Q,subtasks:X,startDate:Oe,endDate:ve}}return {...Q,subtasks:X}}return Q}),J=(A,Q=[])=>{for(let X of A)Q.push(X),X.subtasks&&X.subtasks.length>0&&(X.isExpanded===void 0||X.isExpanded)&&J(X.subtasks,Q);return Q},U=$(e);return J(U)},[e]),B=react.useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let J=$.startDate.getTime(),U=$.endDate.getTime(),G=o.getTime(),A=(J-G)/(1e3*60*60*24),Q=(U-J)/(1e3*60*60*24),X=A*S*n,H=Math.max(S*n,40),Ce=Math.max(Q*S*n,H);return {x:X,width:Ce}},[o,S,n]),K=react.useMemo(()=>I.filter($=>$.startDate&&$.endDate).map($=>{let{x:J,width:U}=B($),A=I.findIndex(Q=>Q.id===$.id)*a+12;return {id:$.id,x:J,y:A,width:U,height:32}}),[I,B]),te=react.useCallback(($,J,U)=>{if(!U||J===0){b([]);return}let G=fe.calculateCascadePreview(e,$,J,I,o,S*n,a,48);b(G);},[e,I,o,S,n,a,48]),ie=react.useMemo(()=>{let $=[],J=new Date(o);for(;J<=s;){let A=(J.getTime()-o.getTime())/864e5*S*n;if(r==="day")$.push({date:new Date(J),label:J.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:A}),J.setDate(J.getDate()+1);else if(r==="week"){let Q=w(J);$.push({date:new Date(J),label:`Week ${Q}`,x:A}),J.setDate(J.getDate()+7);}else $.push({date:new Date(J),label:J.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:A}),J.setMonth(J.getMonth()+1);}return $},[o,s,r,S,n]),de=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*S*n,[o,S,n]),be=Math.max(I.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ie.map(($,J)=>jsxRuntime.jsxs("g",{children:[J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${J}`)),de>=0&&de<=k&&jsxRuntime.jsx("circle",{cx:de,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:be,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:be,fill:t.bgPrimary}),ie.map(($,J)=>{let U=ie[J+1]?.x||k,G=R($.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:$.x,y:0,width:U-$.x,height:I.length*a,fill:t.bgWeekend,opacity:1}),J>0&&jsxRuntime.jsx("line",{x1:$.x,y1:0,x2:$.x,y2:I.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},J)}),I.map(($,J)=>{let U=$.startDate&&$.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${$.id}`),!U&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:J*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>D(G,$),onMouseEnter:G=>{G.currentTarget.setAttribute("fill",t.accentLight),G.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:G=>{G.currentTarget.setAttribute("fill","transparent"),G.currentTarget.setAttribute("opacity","1");}},`clickable-${$.id}`),jsxRuntime.jsx("text",{x:de>0?de:100,y:J*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${$.id}`)]})]},`row-group-${$.id}`)}),I.map(($,J)=>{if(!$.startDate||!$.endDate)return null;let{x:U,width:G}=B($),A=J*a+12,Q=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;return $.isMilestone?jsxRuntime.jsx(Fn,{task:$,x:U+G/2,y:A+16,theme:t,onClick:i},$.id):Q?jsxRuntime.jsxs("g",{onClick:()=>i?.($),onContextMenu:X=>{X.preventDefault(),X.stopPropagation(),d?.($,X);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:U,y:A,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U+G,y2:A,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A,x2:U,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U+G,y1:A,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:U,y1:A+32,x2:U+G,y2:A+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:U+12,y:A+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:$.name})]},$.id):jsxRuntime.jsx(Sn,{task:$,x:U,y:A,width:G,theme:t,dayWidth:S*n,startDate:o,templates:p,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:K,onDragMove:te,onHoverChange:x},$.id)}),I.map(($,J)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(U=>{let G=I.find(ve=>ve.id===U);if(!G||!G.startDate||!G.endDate)return null;let A=I.findIndex(ve=>ve.id===U),Q=B(G),X=B($),H=Q.x+Q.width,Ce=A*a+28,Me=X.x,Oe=J*a+28;return jsxRuntime.jsx(Mn,{x1:H,y1:Ce,x2:Me,y2:Oe,theme:t,lineStyle:m,onDelete:()=>C?.($.id,U)},`dep-${U}-${$.id}`)})),c.map($=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:32,rx:8,fill:$.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs($.daysDelta)>0&&jsxRuntime.jsx("text",{x:$.previewX+$.width/2,y:$.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),de>=0&&de<=k&&jsxRuntime.jsx("line",{x1:de,y1:0,x2:de,y2:be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(pc,{tooltipData:y,theme:t})]})]})}var m0=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],hc=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),p0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),u0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),g0=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),f0=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Bn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:p,onDependencyDelete:m}){let[i,u]=react.useState(false),[d,g]=react.useState(false),[h,C]=react.useState([]),[T,c]=react.useState(""),[b,y]=react.useState(false),[l,x]=react.useState(true),v=react.useRef(null),S=react.useRef(null),k=react.useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:M="bottom-right",onCommand:D,suggestions:I=m0,maxHistory:B=50,persistHistory:K}=a,te=K?.storageKey||"gantt-ai-history",ie=K?.maxMessages??5;react.useEffect(()=>{if(K?.enabled)try{let G=localStorage.getItem(te);if(G){let Q=JSON.parse(G).map(X=>({...X,timestamp:new Date(X.timestamp)}));C(Q.slice(-ie));}}catch(G){console.warn("[GanttAIAssistant] Failed to load persisted history:",G);}},[K?.enabled,te,ie]),react.useEffect(()=>{if(K?.enabled&&h.length>0)try{let G=h.filter(A=>!A.isLoading).slice(-ie);localStorage.setItem(te,JSON.stringify(G));}catch(G){console.warn("[GanttAIAssistant] Failed to persist history:",G);}},[h,K?.enabled,te,ie]),react.useEffect(()=>{S.current&&S.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let de=react.useCallback(G=>{if(G.success)switch(G.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":G.taskId&&G.updates&&o?.(G.taskId,G.updates);break;case "create_task":G.newTask&&s?.(G.newTask);break;case "delete_task":G.taskId&&n?.(G.taskId);break;case "link_tasks":G.dependencyFrom&&G.dependencyTo&&p?.(G.dependencyFrom,G.dependencyTo);break;case "unlink_tasks":G.taskId&&G.dependencyFrom&&m?.(G.taskId,G.dependencyFrom);break}},[o,s,n,p,m]),be=react.useCallback(async G=>{if(!G.trim()||b)return;let A={id:`user-${Date.now()}`,role:"user",content:G,timestamp:new Date};C(X=>[...X.slice(-(B-1)),A]),c(""),x(false),y(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(X=>[...X,Q]);try{if(D){let X=await D(G,e);C(H=>{let Ce=H.filter(Oe=>!Oe.isLoading),Me={id:`assistant-${Date.now()}`,role:"assistant",content:X.message,timestamp:new Date,command:X};return [...Ce,Me]}),de(X);}else C(X=>[...X.filter(Ce=>!Ce.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(X){C(H=>[...H.filter(Me=>!Me.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${X instanceof Error?X.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,B,D,e,de]),$=G=>{G.preventDefault(),be(T);},J=G=>{c(G),v.current?.focus();};if(react.useEffect(()=>{let G=A=>{(A.metaKey||A.ctrlKey)&&A.key==="k"&&(A.preventDefault(),u(Q=>!Q),i||g(false)),A.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),react.useEffect(()=>{if(!i)return;let G=Q=>{let X=Q.target;k.current&&!k.current.contains(X)&&u(false);},A=setTimeout(()=>{document.addEventListener("mousedown",G);},100);return ()=>{clearTimeout(A),document.removeEventListener("mousedown",G);}},[i]),!w)return null;let U={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!i&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${U[M]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:k,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${U[M]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(hc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(G=>!G),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(g0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(u0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[h.length===0&&l&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:I.slice(0,4).map((G,A)=>jsxRuntime.jsx("button",{onClick:()=>J(G),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:G.length>30?G.slice(0,30)+"...":G},A))})]}),h.map(G=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${G.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${G.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:G.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:G.role==="user"?"white":t.textPrimary},children:[G.isLoading?jsxRuntime.jsx(f0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:G.content}),G.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:G.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:G.command.success?"#10B981":"#EF4444"},children:[G.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:G.command.type.replace(/_/g," ")})]})]})},G.id)),jsxRuntime.jsx("div",{ref:S})]}),jsxRuntime.jsxs("form",{onSubmit:$,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:v,type:"text",value:T,onChange:G=>c(G.target.value),placeholder:R,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:T.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:T.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(p0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function bc(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,u=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!u)return {...d,present:g};let h=[...d.past,d.present];return h.length>t&&h.shift(),{past:h,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),p=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function yc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!p&&m&&n.key==="y"){n.preventDefault(),t();return}if(p&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var v0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${fe.formatDate(e.startDate)} - ${fe.formatDate(e.endDate)}`);let a=fe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>fe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function vc(e){return {...v0,...e}}var D0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},wc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:h,aiAssistant:C,locale:T="en",customTranslations:c,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:l,taskFilter:x,onTaskFilterChange:v,onThemeChange:S,onTaskClick:k,onTaskDblClick:w,onTaskContextMenu:R,onTaskUpdate:M,onProgressChange:D,onTaskEdit:I,onTaskAddSubtask:B,onTaskMarkIncomplete:K,onTaskSetInProgress:te,onDependencyCreate:ie,onDependencyDelete:de,onBeforeTaskAdd:be,onAfterTaskAdd:$,onBeforeTaskUpdate:J,onAfterTaskUpdate:U,onBeforeTaskDelete:G,onAfterTaskDelete:A}=a,X=react.useContext(vn)?.theme,[H,Ce]=react.useState(X||s||"dark"),[Me,Oe]=react.useState(n),[ve,Ke]=react.useState(p),[We,et]=react.useState(1),[vt,Mt]=react.useState("all"),mt=x??vt,O=v??Mt,[le,xe]=react.useState(0),[Pe,ze]=react.useState(false),[at,Et]=react.useState(null),[Fe,Xt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ot,Nt]=react.useState(null),[ct,Jt]=react.useState(null);react.useEffect(()=>{X&&X!==H&&Ce(X);},[X]),react.useEffect(()=>{s&&s!==H&&Ce(s);},[s]);let Ea=react.useCallback(F=>{Ce(F),S?.(F);},[S]),{state:oe,setState:ue,undo:pa,redo:ya,canUndo:N,canRedo:ee,clearHistory:se}=bc(t,50),De=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),$e=react.useRef(new Map),tt=react.useRef(false);if(!tt.current&&h){tt.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let L=localStorage.getItem(F);if(L){let V=JSON.parse(L);Array.isArray(V)&&($e.current=new Map(V));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Ge=react.useCallback(()=>{let F=De();if(F)try{let L=Array.from($e.current.entries());localStorage.setItem(F,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[De]);react.useEffect(()=>{let F=L=>L.map(V=>{let re=$e.current.get(V.id),ge=re!==void 0?{...V,isExpanded:re}:V;return ge.subtasks?.length?{...ge,subtasks:F(ge.subtasks)}:ge});$e.current.size>0?ue(F(t)):ue(t);},[t,ue]);let Be=react.useRef(t),rt=react.useRef(true);react.useEffect(()=>{if(rt.current){rt.current=false,Be.current=oe;return}if(!r)return;let F=JSON.stringify(Be.current),L=JSON.stringify(oe);F!==L&&(Be.current=oe,r(oe));},[oe,r]);let _=react.useMemo(()=>ti(T,c),[T,c]),ae=react.useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Ee,Ue]=react.useState(()=>ae(_));react.useEffect(()=>{Ue(F=>F.map(L=>({...L,label:_.columns[L.id==="name"?"taskName":L.id]||L.label})));},[_]);let He=react.useMemo(()=>Ee.filter(L=>L.visible).reduce((L,V)=>L+V.width,0),[Ee]),W=react.useRef(Ee.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=Ee.filter(re=>re.visible),L=F.map(re=>re.id).join(","),V=W.current;if(L!==V){let re=F.some(Ne=>Ne.id!=="name"),ge=V.includes(",");re?!ge&&re&&Et(null):Et(null),W.current=L;}},[Ee]);let ce=60,Ie=.6,Dt=react.useMemo(()=>{let L=He+ce,V=typeof window<"u"?window.innerWidth*Ie:800,re=Math.max(L,V);return at!==null?Math.max(200,Math.min(at,re)):Math.max(200,L)},[at,He]),Je=react.useRef(null),va=react.useRef(null),ua=react.useRef(null),E=react.useMemo(()=>Ud(H),[H]),ye=react.useMemo(()=>({theme:E,themeName:H}),[E,H]),q=react.useMemo(()=>vc(d),[d]),Ae=react.useMemo(()=>{if(!g)return oe;let F=fe.calculateCriticalPath(oe),L=V=>V.map(re=>({...re,isCriticalPath:F.includes(re.id),subtasks:re.subtasks?L(re.subtasks):void 0}));return L(oe)},[oe,g]),ot=react.useMemo(()=>{if(mt==="all")return Ae;let F=L=>{let V=[];for(let re of L){let ge=re.subtasks?.length?F(re.subtasks):void 0,Ne=false;switch(mt){case "incomplete":Ne=re.progress<100;break;case "in_progress":Ne=re.progress>0&&re.progress<100;break;case "completed":Ne=re.progress===100;break}(Ne||ge&&ge.length>0)&&V.push({...re,subtasks:ge});}return V};return F(Ae)},[Ae,mt]),ne=D0(ve);yc({undo:pa,redo:ya,canUndo:N,canRedo:ee,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>fe.findTaskById(oe,F),addTask:(F,L)=>{ue(V=>{if(!L)return [...V,{...F,level:0}];let re=ge=>ge.map(Ne=>Ne.id===L?{...Ne,subtasks:[...Ne.subtasks||[],{...F,parentId:L,level:(Ne.level||0)+1}],isExpanded:true}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},updateTask:(F,L)=>{ue(V=>{let re=ge=>ge.map(Ne=>Ne.id===F?{...Ne,...L}:Ne.subtasks?{...Ne,subtasks:re(Ne.subtasks)}:Ne);return re(V)});},deleteTask:F=>{ue(L=>{let V=re=>re.filter(ge=>ge.id===F?false:(ge.subtasks&&(ge.subtasks=V(ge.subtasks)),true));return V(L)});},deleteTasks:F=>{ue(L=>mi(L,F));},duplicateTask:F=>{ue(L=>pi(L,[F]));},splitTask:(F,L,V=3)=>{ue(re=>fe.splitTask(re,F,L,V));},calculateEndDate:fe.calculateEndDate,calculateDuration:fe.calculateDuration,validateDependency:(F,L)=>!fe.validateDependencies(oe,F,L),getAllTasks:()=>fe.flattenTasks(oe),getTasksByStatus:F=>fe.flattenTasks(oe).filter(L=>L.status===F),getTasksByParent:F=>F?fe.findTaskById(oe,F)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>fe.flattenTasks(oe).filter(F=>F.isCriticalPath),indentTask:F=>{ue(L=>li(L,[F]));},outdentTask:F=>{ue(L=>di(L,[F]));},moveTask:(F,L)=>{ue(V=>ci(V,[F],L));},createSubtask:async F=>{let{tasks:L,newTask:V}=fi(oe,F);if(be){let re=be({...V,parentId:F});if((re instanceof Promise?await re:re)===false)return}ue(L),$&&$({...V,parentId:F});},scrollToTask:F=>{let V=fe.flattenTasks(oe).findIndex(re=>re.id===F);if(V!==-1&&Je.current){let re=V*ne;Je.current.scrollTo({top:re,behavior:"smooth"}),va.current&&va.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(F,L=2e3)=>{},expandTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:true}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},collapseTask:F=>{ue(L=>{let V=re=>re.map(ge=>ge.id===F?{...ge,isExpanded:false}:ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge);return V(L)});},expandAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},collapseAll:()=>{ue(F=>{let L=V=>V.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?L(re.subtasks):void 0}));return L(F)});},undo:pa,redo:ya,canUndo:()=>N,canRedo:()=>ee,clearHistory:se,exportToPNG:async()=>{if(!ua.current||!Je.current||!va.current)throw new Error("Gantt container not found");let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=V.scrollTop,Ne=F.style.overflow,ft=F.style.height;try{let Qt=L?.querySelector(".gantt-taskgrid-content"),xa=V.querySelector("svg"),ka=Qt?.scrollHeight||L?.scrollHeight||600,Fa=xa?.getBoundingClientRect().height||V.scrollHeight,Rr=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(ka,Fa)+20;L&&(L.scrollTop=0),V.scrollTop=0,F.style.overflow="visible",F.style.height=`${Rr}px`,await new Promise(wr=>setTimeout(wr,100));let kr=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:wr=>{let ro=window.getComputedStyle(wr),$r=parseInt(ro.zIndex,10);return !isNaN($r)&&$r>=50||ro.position==="fixed"}});return new Promise((wr,ro)=>{kr.toBlob($r=>{$r?wr($r):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ne,F.style.height=ft,L&&(L.scrollTop=re),V.scrollTop=ge;}},exportToPDF:async F=>{await fe.exportToPDF(oe,F);},exportToExcel:async F=>{await fe.exportToExcel(oe,F);},exportToJSON:()=>fe.exportToJSON(oe),exportToCSV:()=>fe.exportToCSV(oe),importFromJSON:F=>{let L=fe.importFromJSON(F);ue(L);},getTasks:()=>oe,refresh:()=>{ue(F=>[...F]);},clearAll:()=>{ue([]);}}),[oe,pa,ya,N,ee,se,E,ne]);let Re=react.useCallback(F=>{Ue(L=>L.map(V=>V.id===F?{...V,visible:!V.visible}:V));},[]),xt=react.useCallback((F,L)=>{Ue(V=>V.map(re=>{if(re.id!==F)return re;let ge=re.minWidth??100,Ne=re.maxWidth??800,ft=Math.max(ge,Math.min(Ne,L));return {...re,width:ft}}));},[]),Le=react.useCallback(F=>{ue(L=>{let V=gi(L,F),re=ge=>{for(let Ne of ge){if(Ne.id===F){$e.current.set(F,Ne.isExpanded??true);return}Ne.subtasks?.length&&re(Ne.subtasks);}};return re(V),Ge(),V}),a.onTaskToggleExpand?.(F);},[a,Ge]),At=react.useCallback((F,L)=>{if(J&&J(F,L)===false)return;let re=fe.findTaskById(oe,F)?.progress,ge=ft=>ft.map(Qt=>Qt.id===F?{...Qt,...L}:Qt.subtasks?{...Qt,subtasks:ge(Qt.subtasks)}:Qt);ue(ge(oe));let Ne=fe.findTaskById(ge(oe),F);Ne&&(M?.(Ne),U?.(Ne),L.progress!==void 0&&re!==void 0&&L.progress!==re&&D?.(F,re,L.progress));},[oe,M,J,U,D]),st=react.useCallback(F=>{F.length!==0&&(ue(L=>li(L,F)),a.onTaskIndent?.(F[0]));},[a]),ga=react.useCallback(F=>{F.length!==0&&(ue(L=>di(L,F)),a.onTaskOutdent?.(F[0]));},[a]),zt=react.useCallback((F,L,V)=>{ue(re=>oc(re,F,L,V)),a.onTaskReparent?.(F,L,V);},[a]),je=react.useCallback((F,L)=>{F.length!==0&&(ue(V=>ci(V,F,L)),a.onTaskMove?.(F[0],L));},[a]),kt=react.useCallback(async F=>{let L=[];for(let V of F)G&&await Promise.resolve(G(V))===false||L.push(V);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(ue(V=>mi(V,L)),L.forEach(V=>a.onTaskDelete?.(V))),A&&L.forEach(V=>A(V)));},[a,G,A]),ia=react.useCallback(F=>{ue(L=>pi(L,F)),F.forEach(L=>a.onTaskDuplicate?.(L));},[a]),vr=react.useCallback((F,L)=>{ue(V=>{let{tasks:re,newTask:ge}=rc(V,F,L);return be&&be(ge)===false?V:(a.onTaskCreate?.(ge.parentId,ge.position||0),$?.(ge),re)});},[a,be,$]),Hm=react.useCallback((F,L)=>{ue(V=>ui(V,F,L)),a.onTaskRename?.(F,L);},[a]),Zn=react.useCallback(F=>{ue(L=>{let{tasks:V}=fi(L,F);return a.onTaskCreate?.(F,0),V});},[a]),Wm=react.useCallback((F,L,V)=>{let re=F.startDate?Math.round((L.getTime()-F.startDate.getTime())/864e5):0,ge=Qt=>Qt.map(xa=>xa.id===F.id?{...xa,startDate:L,endDate:V,...F.segments&&{segments:F.segments}}:xa.subtasks?{...xa,subtasks:ge(xa.subtasks)}:xa),Ne=ge(oe);Ne=fe.autoScheduleDependents(Ne,F.id,re),ue(Ne);let ft={...F,startDate:L,endDate:V};M?.(ft);},[oe,M]),Gm=react.useCallback((F,L)=>{R?.(F,L),Xt({isOpen:true,x:L.clientX,y:L.clientY,task:F});},[R]),_m=react.useCallback((F,L)=>{let V=fe.splitTask(oe,F.id,L);ue(V),Xt({isOpen:false,x:0,y:0,task:null});},[oe]),hl=react.useCallback(F=>{let L=fe.findTaskById(oe,F.id)||F;w?.(L),I||Nt(L);},[oe,w,I]),bl=react.useCallback((F,L,V)=>{let re=new Map,ge=ka=>{ka.forEach(Fa=>{Fa.dependencies&&re.set(Fa.id,Fa.dependencies),Fa.subtasks&&ge(Fa.subtasks);});};ge(V);let Ne=re.get(L)||[];re.set(L,[...Ne,F]);let ft=new Set,Qt=new Set,xa=ka=>{if(!ft.has(ka)){ft.add(ka),Qt.add(ka);let Fa=re.get(ka)||[];for(let xr of Fa){if(!ft.has(xr)&&xa(xr))return true;if(Qt.has(xr))return true}}return Qt.delete(ka),false};return xa(L)},[]),yl=react.useCallback((F,L)=>{if(bl(F.id,L,oe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
343
343
|
|
|
344
344
|
Task dependencies must flow in one direction only.`);return}let V=re=>re.map(ge=>{if(ge.id===L){let Ne=ge.dependencies||[];if(!Ne.includes(F.id))return {...ge,dependencies:[...Ne,F.id]}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),ie?.(F.id,L);},[oe,ie,bl]),vl=react.useCallback((F,L)=>{let V=re=>re.map(ge=>{if(ge.id===F&&ge.dependencies){let Ne=ge.dependencies.filter(ft=>ft!==L);return {...ge,dependencies:Ne}}return ge.subtasks?{...ge,subtasks:V(ge.subtasks)}:ge});ue(V(oe)),de?.(F,L);},[oe,de]),{startDate:Vm,endDate:jm}=react.useMemo(()=>{let F=oe.filter(Ne=>Ne.startDate&&Ne.endDate);if(F.length===0){let Ne=new Date,ft=new Date(Ne);ft.setDate(ft.getDate()-30);let Qt=new Date(Ne);return Qt.setDate(Qt.getDate()+60),{startDate:ft,endDate:Qt}}let L=F.flatMap(Ne=>[Ne.startDate,Ne.endDate]).filter(Ne=>Ne!==void 0),V=new Date(Math.min(...L.map(Ne=>Ne.getTime()))),re=new Date(Math.max(...L.map(Ne=>Ne.getTime()))),ge=Me==="day"?7:Me==="week"?14:30;return V.setDate(V.getDate()-ge),re.setDate(re.getDate()+ge),{startDate:V,endDate:re}},[oe,Me]),Km=react.useCallback(async()=>{if(!ua.current||!Je.current||!va.current)return;await new Promise(Rr=>setTimeout(Rr,200));let F=ua.current,L=Je.current.querySelector(".gantt-grid-scroll"),V=va.current,re=L?.scrollTop||0,ge=L?.scrollLeft||0,Ne=V.scrollTop,ft=V.scrollLeft,Qt=F.style.overflow,xa=F.style.height,ka=L?.style.overflow||"",Fa=V.style.overflow,xr=F.style.width,Qo=V.style.width;try{let Rr=L?.querySelector(".gantt-taskgrid-content"),kr=V.querySelector("svg"),wr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,ro=Rr?.scrollHeight||L?.scrollHeight||600,$r=Math.max(wr,V.scrollHeight),xl=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||V.scrollWidth,ep=F.querySelector('[class*="h-12"]')?.offsetHeight||48,es=Math.max(ro,$r,wr),ts=ep+es+50,as=(L?.offsetWidth||300)+xl+10;L&&(L.scrollTop=0,L.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,F.style.overflow="visible",F.style.height=`${ts}px`,F.style.width=`${as}px`,L&&(L.style.overflow="visible",L.style.height=`${es+50}px`),V.style.overflow="visible",V.style.height=`${es+50}px`,V.style.width=`${xl+10}px`,await new Promise(os=>setTimeout(os,150));let tp=await kc__default.default(F,{backgroundColor:E.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:as,height:ts,windowWidth:as+100,windowHeight:ts+100,scrollX:0,scrollY:0,ignoreElements:os=>{let kl=window.getComputedStyle(os),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),rs=document.createElement("a");rs.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rs.href=tp.toDataURL("image/png"),rs.click();}finally{F.style.overflow=Qt,F.style.height=xa,F.style.width=xr,L&&(L.style.overflow=ka,L.style.height="",L.scrollTop=re,L.scrollLeft=ge),V.style.overflow=Fa,V.style.height="",V.style.width=Qo,V.scrollTop=Ne,V.scrollLeft=ft;}},[E]),Ym=react.useCallback(async()=>{await fe.exportToPDF(oe);},[oe]),qm=react.useCallback(async()=>{await fe.exportToExcel(oe);},[oe]),Xm=react.useCallback(()=>{let F=fe.exportToCSV(oe),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),Jm=react.useCallback(()=>{let F=fe.exportToJSON(oe),L=new Blob([F],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(L),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Qm=react.useCallback(()=>{fe.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Zm=F=>{F.preventDefault(),ze(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=va.current,L=Je.current?.querySelector(".gantt-grid-scroll");if(!F||!L)return;let V=()=>{if(ao.current)return;ao.current=true;let ft=F.scrollTop;xe(ft),L.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},re=()=>{if(ao.current)return;ao.current=true;let ft=L.scrollTop;xe(ft),F.scrollTop=ft,requestAnimationFrame(()=>{ao.current=false;});},ge=ft=>{if(Pe&&L){let xa=L.parentElement?.getBoundingClientRect()?.left||0,ka=ft.clientX-xa,Fa=200,xr=He+ce,Qo=window.innerWidth*Ie,Rr=Math.max(xr,Qo);ka>=Fa&&ka<=Rr&&Et(ka);}},Ne=()=>{ze(false);};return F.addEventListener("scroll",V),L.addEventListener("scroll",re),document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Ne),()=>{F.removeEventListener("scroll",V),L.removeEventListener("scroll",re),document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Ne);}},[Pe,He]),jsxRuntime.jsx(ho.Provider,{value:_,children:jsxRuntime.jsx(ds.Provider,{value:ye,children:jsxRuntime.jsxs("div",{ref:ua,className:"flex flex-col h-full w-full",style:{backgroundColor:E.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(wn,{theme:E,timeScale:Me,onTimeScaleChange:Oe,zoom:We,onZoomChange:et,currentTheme:H,onThemeChange:Ea,rowDensity:ve,onRowDensityChange:Ke,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:mt,onTaskFilterChange:O,onExportPNG:i?Km:void 0,onExportPDF:i?Ym:void 0,onExportExcel:i?qm:void 0,onExportCSV:i?Xm:void 0,onExportJSON:i?Jm:void 0,onExportMSProject:i?Qm:void 0}),jsxRuntime.jsxs("div",{ref:Je,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Dt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Dn,{tasks:ot,theme:E,rowHeight:ne,availableUsers:u,templates:q,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:R,onTaskToggle:Le,scrollTop:le,columns:Ee,onToggleColumn:Re,onColumnResize:xt,onTaskUpdate:At,onTaskIndent:st,onTaskOutdent:ga,onTaskMove:je,onMultiTaskDelete:kt,onTaskDuplicate:ia,onTaskCreate:vr,onTaskRename:Hm,onCreateSubtask:Zn,onOpenTaskModal:k?F=>k(F):void 0,onDeleteRequest:(F,L)=>Jt({taskId:F,taskName:L}),onTaskReparent:zt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:E.border,zIndex:15},onMouseDown:Zm}),jsxRuntime.jsx("div",{ref:va,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(In,{tasks:ot,theme:E,rowHeight:ne,timeScale:Me,startDate:Vm,endDate:jm,zoom:We,templates:q,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:hl,onTaskContextMenu:Gm,onTaskDateChange:Wm,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Fe.task&&jsxRuntime.jsx(yo,{isOpen:Fe.isOpen,x:Fe.x,y:Fe.y,theme:E,onClose:()=>Xt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Fe.task;if(!F)return [];let L=fe.findTaskById(oe,F.id)||F;return L.subtasks&&L.subtasks.length>0?[{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]:[{id:"edit",label:_.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{I?I(L):Nt(L);}},{id:"addSubtask",label:_.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{B?B(L):Zn(L.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:_.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{K?K(L):At(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"},{id:"setInProgress",label:_.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{te?te(L):At(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"},{id:"markComplete",label:_.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{At(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:_.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!L.startDate||!L.endDate){console.warn("Cannot split task without dates");return}let re=L.startDate.getTime(),ge=L.endDate.getTime(),Ne=re+(ge-re)/2,ft=new Date(Ne);_m(L,ft);},disabled:!L.startDate||!L.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:_.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{Jt({taskId:L.id,taskName:L.name});}}]})()}),jsxRuntime.jsx(_r,{task:Ot,isOpen:!!Ot,onClose:()=>Nt(null),onTaskUpdate:F=>{Ot&&(At(Ot.id,F),Nt(null));},theme:H==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Jt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:F=>F.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:E.bgSecondary,border:`1px solid ${E.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${E.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:E.textPrimary,fontFamily:"Inter, sans-serif"},children:[_.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:T==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},children:[T==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:E.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:E.bgPrimary,borderTop:`1px solid ${E.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Jt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:E.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=E.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{kt([ct.taskId]),Jt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),T==="es"?"Eliminar":"Delete"]})]})]})})}),C?.enabled&&jsxRuntime.jsx(Bn,{tasks:oe,theme:E,config:C,onTasksUpdate:ue,onTaskUpdate:At,onTaskCreate:F=>{ue(L=>[...L,F]);},onTaskDelete:F=>{kt([F]);},onDependencyCreate:(F,L)=>{let V=fe.findTaskById(oe,F);V&&yl(V,L);},onDependencyDelete:vl})]})})})});var ki=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],wi=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Nc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(O=>!ki.some(le=>le.id===O.id))],c=Ye[m]||Ye.dark,[b,y]=react.useState(false),[l,x]=react.useState(false),[v,S]=react.useState(false),[k,w]=react.useState(false),[R,M]=react.useState({top:0,left:0}),[D,I]=react.useState(null),[B,K]=react.useState(new Date),[te,ie]=react.useState({top:0,left:0}),[de,be]=react.useState(false),[$,J]=react.useState([]),U=react.useRef(null),G=react.useRef(null),A=react.useRef(null),Q=react.useRef(null),X=react.useRef(null),[H,Ce]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,Oe]=react.useState({});react.useEffect(()=>{a?(Ce({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&be(true)):(Ce({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),be(false),J([]));},[a,e]),react.useEffect(()=>{let O=le=>{U.current&&!U.current.contains(le.target)&&y(false),G.current&&!G.current.contains(le.target)&&x(false),A.current&&!A.current.contains(le.target)&&S(false),Q.current&&!Q.current.contains(le.target)&&w(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let ve=()=>{let O={};return H.name.trim()||(O.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Oe(O),Object.keys(O).length===0},Ke=async O=>{if(O.preventDefault(),!!ve())try{let le=p==="create"&&$.length>0?{...H,pendingFiles:$}:H;await s(le),J([]),t();}catch(le){console.error("Error submitting task:",le);}},We=(O,le)=>{Ce(xe=>{let Pe={...xe,[O]:le};if(O==="status"){let ze=le;ze==="todo"?Pe.progress=0:ze==="in-progress"?(xe.progress===0||xe.progress===100)&&(Pe.progress=50):ze==="completed"||ze==="closed"?Pe.progress=100:(ze==="in-review"||ze==="review")&&(Pe.progress=75);}if(O==="progress"){let ze=typeof le=="number"?le:parseInt(le,10);ze===100&&xe.status!=="completed"?Pe.status="completed":ze>0&&ze<100&&xe.status==="todo"?Pe.status="in-progress":ze===0&&xe.status!=="todo"&&(Pe.status="todo");}return Pe}),Me[O]&&Oe(xe=>{let Pe={...xe};return delete Pe[O],Pe});},et=T.find(O=>O.id===H.status)??ki[0],vt=wi.find(O=>O.id===H.priority)??wi[1],Mt=sr.find(O=>O.value===H.color)??sr[0],mt={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:et.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=c.hoverBg,O.currentTarget.style.color=c.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Ke,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:H.name,onChange:O=>We("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:H.description||"",onChange:O=>We("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:U,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&y(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...mt,borderColor:et.color,backgroundColor:`${et.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:et.color}}),jsxRuntime.jsx("span",{style:{color:et.color},children:et.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:et.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:T.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("status",O.id),y(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,H.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&x(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsxRuntime.jsx("span",{children:vt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:wi.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,H.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:A,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&S(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[H.assignees&&H.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((O,le)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||c.accent,borderColor:c.bgSecondary},children:O.initials},le))}),H.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",H.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(O=>{let le=H.assignees?.some(xe=>xe.name===O.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=le?(H.assignees||[]).filter(Pe=>Pe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Pe=>Pe[0]).join("").toUpperCase().slice(0,2),color:c.accent}];We("assignees",xe);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:c.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:le&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:Q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(k)w(false);else {if(Q.current){let O=Q.current.getBoundingClientRect(),le=window.innerHeight,xe=120,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;M({top:ze,left:O.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:mt,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsxRuntime.jsx("span",{children:Mt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:sr.slice(0,18).map(O=>{let le=H.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),We("color",O.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:le?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:H.tags||[],availableTags:u,onChange:O=>We("tags",O),onCreateTag:d,theme:c,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{ref:X,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="start")I(null);else {if(X.current){let O=X.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("start"),K(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!H.isMilestone)if(D==="end")I(null);else {if(X.current){let O=X.current.getBoundingClientRect(),le=window.innerHeight,xe=320,ze=le-O.bottom<xe?O.top-xe-8:O.bottom+8;ie({top:ze,left:O.left});}I("end"),K(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...mt,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:n||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsxs(lt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>I(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let O=new Date,le=new Date(O);le.setDate(O.getDate()+1);let xe=new Date(O);xe.setDate(O.getDate()+7);let Pe=new Date(O);return Pe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:le},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:Pe}].map((at,Et)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Fe=>Fe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Fe=>Fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{D==="start"?(We("startDate",at.date),(!H.endDate||at.date>H.endDate)&&We("endDate",at.date),I("end")):(We("endDate",at.date),(!H.startDate||at.date<H.startDate)&&We("startDate",at.date),I(null));},children:at.label},Et))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${c.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{We("startDate",void 0),We("endDate",void 0),I(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>K(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,le)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:O},le))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=B.getFullYear(),le=B.getMonth(),xe=new Date(O,le,1).getDay(),Pe=new Date(O,le+1,0).getDate(),ze=new Date,at=[];for(let Fe=xe-1;Fe>=0;Fe--)at.push({day:new Date(O,le,-Fe).getDate(),date:new Date(O,le-1,new Date(O,le,-Fe).getDate()),isCurrentMonth:false});for(let Fe=1;Fe<=Pe;Fe++)at.push({day:Fe,date:new Date(O,le,Fe),isCurrentMonth:true});let Et=42-at.length;for(let Fe=1;Fe<=Et;Fe++)at.push({day:Fe,date:new Date(O,le+1,Fe),isCurrentMonth:false});return at.map((Fe,Xt)=>{let Ot=Fe.date.toDateString()===ze.toDateString(),Nt=H.startDate?.toDateString()===Fe.date.toDateString(),ct=H.endDate?.toDateString()===Fe.date.toDateString(),Jt=H.startDate&&H.endDate&&Fe.date>=H.startDate&&Fe.date<=H.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Fe.isCurrentMonth?Nt||ct?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:Nt?"#3B82F6":ct?"#7C3AED":Jt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ot&&!Nt&&!ct?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{D==="start"?(We("startDate",Fe.date),H.endDate&&Fe.date>H.endDate&&We("endDate",Fe.date),I("end")):(We("endDate",Fe.date),H.startDate&&Fe.date<H.startDate&&We("startDate",Fe.date),I(null));},children:Fe.day},Xt)})})()})]})]})]})})]}),Me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:H.progress,onChange:O=>We("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>be(!de),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${de?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[(h||g.length>0||p==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:c.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:c.textTertiary},children:["Adjuntos ",p==="create"?$.length>0&&`(${$.length})`:g.length>0&&`(${g.length})`]})]}),p==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:$.map((O,le)=>({id:`pending-${le}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>J(le=>[...le,...O]),onDelete:O=>{let le=parseInt(O.replace("pending-",""),10);J(xe=>xe.filter((Pe,ze)=>ze!==le));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?O=>h(a.id,O):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),p==="create"&&$.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:H.isMilestone,onChange:O=>We("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let le=H.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let xe=le?(H.dependencies||[]).filter(Pe=>Pe!==O.id):[...H.dependencies||[],O.id];We("dependencies",xe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:le?`${c.accent}30`:c.bgPrimary,color:le?c.accent:c.textSecondary,border:`1px solid ${le?c.accent:c.borderLight}`},disabled:n,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="1"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Dc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
345
345
|
|