@libxai/board 0.17.342 → 0.17.343

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 CHANGED
@@ -108,7 +108,7 @@
108
108
  1.
109
109
 
110
110
  **Action items:**
111
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function _s({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 m=i=>{t(i),o(false);},p=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(p).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:()=>m(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 js({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[p,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,p,T);El(c,p);},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:()=>m("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:()=>m("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",p===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 Ug=["URGENT","HIGH","MEDIUM","LOW"],Hg=[{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"}],Wg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ks({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(E=>{a({search:E.target.value});},[a]),y=react.useCallback(E=>{a({dateFilter:E.target.value});},[a]),l=react.useCallback(E=>{r({by:E.target.value});},[r]),k=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:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.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"}),m&&jsxRuntime.jsx("button",{onClick:m,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:E=>{let w=E.target.value;a({priorities:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ug.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let w=E.target.value;a({assignees:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let w=E.target.value;a({labels:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),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:Hg.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,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:E=>C(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wg.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:p}){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 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("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(()=>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("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 qs={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"}},Xs={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"}},Js={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"}},jr={dark:qs,light:Xs,neutral:Js},bn="dark";var yn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=bn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=jr[r];Object.entries(p.colors).forEach(([u,d])=>{d&&m.style.setProperty(`--theme-${Qg(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=p.colors[u];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:jr};return jsxRuntime.jsx(yn.Provider,{value:n,children:e})}function go(){let e=react.useContext(yn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Qg(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(jr).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 Je[e]||Je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Je[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Je[e].bgSecondary),bgGrid:r("--theme-bg-card",Je[e].bgGrid),bgWeekend:r("--theme-bg-hover",Je[e].bgWeekend),border:r("--theme-border-primary",Je[e].border),borderLight:r("--theme-border-subtle",Je[e].borderLight),textPrimary:r("--theme-text-primary",Je[e].textPrimary),textSecondary:r("--theme-text-secondary",Je[e].textSecondary),textTertiary:r("--theme-text-tertiary",Je[e].textTertiary),accent:r("--theme-accent-primary",Je[e].accent),accentHover:r("--theme-accent-hover",Je[e].accentHover),accentLight:r("--theme-accent-primary",Je[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Je[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Je[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Je[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Je[e].dependency),dependencyHover:r("--theme-border-secondary",Je[e].dependencyHover),criticalPath:r("--theme-error",Je[e].criticalPath),criticalPathLight:r("--theme-error",Je[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Je[e].today):e==="neutral"?r("--theme-text-primary",Je[e].today):r("--theme-error",Je[e].today),todayLight:e==="light"?r("--theme-accent-primary",Je[e].todayLight):e==="neutral"?r("--theme-text-primary",Je[e].todayLight):r("--theme-error",Je[e].todayLight),milestone:r("--theme-warning",Je[e].milestone),milestoneLight:r("--theme-warning",Je[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Je[e].statusTodo),statusInProgress:r("--theme-accent-primary",Je[e].statusInProgress),statusCompleted:r("--theme-success",Je[e].statusCompleted),hoverBg:r("--theme-bg-hover",Je[e].hoverBg),focusRing:r("--theme-accent-primary",Je[e].focusRing)}}var vn={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"}},Qs={en:vn,es:Hd};function Wd(e){return Qs[e]||Qs.en}function ei(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(vn);function bo(){return react.useContext(ho)}function hf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,p]=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)&&p(false);};return m&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[m]),!(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),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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 bf({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 yf({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 vf({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 m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],p=m.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"}: ${p}`,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:m.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<m.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 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 m=[{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"}],p=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:p||r?e.accentLight:e.bgSecondary,border:`1px solid ${p||r?e.accent:e.borderLight}`,color:p||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"}),p&&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:m.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)})}),p&&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 kn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:p,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:k}){let v=bo(),E=T||c||b||y||l||k,w=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],x=[{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(yf,{options:w,value:t,onChange:B=>a(B),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(vf,{theme:e,value:m,onChange:p}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{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})]}),(E||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:k}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(bf,{options:x,value:s,onChange:B=>n(B),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{m.current&&!m.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:p,onClick:()=>{if(!r&&p.current){let u=p.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(ft,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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),[m,p]=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)),p({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:`${m.x}px`,top:`${m.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 Ut={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 Qd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:p,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 k=[],v=E=>{for(let w of E)k.push(w),w.subtasks&&w.subtasks.length>0&&w.isExpanded&&v(w.subtasks);};return v(l),k},[]),c=react.useCallback(()=>{let l=T(e);for(let k of l)if(t.has(k.id))return k;return null},[e,t,T]),b=react.useCallback((l,k)=>{let v=T(e);if(v.length===0)return;let E=c();if(!E){a(v[0].id,false);return}let w=v.findIndex(A=>A.id===E.id);if(w===-1)return;let x=l==="up"?w-1:w+1;if(x<0||x>=v.length)return;let B=v[x];a(B.id,k);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let k=l.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||h.current){l.key==="Escape"&&(k.blur(),h.current=false);return}let w=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,x=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){x.length>0&&(l.preventDefault(),n(x,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){x.length>0&&(l.preventDefault(),m(x));return}if(l.key==="Tab"&&l.shiftKey){x.length>0&&(l.preventDefault(),p(x));return}if(l.key==="Enter"&&!l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&w){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&w){x.length>0&&(l.preventDefault(),o(x));return}if(l.key==="d"&&w&&!l.shiftKey){x.length>0&&(l.preventDefault(),s(x));return}},[g,t,c,b,r,o,s,n,m,p,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]),m=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),p=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:m,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.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 si(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=si(a.subtasks,t);if(r)return r}return null}function ii(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}},m=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:m(C.subtasks,g,h)}:C),p=new Set(t),{tasks:i,removed:u}=n(e,p);return m(i,s.id,u)}function li(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=si(a,r);if(!o)continue;let s=si(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},m=(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&&m(h.subtasks,u,d);return i},p=n(a,o.id,r);p&&(s&&s.subtasks?m(s.subtasks,o.id,p):m(a,o.id,p));}return a}function di(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,p)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,p))return true;return false}let u=p==="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 ci(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 m=n.findIndex(u=>u.id===r);if(m===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let p=n[m],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.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"},m=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&m(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,n),true};return m(r),{tasks:r,newTask:n}}function mi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:mi(r.subtasks,t,a)}:r)}function ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ui(a.subtasks,t)}:a)}function gi(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,m=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let m=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||m(u,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.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:m(i.subtasks)}:i});n=m(n);}return n}function Nn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:k,onCreateSubtask:v,onOpenTaskModal:E,onDeleteRequest:w,onTaskReparent:x}){let B=react.useContext(ho),[A,N]=react.useState(null),[U,$]=react.useState(null),[_,Q]=react.useState(""),Te=react.useRef(null),[Oe,et]=react.useState(null),[$e,Be]=react.useState(0),[L,R]=react.useState(0),[D,G]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Y,O]=react.useState(null),[ne,ye]=react.useState(null),[Se,fe]=react.useState(null),He=react.useRef(0),Me=5,Le=react.useRef(false),[tt,st]=react.useState(null),[Ye,z]=react.useState(false),[oe,ie]=react.useState(null),[ke,Re]=react.useState(false),je=react.useRef(null);react.useEffect(()=>{function V(te){je.current&&!je.current.contains(te.target)&&Re(false);}if(ke)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[ke]),react.useEffect(()=>{U&&Te.current&&(Te.current.focus(),Te.current.select());},[U]),react.useEffect(()=>{if(!Oe)return;let V=De=>{let Xe=De.clientX-$e,Ge=L+Xe;g?.(Oe,Ge);},te=()=>{et(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",te),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",te),document.body.style.cursor="",document.body.style.userSelect="";}},[Oe,$e,L,g]);let{selectedTaskIds:bt,handleTaskClick:Ee,isTaskSelected:vt}=tc(),{setIsEditing:gt}=Qd({tasks:e,selectedTaskIds:bt,onTaskSelect:(V,te)=>{let Xe=vo(e).map(Ge=>Ge.id);Ee(V,Xe,te||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:V=>{let te=vo(e).find(De=>De.id===V);te&&se(te);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:V=>{let te=vo(e).find(De=>De.id===V);te&&E&&E(te);},enableKeyboard:true}),wt=(V,te=0)=>{let De=[];for(let Xe of V)De.push({task:Xe,level:te}),Xe.subtasks&&Xe.subtasks.length>0&&Xe.isExpanded&&De.push(...wt(Xe.subtasks,te+1));return De},it=wt(e),Jt=48,Lt=Math.max(it.length*a,600-Jt),ee=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,se=V=>{$(V.id),Q(V.name),gt(true);},ra=V=>{_.trim()&&_!==e.find(te=>te.id===V)?.name&&k?.(V,_.trim()),$(null),Q(""),gt(false);},de=()=>{$(null),Q(""),gt(false);},S=(V,te)=>{te.stopPropagation(),v?.(V.id);},X=(V,te)=>{te.preventDefault(),He.current=te.clientY,O(V),Le.current=false,z(false),st({x:te.clientX,y:te.clientY});},he=V=>{if(!Y||(Math.abs(V.clientY-He.current)>Me&&!Le.current&&(Le.current=true,z(true)),st({x:V.clientX,y:V.clientY}),!Le.current))return;let De=document.querySelectorAll("[data-task-row]"),Xe=null,Ge=null;De.forEach(W=>{let le=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==Y&&V.clientY>=le.top&&V.clientY<=le.bottom){Xe=Ie;let At=V.clientY-le.top,at=le.height;At<at*.25?Ge="above":At>at*.75?Ge="below":Ge="child";}}),ye(Xe),fe(Ge);},Ae=()=>{if(Le.current&&Y&&ne&&Se){if(Se==="child")x?.(Y,ne);else if(Se==="above"||Se==="below"){let V=(Xe,Ge,W=null)=>{for(let le of Xe){if(le.id===Ge)return W;if(le.subtasks){let Ie=V(le.subtasks,Ge,le.id);if(Ie!==void 0)return Ie}}},te=V(e,ne,null),De=(Xe,Ge)=>{let W=Xe.findIndex(le=>le.id===Ge);return Se==="below"?W+1:W};if(te===null){let Xe=De(e,ne);x?.(Y,null,Xe);}else {let Xe=it.find(Ge=>Ge.task.id===te)?.task;if(Xe?.subtasks){let Ge=De(Xe.subtasks,ne);x?.(Y,te,Ge);}}}}O(null),ye(null),fe(null),st(null),Le.current=false,z(false);};react.useEffect(()=>{if(Y)return document.addEventListener("mousemove",he),document.addEventListener("mouseup",Ae),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Ae),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,ne,Se]);let We=(V,te,De)=>{switch(V.id){case "name":let Xe=U===te.id,Ge=A===te.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${De*20}px`},children:[x&&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:Ge?1:.3},onMouseDown:J=>X(te.id,J),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),te.subtasks&&te.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),p?.(te.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:te.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:te.color||"#3B82F6",opacity:te.parentId?.6:1,borderColor:te.isMilestone?t.accent:"transparent",borderWidth:te.isMilestone?"2px":"0px"},title:te.isMilestone?"Milestone":te.parentId?"Subtask":"Task"})}),Xe?jsxRuntime.jsx("input",{ref:Te,type:"text",value:_,onChange:J=>Q(J.target.value),onKeyDown:J=>{J.key==="Enter"?ra(te.id):J.key==="Escape"&&de();},onBlur:()=>ra(te.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:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:te.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:te.parentId?"13px":"14px",fontWeight:te.isMilestone?600:te.parentId?400:600,letterSpacing:te.parentId?"0":"-0.01em"},title:te.name,children:te.name}),Ge&&!Xe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>S(te,J),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:J=>{J.stopPropagation(),se(te);},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 le=V.id==="startDate"?"startDate":"endDate",Ie=te[le],At=oe?.taskId===te.id&&oe?.field===le,at=J=>J?(typeof J=="string"?new Date(J):J).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:J=>J.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:J=>{if(At)ie(null);else {let Pe=J.currentTarget.getBoundingClientRect();ie({taskId:te.id,field:le,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Pe.bottom+4,left:Pe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:at(Ie)})]}),At&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:oe?.position.top,left:oe?.position.left},onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let J=new Date,Pe=new Date(J);Pe.setDate(J.getDate()+1);let lt=new Date(J);lt.setDate(J.getDate()+7);let re=new Date(J);return re.setDate(J.getDate()+14),[{label:"Hoy",date:J},{label:"Ma\xF1ana",date:Pe},{label:"Pr\xF3xima semana",date:lt},{label:"2 semanas",date:re}].map((St,Fe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Bt=>Bt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Bt=>Bt.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(te.id,{[le]:St.date}),ie(null);},children:St.label},Fe))})(),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:J=>J.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(te.id,{[le]:void 0}),ie(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:()=>ie(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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:oe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ie(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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((J,Pe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:J},Pe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=oe?.month||new Date,Pe=J.getFullYear(),lt=J.getMonth(),re=new Date(Pe,lt,1).getDay(),Ue=new Date(Pe,lt+1,0).getDate(),St=new Date,Fe=[];for(let mt=re-1;mt>=0;mt--)Fe.push({day:new Date(Pe,lt,-mt).getDate(),date:new Date(Pe,lt-1,new Date(Pe,lt,-mt).getDate()),isCurrentMonth:false});for(let mt=1;mt<=Ue;mt++)Fe.push({day:mt,date:new Date(Pe,lt,mt),isCurrentMonth:true});let Bt=42-Fe.length;for(let mt=1;mt<=Bt;mt++)Fe.push({day:mt,date:new Date(Pe,lt+1,mt),isCurrentMonth:false});return Fe.map((mt,ha)=>{let Wt=mt.date.toDateString()===St.toDateString(),Et=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===mt.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:mt.isCurrentMonth?Et?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Et?"#3B82F6":"transparent",boxShadow:Wt&&!Et?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(te.id,{[le]:mt.date}),ie(null);},children:mt.day},ha)})})()})]})]})]}),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:ee(te)})});case "assignees":let xa=r.filter(J=>te.assignees?.some(Pe=>Pe.name===J.name||Pe.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:xa,availableUsers:r,onChange:J=>{let Pe=J.map(lt=>({id:lt.id,name:lt.name,initials:lt.initials,color:lt.color}));h?.(te.id,{assignees:Pe.length>0?Pe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:te.status||"todo",onChange:J=>{h?.(te.id,{status:J,progress:J==="completed"?100:te.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:`${te.progress}%`,backgroundColor:te.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:[te.progress,"%"]})]});case "priority":let fa={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},P={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=fa[te.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx($r,{priority:be,onChange:J=>{J&&h?.(te.id,{priority:P[J]||"medium"});}})});default:return null}},qe=V=>[{id:"hide",label:"Hide Column",icon:Ut.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ut.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ut.SortDesc,onClick:()=>{}}],ze=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{v?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{w?w(V.id,V.name):b?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{v?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{h?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{h?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{h?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{w?w(V.id,V.name):b?.([V.id]);}}],nt=u.filter(V=>V.visible),pt=nt.reduce((V,te)=>V+te.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:pt},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:nt.map((V,te)=>{let De=te===nt.length-1,Xe=V.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Xe?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Xe?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:De?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ge=>{Ge.preventDefault(),G({isOpen:true,x:Ge.clientX,y:Ge.clientY,type:"header",columnId:V.id});},onMouseEnter:Ge=>{Ge.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ge=>{Ge.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:V.label,children:V.label}),V.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Oe===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),et(V.id),Be(Ge.clientX),R(V.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"}})})]},V.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(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Re(!ke),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"})}),ke&&jsxRuntime.jsxs("div",{ref:je,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:V=>V.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:()=>Re(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:Lt},children:it.map(({task:V,level:te},De)=>{let Xe=vt(V.id),Ge=ne===V.id,W=Ge&&Se==="above",le=Ge&&Se==="below",Ie=Ge&&Se==="child",At={};return Ie&&(At.backgroundColor=`${t.accent}15`,At.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${Y===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Xe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Xe?t.accentLight:Ie?`${t.accent}15`:De%2===0?t.bgPrimary:t.bgGrid,...At},onMouseEnter:()=>N(V.id),onMouseLeave:()=>N(null),onClick:at=>{let fa=vo(e).map(J=>J.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?at.metaKey:at.ctrlKey;Ee(V.id,fa,be,at.shiftKey),s?.(V);},onDoubleClick:at=>{at.stopPropagation(),n?.(V);},onContextMenu:at=>{at.preventDefault(),G({isOpen:true,x:at.clientX,y:at.clientY,type:"task",task:V}),m?.(V,at);},whileHover:{backgroundColor:Xe?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}}),le&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),nt.map((at,xa)=>{let fa=xa===nt.length-1,P=at.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${at.width}px`,minWidth:`${at.minWidth??(P?200:60)}px`,maxWidth:`${at.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fa?"none":`1px solid ${A===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:We(at,V,P?te:0)},`${V.id}-${at.id}`)})]},V.id)})}),jsxRuntime.jsx(yo,{isOpen:D.isOpen,x:D.x,y:D.y,items:D.type==="header"&&D.columnId?qe(D.columnId):D.type==="task"&&D.task?ze(D.task):[],onClose:()=>G({...D,isOpen:false}),theme:t}),Ye&&tt&&Y&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:tt.x+12,top:tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=it.find(te=>te.task.id===Y)?.task;return V?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:V.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[p,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),[k,v]=react.useState(0),[E,w]=react.useState(null),[x,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:k,setSegmentDragOffsetX:v,hoveredSegmentIndex:E,setHoveredSegmentIndex:w,isHovered:x,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(_,Q)=>{r("none"),d(null),h(null),m(_),i(Q),v(0),b(null),l(0);}}}function Dn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:p,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:k,setDragOffset:v,ghostX:E,setGhostX:w,ghostWidth:x,setGhostWidth:B,connectionLine:A,setConnectionLine:N,hoveredTaskId:U,setHoveredTaskId:$,activeZone:_,setActiveZone:Q,draggedSegmentIndex:Te,setDraggedSegmentIndex:Oe,draggedSegmentStartX:et,setDraggedSegmentStartX:$e,segmentDragOffsetX:Be,setSegmentDragOffsetX:L,hoveredSegmentIndex:R,setHoveredSegmentIndex:D,isHovered:G,setIsHovered:Y,isDragging:O,isResizing:ne,isConnecting:ye,resetDragState:Se}=c,fe=32,He=8,Me=e.endDate&&e.endDate<new Date&&e.progress<100,Le=e.isCriticalPath,tt=o.name==="neutral"||o.today==="#1C1917",st=e.status==="completed"||e.progress===100,Ye={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},oe=e.isCriticalPath||Me?"#DC2626":e.color?e.color:e.priority&&Ye[e.priority]?Ye[e.priority]:o.taskBarPrimary,ke=(de=>de>=80?20:de>=60?15:de>=50?12:10)(r),Re=r<50,je=r<40;react.useEffect(()=>{if(T)if(G&&!O&&!e.segments){let de=a<100;T({task:e,x:t,y:a,width:r,height:fe,showBelow:de});}else T(null);},[G,O,e,t,a,r,fe,T]);let bt=de=>de.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ee=()=>{let de=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${de} day${de!==1?"s":""}`},vt=de=>Math.round(de/s)*s,gt=de=>{let S=Math.round(de/s),X=new Date(n);return X.setDate(X.getDate()+S),X},wt=(de,S)=>{for(let X of h){if(X.id===e.id)continue;let he=5;if(de>=X.x-he&&de<=X.x+X.width+he&&S>=X.y-he&&S<=X.y+X.height+he)return X.id}return null},it=react.useCallback((de,S,X)=>{de.preventDefault(),de.stopPropagation();let he=b.current?.ownerSVGElement;if(!he)return;let Ae=he.createSVGPoint();Ae.x=de.clientX,Ae.y=de.clientY;let We=Ae.matrixTransform(he.getScreenCTM()?.inverse()),qe=X!==void 0?X:t,ze=S;if(!ze){let nt=We.x-qe;de.shiftKey?(ze="connect",N({x:t+r,y:a+fe/2})):de.ctrlKey||de.metaKey?ze="move":de.altKey?ze=nt<r/2?"resize-start":"resize-end":je?nt<r/2?ze="move":ze="resize-end":Re?nt<=ke/2?ze="resize-start":nt>=r-ke/2?ze="resize-end":ze="move":nt<=ke?ze="resize-start":nt>=r-ke?ze="resize-end":ze="move";}l(ze),Y(false),Q(null),ze==="move"?v(We.x-qe):ze==="connect"?N({x:t+r,y:a+fe/2}):v(0),w(qe),B(r);},[t,r,a,fe]),Jt=react.useCallback(de=>{if(y==="none")return;let S=b.current?.ownerSVGElement;if(!S)return;let X=S.createSVGPoint();X.x=de.clientX,X.y=de.clientY;let he=X.matrixTransform(S.getScreenCTM()?.inverse());if(y==="connect"){N({x:he.x,y:he.y});let Ae=wt(he.x,he.y);$(Ae);}else if(y==="move"){let Ae=he.x-k,We=vt(Ae);w(We),B(r);let qe=Math.round((We-t)/s);if(C?.(e.id,qe,true),e.segments&&e.segments.length>0&&Te!==null){let ze=We-et;L(ze);}}else if(y==="resize-start"){let Ae=he.x,We=vt(Ae),qe=t+r-We;qe>=s&&(w(We),B(qe));}else if(y==="resize-end"){let Ae=he.x,qe=vt(Ae)-t;qe>=s&&B(qe);}},[y,t,r,s,k,e,vt,Te,et,wt,$,N,w,B,L,C]),Lt=react.useCallback(()=>{if(y!=="none"){if(y==="connect")U&&g&&g(e,U),N(null),$(null);else {let de=e.endDate.getTime()-e.startDate.getTime(),S,X,he=true;if(y==="move"){if(S=gt(E),X=new Date(S.getTime()+de),e.segments&&e.segments.length>0&&Te!==null){let Ae=Math.round(Be/s),We=e.segments.map((pt,V)=>{if(V===Te){let te=new Date(pt.startDate),De=new Date(pt.endDate);return te.setDate(te.getDate()+Ae),De.setDate(De.getDate()+Ae),{startDate:te,endDate:De}}return pt}),qe=We.flatMap(pt=>[pt.startDate,pt.endDate]),ze=new Date(Math.min(...qe.map(pt=>pt.getTime()))),nt=new Date(Math.max(...qe.map(pt=>pt.getTime())));d?.({...e,segments:We},ze,nt),Se(t,r);return}}else y==="resize-start"?(S=gt(E),X=e.endDate,S>X&&(console.warn("Invalid date range: start date must be before or equal to end date"),he=false)):y==="resize-end"?(S=e.startDate,X=gt(E+x),X<S&&(console.warn("Invalid date range: end date must be after or equal to start date"),he=false)):he=false;he&&S&&X&&(X.getTime()<S.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,S,X));}C?.(e.id,0,false),Se(t,r);}},[y,E,x,e,d,U,g,t,r,s,gt,Be,Te,Se,C]);react.useEffect(()=>{if(y==="none")return;let de=X=>{Jt(X);},S=()=>{Lt();};return window.addEventListener("mousemove",de),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",S);}},[y,Jt,Lt]);let ee=O&&!ye?E:t,se=O&&!ye?x:r,ra=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!O&&p?.(e),onDoubleClick:de=>{O||(de.stopPropagation(),i?.(e));},onContextMenu:de=>{de.preventDefault(),u?.(e,de);},onMouseEnter:()=>!O&&Y(true),onMouseLeave:()=>{O||(Y(false),Q(null));},children:[G&&!O&&!Re&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ke,height:fe,fill:_==="resize-start"?o.accent:"transparent",opacity:_==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-start"),onMouseDown:de=>it(de,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ke,y:a,width:r-ke*2,height:fe,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:de=>it(de,"move")}),jsxRuntime.jsx("rect",{x:t+r-ke,y:a,width:ke,height:fe,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:de=>it(de,"resize-end")})]}),G&&!O&&je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:fe,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:de=>it(de,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:fe,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:de=>it(de,"resize-end")}),G&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+fe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),O&&!ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:x,height:fe,rx:He,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:ee,y:a,width:se,height:fe,rx:He,fill:oe,"data-task-class":ra,initial:{opacity:0,scale:.95},animate:{opacity:O&&!ye?.15:e.parentId?.6:G?.9:.8,scale:G&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>it(de),style:{cursor:O?ye?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se*(e.progress/100),height:fe,rx:He,fill:oe,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((de,S)=>{let X=(de.startDate.getTime()-n.getTime())/864e5*s,Ae=(de.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-X+s,We=O&&y==="move"&&Te===S,qe=R===S,ze=We?X+Be:X;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!O&&D(S),onMouseLeave:()=>!O&&D(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Ae,height:fe,rx:He,fill:oe,initial:{opacity:0,scale:.95},animate:{opacity:We||e.parentId?.6:qe?.9:.8,scale:qe&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:nt=>{nt.stopPropagation(),Oe(S),$e(X),it(nt,void 0,X);},style:{cursor:O?ye?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ze,y:a,width:Ae*(e.progress/100),height:fe,rx:He,fill:oe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${S}`)}),tt&&(Me||Le)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Le&&!Me&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se,height:fe,rx:He,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se,height:fe,rx:He,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),se>60&&!e.segments&&(()=>{let de=m.taskLabel(e),S=typeof de=="string"?de:e.name,X=S.length>Math.floor(se/8)?`${S.substring(0,Math.floor(se/8))}...`:S;return jsxRuntime.jsx("text",{x:ee+12,y:a+fe/2,dominantBaseline:"middle",fill:st?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:st?"line-through":"none"},children:X})})(),se>100&&e.progress>0&&e.progress<100&&!O&&!e.segments&&jsxRuntime.jsxs("text",{x:ee+se-12,y:a+fe/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&&se>80&&!O&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ee+se-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ee+se-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(G||ne)&&!ye&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:ee-2,y:a,width:16,height:fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Q("resize-start"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ee+4,y:a+8,width:3,height:fe-16,rx:1.5,fill:_==="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:ee+se-14,y:a,width:16,height:fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Q("resize-end"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ee+se-7,y:a+8,width:3,height:fe-16,rx:1.5,fill:_==="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:G&&!O&&!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+18,cy:a+fe/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Q("connect"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+fe/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+fe/2,dominantBaseline:"middle",fill:_==="connect"?o.accent:o.textTertiary,fontSize:_==="connect"?"11":"10",fontWeight:_==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ye&&A&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+fe/2,x2:A.x,y2:A.y,stroke:U?o.statusCompleted:o.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:A.x,cy:A.y,r:U?8:6,fill:U?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:A.x+15,y:A.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:A.x+10},animate:{opacity:1,x:A.x+15},transition:{duration:.2},children:"Connect"})]}),(G||O)&&!ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee-2,y:a-2,width:se+4,height:fe+4,rx:He+2,fill:"none",stroke:O?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:O?.6:.4,initial:{opacity:0},animate:{opacity:O?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:E+x,y1:0,x2:E+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&!O&&!e.segments&&!T&&(()=>{let X=a<100,he=X?a+fe+13:a-82-13,Ae=X?`M ${ee+se/2-6} ${a+fe+3} L ${ee+se/2} ${a+fe+13} L ${ee+se/2+6} ${a+fe+3}`:`M ${ee+se/2-6} ${a-13} L ${ee+se/2} ${a-3} L ${ee+se/2+6} ${a-13}`,We=he+22,qe=he+40,ze=he+55,nt=he+70,pt=X?he+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:X?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:X?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ae,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ee+se/2-120,y:he,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:ee+se/2,y:We,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:ee+se/2-110,y:qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ee+se/2-70,y:qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:bt(e.startDate)}),jsxRuntime.jsx("text",{x:ee+se/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ee+se/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:bt(e.endDate)}),jsxRuntime.jsx("text",{x:ee+se/2+10,y:qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ee+se/2+65,y:qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ee()}),jsxRuntime.jsx("text",{x:ee+se/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ee+se/2+65,y:ze,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:ee+se/2-110,y:nt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ee+se/2-50,y:nt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(V=>V.name).join(", ").substring(0,30),e.assignees.map(V=>V.name).join(", ").length>30?"...":""]})]}),!X&&jsxRuntime.jsx("text",{x:ee+se/2,y:pt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:je?"Left: move \u2022 Right: resize":Re?"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 mc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,p=82,i=13,u=m?o+n+i:o-p-i,d=m?`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=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-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:p,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(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Pn({x1:e,y1:t,x2:a,y2:r,routeY:o,fromIndex:s,toIndex:n,rowHeight:m,theme:p,onDelete:i,onHoverChange:u,lineStyle:d="curved"}){let[g,h]=react.useState(false),C=a-e,T=r-t,c=e+C/2,b=s!==void 0&&n!==void 0&&s===n,y=o??Math.max(t,r)+24,l=10,k;b||Math.abs(T)<5?d==="squared"?k=`M ${e} ${t} L ${a} ${r}`:k=`M ${e} ${t} C ${c} ${t}, ${c} ${r}, ${a} ${r}`:d==="squared"?k=`M ${e} ${t} L ${e+l} ${t} L ${e+l} ${y} L ${a-l} ${y} L ${a-l} ${r} L ${a} ${r}`:k=`M ${e} ${t} C ${e+l*2} ${t}, ${e+l*2} ${y}, ${c} ${y} S ${a-l*2} ${r}, ${a} ${r}`;let v=5,E=a-v,w=r-v*.5,x=a-v,B=r+v*.5,A=p.dependency;react.useEffect(()=>{u&&i&&u(g?{x1:e,y1:t,x2:a,y2:r,routeY:y,onDelete:i,lineStyle:d}:null);},[g,e,t,a,r,y,i,u,d]);let N=!i&&!u;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!N&&h(true),onMouseLeave:()=>!N&&h(false),style:{pointerEvents:N?"none":"auto"},children:[!N&&jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:A,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:g&&u?0:g?1:.8,strokeWidth:g?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${E} ${w} M ${a} ${r} L ${x} ${B}`,fill:"none",stroke:A,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:g&&u?0:g?1:.8,scale:g?1.1:1,strokeWidth:g?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:A,initial:{scale:0},animate:{scale:g&&u?0:g?1.3:1,opacity:g&&u?0:g?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),g&&i&&!u&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:U=>{U.stopPropagation(),i();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:p.bgSecondary,stroke:p.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:p.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:p.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function An({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,p=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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:p(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 ue={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,m=new Set,p=i=>{if(!n.has(i)){n.add(i),m.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&p(d))return true;if(m.has(d))return true}}return m.delete(i),false};return p(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=ue.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ue.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ue.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=ue.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 _s({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 m=i=>{t(i),o(false);},p=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(p).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:()=>m(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 js({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,m]=react.useState("export"),[p,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,p,T);El(c,p);},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:()=>m("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:()=>m("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",p===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 Ug=["URGENT","HIGH","MEDIUM","LOW"],Hg=[{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"}],Wg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ks({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:m,availableUsers:p=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:g=false,groupBy:h="none",onGroupByChange:C}){let[T,c]=react.useState(true),b=react.useCallback(E=>{a({search:E.target.value});},[a]),y=react.useCallback(E=>{a({dateFilter:E.target.value});},[a]),l=react.useCallback(E=>{r({by:E.target.value});},[r]),k=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:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.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"}),m&&jsxRuntime.jsx("button",{onClick:m,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:E=>{let w=E.target.value;a({priorities:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ug.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let w=E.target.value;a({assignees:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(E=>jsxRuntime.jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let w=E.target.value;a({labels:w==="all"?[]:[w]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]})}),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:Hg.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:k,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:E=>C(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Wg.map(E=>jsxRuntime.jsx("option",{value:E.value,children:E.label},E.value))})}),v&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ys({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:m,onExportGanttCSV:p}){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 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("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(()=>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("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 qs={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"}},Xs={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"}},Js={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"}},jr={dark:qs,light:Xs,neutral:Js},bn="dark";var yn=react.createContext(void 0),Zg="asakaa-theme";function zd({children:e,defaultTheme:t=bn,storageKey:a=Zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),s=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=jr[r];Object.entries(p.colors).forEach(([u,d])=>{d&&m.style.setProperty(`--theme-${Qg(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=p.colors[u];g&&m.style.setProperty(d,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:jr};return jsxRuntime.jsx(yn.Provider,{value:n,children:e})}function go(){let e=react.useContext(yn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Qg(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(jr).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 Je[e]||Je.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Je[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Je[e].bgSecondary),bgGrid:r("--theme-bg-card",Je[e].bgGrid),bgWeekend:r("--theme-bg-hover",Je[e].bgWeekend),border:r("--theme-border-primary",Je[e].border),borderLight:r("--theme-border-subtle",Je[e].borderLight),textPrimary:r("--theme-text-primary",Je[e].textPrimary),textSecondary:r("--theme-text-secondary",Je[e].textSecondary),textTertiary:r("--theme-text-tertiary",Je[e].textTertiary),accent:r("--theme-accent-primary",Je[e].accent),accentHover:r("--theme-accent-hover",Je[e].accentHover),accentLight:r("--theme-accent-primary",Je[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Je[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Je[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Je[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Je[e].dependency),dependencyHover:r("--theme-border-secondary",Je[e].dependencyHover),criticalPath:r("--theme-error",Je[e].criticalPath),criticalPathLight:r("--theme-error",Je[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Je[e].today):e==="neutral"?r("--theme-text-primary",Je[e].today):r("--theme-error",Je[e].today),todayLight:e==="light"?r("--theme-accent-primary",Je[e].todayLight):e==="neutral"?r("--theme-text-primary",Je[e].todayLight):r("--theme-error",Je[e].todayLight),milestone:r("--theme-warning",Je[e].milestone),milestoneLight:r("--theme-warning",Je[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Je[e].statusTodo),statusInProgress:r("--theme-accent-primary",Je[e].statusInProgress),statusCompleted:r("--theme-success",Je[e].statusCompleted),hoverBg:r("--theme-bg-hover",Je[e].hoverBg),focusRing:r("--theme-accent-primary",Je[e].focusRing)}}var vn={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"}},Qs={en:vn,es:Hd};function Wd(e){return Qs[e]||Qs.en}function ei(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(vn);function bo(){return react.useContext(ho)}function hf({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[m,p]=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)&&p(false);};return m&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[m]),!(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),p(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#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:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&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 bf({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 yf({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 vf({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 m=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],p=m.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"}: ${p}`,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:m.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<m.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 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 m=[{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"}],p=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:p||r?e.accentLight:e.bgSecondary,border:`1px solid ${p||r?e.accent:e.borderLight}`,color:p||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"}),p&&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:m.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)})}),p&&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 kn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:m,onRowDensityChange:p,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:k}){let v=bo(),E=T||c||b||y||l||k,w=[{value:"day",label:v.toolbar.day},{value:"week",label:v.toolbar.week},{value:"month",label:v.toolbar.month}],x=[{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(yf,{options:w,value:t,onChange:B=>a(B),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(vf,{theme:e,value:m,onChange:p}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(xf,{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})]}),(E||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),E&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hf,{theme:e,onExportPNG:T,onExportPDF:c,onExportExcel:b,onExportCSV:y,onExportJSON:l,onExportMSProject:k}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(bf,{options:x,value:s,onChange:B=>n(B),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=d=>{m.current&&!m.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:p,onClick:()=>{if(!r&&p.current){let u=p.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(ft,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,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),[m,p]=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)),p({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:`${m.x}px`,top:`${m.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 Ut={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 Qd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:m,onTaskOutdent:p,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 k=[],v=E=>{for(let w of E)k.push(w),w.subtasks&&w.subtasks.length>0&&w.isExpanded&&v(w.subtasks);};return v(l),k},[]),c=react.useCallback(()=>{let l=T(e);for(let k of l)if(t.has(k.id))return k;return null},[e,t,T]),b=react.useCallback((l,k)=>{let v=T(e);if(v.length===0)return;let E=c();if(!E){a(v[0].id,false);return}let w=v.findIndex(A=>A.id===E.id);if(w===-1)return;let x=l==="up"?w-1:w+1;if(x<0||x>=v.length)return;let B=v[x];a(B.id,k);},[e,c,T,a]),y=react.useCallback(l=>{if(!g)return;let k=l.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||h.current){l.key==="Escape"&&(k.blur(),h.current=false);return}let w=navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey,x=Array.from(t),B=c();if(l.key==="ArrowUp"){l.preventDefault(),b("up",l.shiftKey);return}if(l.key==="ArrowDown"){l.preventDefault(),b("down",l.shiftKey);return}if(B&&(l.key==="ArrowRight"||l.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(l.preventDefault(),(l.key==="ArrowRight"&&!B.isExpanded||l.key==="ArrowLeft"&&B.isExpanded)&&u(B.id));return}if(l.altKey&&(l.key==="ArrowUp"||l.key==="ArrowDown")){x.length>0&&(l.preventDefault(),n(x,l.key==="ArrowUp"?"up":"down"));return}if(l.key==="Tab"&&!l.shiftKey){x.length>0&&(l.preventDefault(),m(x));return}if(l.key==="Tab"&&l.shiftKey){x.length>0&&(l.preventDefault(),p(x));return}if(l.key==="Enter"&&!l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"below"));return}if(l.key==="Enter"&&l.shiftKey&&!w){B&&(l.preventDefault(),r(B.id,"above"));return}if(l.key==="Enter"&&w){B&&(l.preventDefault(),d(B.id));return}if(l.key==="F2"){B&&(l.preventDefault(),i(B.id));return}if(l.key==="Delete"||l.key==="Backspace"&&w){x.length>0&&(l.preventDefault(),o(x));return}if(l.key==="d"&&w&&!l.shiftKey){x.length>0&&(l.preventDefault(),s(x));return}},[g,t,c,b,r,o,s,n,m,p,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]),m=react.useCallback((d,g,h,C)=>{C?n(d,g):h?s(d):o(d);},[o,s,n]),p=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:m,handleKeyboardSelection:p,clearSelection:i,isTaskSelected:u}}function vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let m={...r[n],parentId:o,level:s,position:n};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.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 si(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=si(a.subtasks,t);if(r)return r}return null}function ii(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}},m=(d,g,h)=>d.map(C=>C.id===g?{...C,subtasks:[...C.subtasks||[],...h],isExpanded:true}:C.subtasks?{...C,subtasks:m(C.subtasks,g,h)}:C),p=new Set(t),{tasks:i,removed:u}=n(e,p);return m(i,s.id,u)}function li(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=si(a,r);if(!o)continue;let s=si(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},m=(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&&m(h.subtasks,u,d);return i},p=n(a,o.id,r);p&&(s&&s.subtasks?m(s.subtasks,o.id,p):m(a,o.id,p));}return a}function di(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,m,p)=>{let i=n.findIndex(d=>d.id===m);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,m,p))return true;return false}let u=p==="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 ci(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 m=n.findIndex(u=>u.id===r);if(m===-1){for(let u of n)if(u.subtasks&&o(u.subtasks))return true;return false}let p=n[m],i={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return n.splice(m+1,0,i),true},s=n=>n.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?s(m.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"},m=p=>{let i=p.findIndex(d=>d.id===t);if(i===-1){for(let d of p)if(d.subtasks&&m(d.subtasks))return true;return false}let u=a==="above"?i:i+1;return p.splice(u,0,n),true};return m(r),{tasks:r,newTask:n}}function mi(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:mi(r.subtasks,t,a)}:r)}function ui(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ui(a.subtasks,t)}:a)}function gi(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,m=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(m),color:r?.color||"#3B82F6"},i=u=>u.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,p],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:p}}function oc(e,t,a,r){if(t===a)return e;let o=ac(e,t);if(!o)return e;if(a){let m=(p,i)=>{if(!p.subtasks)return false;for(let u of p.subtasks)if(u.id===i||m(u,i))return true;return false};if(m(o,a))return e}let s=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),n=s(e);if(a===null){let m=r!==void 0?r:n.length;n.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.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:m(i.subtasks)}:i});n=m(n);}return n}function Nn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:m,onTaskToggle:p,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:g,onTaskUpdate:h,onTaskIndent:C,onTaskOutdent:T,onTaskMove:c,onMultiTaskDelete:b,onTaskDuplicate:y,onTaskCreate:l,onTaskRename:k,onCreateSubtask:v,onOpenTaskModal:E,onDeleteRequest:w,onTaskReparent:x}){let B=react.useContext(ho),[A,N]=react.useState(null),[U,$]=react.useState(null),[_,Q]=react.useState(""),Te=react.useRef(null),[Oe,et]=react.useState(null),[$e,Be]=react.useState(0),[L,R]=react.useState(0),[D,G]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[Y,O]=react.useState(null),[ne,ye]=react.useState(null),[Se,fe]=react.useState(null),He=react.useRef(0),Me=5,Le=react.useRef(false),[tt,st]=react.useState(null),[Ye,z]=react.useState(false),[oe,ie]=react.useState(null),[ke,Re]=react.useState(false),je=react.useRef(null);react.useEffect(()=>{function V(te){je.current&&!je.current.contains(te.target)&&Re(false);}if(ke)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[ke]),react.useEffect(()=>{U&&Te.current&&(Te.current.focus(),Te.current.select());},[U]),react.useEffect(()=>{if(!Oe)return;let V=De=>{let Xe=De.clientX-$e,Ge=L+Xe;g?.(Oe,Ge);},te=()=>{et(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",te),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",te),document.body.style.cursor="",document.body.style.userSelect="";}},[Oe,$e,L,g]);let{selectedTaskIds:bt,handleTaskClick:Ee,isTaskSelected:vt}=tc(),{setIsEditing:gt}=Qd({tasks:e,selectedTaskIds:bt,onTaskSelect:(V,te)=>{let Xe=vo(e).map(Ge=>Ge.id);Ee(V,Xe,te||false,false);},onTaskCreate:l||(()=>{}),onTaskDelete:b||(()=>{}),onTaskDuplicate:y||(()=>{}),onTaskMove:c||(()=>{}),onTaskIndent:C||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:V=>{let te=vo(e).find(De=>De.id===V);te&&se(te);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:V=>{let te=vo(e).find(De=>De.id===V);te&&E&&E(te);},enableKeyboard:true}),wt=(V,te=0)=>{let De=[];for(let Xe of V)De.push({task:Xe,level:te}),Xe.subtasks&&Xe.subtasks.length>0&&Xe.isExpanded&&De.push(...wt(Xe.subtasks,te+1));return De},it=wt(e),Jt=48,Lt=Math.max(it.length*a,600-Jt),ee=V=>!V.startDate||!V.endDate?"-":`${Math.ceil((V.endDate.getTime()-V.startDate.getTime())/(1e3*60*60*24))}d`,se=V=>{$(V.id),Q(V.name),gt(true);},ra=V=>{_.trim()&&_!==e.find(te=>te.id===V)?.name&&k?.(V,_.trim()),$(null),Q(""),gt(false);},de=()=>{$(null),Q(""),gt(false);},S=(V,te)=>{te.stopPropagation(),v?.(V.id);},X=(V,te)=>{te.preventDefault(),He.current=te.clientY,O(V),Le.current=false,z(false),st({x:te.clientX,y:te.clientY});},he=V=>{if(!Y||(Math.abs(V.clientY-He.current)>Me&&!Le.current&&(Le.current=true,z(true)),st({x:V.clientX,y:V.clientY}),!Le.current))return;let De=document.querySelectorAll("[data-task-row]"),Xe=null,Ge=null;De.forEach(W=>{let le=W.getBoundingClientRect(),Ie=W.getAttribute("data-task-row");if(Ie&&Ie!==Y&&V.clientY>=le.top&&V.clientY<=le.bottom){Xe=Ie;let At=V.clientY-le.top,at=le.height;At<at*.25?Ge="above":At>at*.75?Ge="below":Ge="child";}}),ye(Xe),fe(Ge);},Ae=()=>{if(Le.current&&Y&&ne&&Se){if(Se==="child")x?.(Y,ne);else if(Se==="above"||Se==="below"){let V=(Xe,Ge,W=null)=>{for(let le of Xe){if(le.id===Ge)return W;if(le.subtasks){let Ie=V(le.subtasks,Ge,le.id);if(Ie!==void 0)return Ie}}},te=V(e,ne,null),De=(Xe,Ge)=>{let W=Xe.findIndex(le=>le.id===Ge);return Se==="below"?W+1:W};if(te===null){let Xe=De(e,ne);x?.(Y,null,Xe);}else {let Xe=it.find(Ge=>Ge.task.id===te)?.task;if(Xe?.subtasks){let Ge=De(Xe.subtasks,ne);x?.(Y,te,Ge);}}}}O(null),ye(null),fe(null),st(null),Le.current=false,z(false);};react.useEffect(()=>{if(Y)return document.addEventListener("mousemove",he),document.addEventListener("mouseup",Ae),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Ae),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,ne,Se]);let We=(V,te,De)=>{switch(V.id){case "name":let Xe=U===te.id,Ge=A===te.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${De*20}px`},children:[x&&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:Ge?1:.3},onMouseDown:J=>X(te.id,J),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),te.subtasks&&te.subtasks.length>0?jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),p?.(te.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:te.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:te.color||"#3B82F6",opacity:te.parentId?.6:1,borderColor:te.isMilestone?t.accent:"transparent",borderWidth:te.isMilestone?"2px":"0px"},title:te.isMilestone?"Milestone":te.parentId?"Subtask":"Task"})}),Xe?jsxRuntime.jsx("input",{ref:Te,type:"text",value:_,onChange:J=>Q(J.target.value),onKeyDown:J=>{J.key==="Enter"?ra(te.id):J.key==="Escape"&&de();},onBlur:()=>ra(te.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:J=>J.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:te.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:te.parentId?"13px":"14px",fontWeight:te.isMilestone?600:te.parentId?400:600,letterSpacing:te.parentId?"0":"-0.01em"},title:te.name,children:te.name}),Ge&&!Xe&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:J=>S(te,J),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:J=>{J.stopPropagation(),se(te);},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 le=V.id==="startDate"?"startDate":"endDate",Ie=te[le],At=oe?.taskId===te.id&&oe?.field===le,at=J=>J?(typeof J=="string"?new Date(J):J).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:J=>J.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:J=>{if(At)ie(null);else {let Pe=J.currentTarget.getBoundingClientRect();ie({taskId:te.id,field:le,month:Ie?typeof Ie=="string"?new Date(Ie):Ie:new Date,position:{top:Pe.bottom+4,left:Pe.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:at(Ie)})]}),At&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ie(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:oe?.position.top,left:oe?.position.left},onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let J=new Date,Pe=new Date(J);Pe.setDate(J.getDate()+1);let lt=new Date(J);lt.setDate(J.getDate()+7);let re=new Date(J);return re.setDate(J.getDate()+14),[{label:"Hoy",date:J},{label:"Ma\xF1ana",date:Pe},{label:"Pr\xF3xima semana",date:lt},{label:"2 semanas",date:re}].map((St,Fe)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Bt=>Bt.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Bt=>Bt.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(te.id,{[le]:St.date}),ie(null);},children:St.label},Fe))})(),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:J=>J.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{h?.(te.id,{[le]:void 0}),ie(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:()=>ie(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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:oe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ie(J=>J?{...J,month:new Date(J.month.getFullYear(),J.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((J,Pe)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:J},Pe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=oe?.month||new Date,Pe=J.getFullYear(),lt=J.getMonth(),re=new Date(Pe,lt,1).getDay(),Ue=new Date(Pe,lt+1,0).getDate(),St=new Date,Fe=[];for(let mt=re-1;mt>=0;mt--)Fe.push({day:new Date(Pe,lt,-mt).getDate(),date:new Date(Pe,lt-1,new Date(Pe,lt,-mt).getDate()),isCurrentMonth:false});for(let mt=1;mt<=Ue;mt++)Fe.push({day:mt,date:new Date(Pe,lt,mt),isCurrentMonth:true});let Bt=42-Fe.length;for(let mt=1;mt<=Bt;mt++)Fe.push({day:mt,date:new Date(Pe,lt+1,mt),isCurrentMonth:false});return Fe.map((mt,ha)=>{let Wt=mt.date.toDateString()===St.toDateString(),Et=(Ie?typeof Ie=="string"?new Date(Ie):Ie:null)?.toDateString()===mt.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:mt.isCurrentMonth?Et?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Et?"#3B82F6":"transparent",boxShadow:Wt&&!Et?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h?.(te.id,{[le]:mt.date}),ie(null);},children:mt.day},ha)})})()})]})]})]}),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:ee(te)})});case "assignees":let xa=r.filter(J=>te.assignees?.some(Pe=>Pe.name===J.name||Pe.initials===J.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Ur,{assignedUsers:xa,availableUsers:r,onChange:J=>{let Pe=J.map(lt=>({id:lt.id,name:lt.name,initials:lt.initials,color:lt.color}));h?.(te.id,{assignees:Pe.length>0?Pe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx(Xl,{status:te.status||"todo",onChange:J=>{h?.(te.id,{status:J,progress:J==="completed"?100:te.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:`${te.progress}%`,backgroundColor:te.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:[te.progress,"%"]})]});case "priority":let fa={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},P={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=fa[te.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:J=>J.stopPropagation(),children:jsxRuntime.jsx($r,{priority:be,onChange:J=>{J&&h?.(te.id,{priority:P[J]||"medium"});}})});default:return null}},qe=V=>[{id:"hide",label:"Hide Column",icon:Ut.Hide,onClick:()=>d(V),disabled:V==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Ut.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Ut.SortDesc,onClick:()=>{}}],ze=V=>V.subtasks&&V.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{v?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{w?w(V.id,V.name):b?.([V.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{n?.(V);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{v?.(V.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{h?.(V.id,{status:"todo",progress:0});},disabled:V.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{h?.(V.id,{status:"in-progress"});},disabled:V.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{h?.(V.id,{status:"completed",progress:100});},disabled:V.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{w?w(V.id,V.name):b?.([V.id]);}}],nt=u.filter(V=>V.visible),pt=nt.reduce((V,te)=>V+te.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:pt},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:nt.map((V,te)=>{let De=te===nt.length-1,Xe=V.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Xe?"":"justify-center"}`,style:{width:`${V.width}px`,minWidth:`${V.minWidth??(Xe?200:60)}px`,maxWidth:`${V.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:De?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ge=>{Ge.preventDefault(),G({isOpen:true,x:Ge.clientX,y:Ge.clientY,type:"header",columnId:V.id});},onMouseEnter:Ge=>{Ge.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ge=>{Ge.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:V.label,children:V.label}),V.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Oe===V.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ge=>{Ge.preventDefault(),Ge.stopPropagation(),et(V.id),Be(Ge.clientX),R(V.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"}})})]},V.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(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Re(!ke),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"})}),ke&&jsxRuntime.jsxs("div",{ref:je,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:V=>V.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:()=>Re(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:Lt},children:it.map(({task:V,level:te},De)=>{let Xe=vt(V.id),Ge=ne===V.id,W=Ge&&Se==="above",le=Ge&&Se==="below",Ie=Ge&&Se==="child",At={};return Ie&&(At.backgroundColor=`${t.accent}15`,At.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":V.id,className:`flex items-center cursor-pointer group ${Y===V.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Xe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Xe?t.accentLight:Ie?`${t.accent}15`:De%2===0?t.bgPrimary:t.bgGrid,...At},onMouseEnter:()=>N(V.id),onMouseLeave:()=>N(null),onClick:at=>{let fa=vo(e).map(J=>J.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?at.metaKey:at.ctrlKey;Ee(V.id,fa,be,at.shiftKey),s?.(V);},onDoubleClick:at=>{at.stopPropagation(),n?.(V);},onContextMenu:at=>{at.preventDefault(),G({isOpen:true,x:at.clientX,y:at.clientY,type:"task",task:V}),m?.(V,at);},whileHover:{backgroundColor:Xe?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}}),le&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),nt.map((at,xa)=>{let fa=xa===nt.length-1,P=at.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${P?"justify-start":"justify-center"}`,style:{width:`${at.width}px`,minWidth:`${at.minWidth??(P?200:60)}px`,maxWidth:`${at.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:fa?"none":`1px solid ${A===V.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:We(at,V,P?te:0)},`${V.id}-${at.id}`)})]},V.id)})}),jsxRuntime.jsx(yo,{isOpen:D.isOpen,x:D.x,y:D.y,items:D.type==="header"&&D.columnId?qe(D.columnId):D.type==="task"&&D.task?ze(D.task):[],onClose:()=>G({...D,isOpen:false}),theme:t}),Ye&&tt&&Y&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:tt.x+12,top:tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let V=it.find(te=>te.task.id===Y)?.task;return V?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:V.name})}):null})()}),document.body)]})}function dc(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,m]=react.useState(e),[p,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),[k,v]=react.useState(0),[E,w]=react.useState(null),[x,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:m,ghostWidth:p,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:h,activeZone:C,setActiveZone:T,draggedSegmentIndex:c,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:l,segmentDragOffsetX:k,setSegmentDragOffsetX:v,hoveredSegmentIndex:E,setHoveredSegmentIndex:w,isHovered:x,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(_,Q)=>{r("none"),d(null),h(null),m(_),i(Q),v(0),b(null),l(0);}}}function Dn({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:m,onClick:p,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:k,setDragOffset:v,ghostX:E,setGhostX:w,ghostWidth:x,setGhostWidth:B,connectionLine:A,setConnectionLine:N,hoveredTaskId:U,setHoveredTaskId:$,activeZone:_,setActiveZone:Q,draggedSegmentIndex:Te,setDraggedSegmentIndex:Oe,draggedSegmentStartX:et,setDraggedSegmentStartX:$e,segmentDragOffsetX:Be,setSegmentDragOffsetX:L,hoveredSegmentIndex:R,setHoveredSegmentIndex:D,isHovered:G,setIsHovered:Y,isDragging:O,isResizing:ne,isConnecting:ye,resetDragState:Se}=c,fe=32,He=8,Me=e.endDate&&e.endDate<new Date&&e.progress<100,Le=e.isCriticalPath,tt=o.name==="neutral"||o.today==="#1C1917",st=e.status==="completed"||e.progress===100,Ye={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},oe=e.isCriticalPath||Me?"#DC2626":e.color?e.color:e.priority&&Ye[e.priority]?Ye[e.priority]:o.taskBarPrimary,ke=(de=>de>=80?20:de>=60?15:de>=50?12:10)(r),Re=r<50,je=r<40;react.useEffect(()=>{if(T)if(G&&!O&&!e.segments){let de=a<100;T({task:e,x:t,y:a,width:r,height:fe,showBelow:de});}else T(null);},[G,O,e,t,a,r,fe,T]);let bt=de=>de.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ee=()=>{let de=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${de} day${de!==1?"s":""}`},vt=de=>Math.round(de/s)*s,gt=de=>{let S=Math.round(de/s),X=new Date(n);return X.setDate(X.getDate()+S),X},wt=(de,S)=>{for(let X of h){if(X.id===e.id)continue;let he=5;if(de>=X.x-he&&de<=X.x+X.width+he&&S>=X.y-he&&S<=X.y+X.height+he)return X.id}return null},it=react.useCallback((de,S,X)=>{de.preventDefault(),de.stopPropagation();let he=b.current?.ownerSVGElement;if(!he)return;let Ae=he.createSVGPoint();Ae.x=de.clientX,Ae.y=de.clientY;let We=Ae.matrixTransform(he.getScreenCTM()?.inverse()),qe=X!==void 0?X:t,ze=S;if(!ze){let nt=We.x-qe;de.shiftKey?(ze="connect",N({x:t+r,y:a+fe/2})):de.ctrlKey||de.metaKey?ze="move":de.altKey?ze=nt<r/2?"resize-start":"resize-end":je?nt<r/2?ze="move":ze="resize-end":Re?nt<=ke/2?ze="resize-start":nt>=r-ke/2?ze="resize-end":ze="move":nt<=ke?ze="resize-start":nt>=r-ke?ze="resize-end":ze="move";}l(ze),Y(false),Q(null),ze==="move"?v(We.x-qe):ze==="connect"?N({x:t+r,y:a+fe/2}):v(0),w(qe),B(r);},[t,r,a,fe]),Jt=react.useCallback(de=>{if(y==="none")return;let S=b.current?.ownerSVGElement;if(!S)return;let X=S.createSVGPoint();X.x=de.clientX,X.y=de.clientY;let he=X.matrixTransform(S.getScreenCTM()?.inverse());if(y==="connect"){N({x:he.x,y:he.y});let Ae=wt(he.x,he.y);$(Ae);}else if(y==="move"){let Ae=he.x-k,We=vt(Ae);w(We),B(r);let qe=Math.round((We-t)/s);if(C?.(e.id,qe,true),e.segments&&e.segments.length>0&&Te!==null){let ze=We-et;L(ze);}}else if(y==="resize-start"){let Ae=he.x,We=vt(Ae),qe=t+r-We;qe>=s&&(w(We),B(qe));}else if(y==="resize-end"){let Ae=he.x,qe=vt(Ae)-t;qe>=s&&B(qe);}},[y,t,r,s,k,e,vt,Te,et,wt,$,N,w,B,L,C]),Lt=react.useCallback(()=>{if(y!=="none"){if(y==="connect")U&&g&&g(e,U),N(null),$(null);else {let de=e.endDate.getTime()-e.startDate.getTime(),S,X,he=true;if(y==="move"){if(S=gt(E),X=new Date(S.getTime()+de),e.segments&&e.segments.length>0&&Te!==null){let Ae=Math.round(Be/s),We=e.segments.map((pt,V)=>{if(V===Te){let te=new Date(pt.startDate),De=new Date(pt.endDate);return te.setDate(te.getDate()+Ae),De.setDate(De.getDate()+Ae),{startDate:te,endDate:De}}return pt}),qe=We.flatMap(pt=>[pt.startDate,pt.endDate]),ze=new Date(Math.min(...qe.map(pt=>pt.getTime()))),nt=new Date(Math.max(...qe.map(pt=>pt.getTime())));d?.({...e,segments:We},ze,nt),Se(t,r);return}}else y==="resize-start"?(S=gt(E),X=e.endDate,S>X&&(console.warn("Invalid date range: start date must be before or equal to end date"),he=false)):y==="resize-end"?(S=e.startDate,X=gt(E+x),X<S&&(console.warn("Invalid date range: end date must be after or equal to start date"),he=false)):he=false;he&&S&&X&&(X.getTime()<S.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,S,X));}C?.(e.id,0,false),Se(t,r);}},[y,E,x,e,d,U,g,t,r,s,gt,Be,Te,Se,C]);react.useEffect(()=>{if(y==="none")return;let de=X=>{Jt(X);},S=()=>{Lt();};return window.addEventListener("mousemove",de),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",de),window.removeEventListener("mouseup",S);}},[y,Jt,Lt]);let ee=O&&!ye?E:t,se=O&&!ye?x:r,ra=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:b,onClick:()=>!O&&p?.(e),onDoubleClick:de=>{O||(de.stopPropagation(),i?.(e));},onContextMenu:de=>{de.preventDefault(),u?.(e,de);},onMouseEnter:()=>!O&&Y(true),onMouseLeave:()=>{O||(Y(false),Q(null));},children:[G&&!O&&!Re&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:ke,height:fe,fill:_==="resize-start"?o.accent:"transparent",opacity:_==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-start"),onMouseDown:de=>it(de,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ke,y:a,width:r-ke*2,height:fe,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:de=>it(de,"move")}),jsxRuntime.jsx("rect",{x:t+r-ke,y:a,width:ke,height:fe,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:de=>it(de,"resize-end")})]}),G&&!O&&je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:fe,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Q("move"),onMouseDown:de=>it(de,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:fe,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Q("resize-end"),onMouseDown:de=>it(de,"resize-end")}),G&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+fe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),O&&!ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:E,y:a,width:x,height:fe,rx:He,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:ee,y:a,width:se,height:fe,rx:He,fill:oe,"data-task-class":ra,initial:{opacity:0,scale:.95},animate:{opacity:O&&!ye?.15:e.parentId?.6:G?.9:.8,scale:G&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:de=>it(de),style:{cursor:O?ye?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se*(e.progress/100),height:fe,rx:He,fill:oe,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((de,S)=>{let X=(de.startDate.getTime()-n.getTime())/864e5*s,Ae=(de.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-X+s,We=O&&y==="move"&&Te===S,qe=R===S,ze=We?X+Be:X;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!O&&D(S),onMouseLeave:()=>!O&&D(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:ze,y:a,width:Ae,height:fe,rx:He,fill:oe,initial:{opacity:0,scale:.95},animate:{opacity:We||e.parentId?.6:qe?.9:.8,scale:qe&&!O?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:nt=>{nt.stopPropagation(),Oe(S),$e(X),it(nt,void 0,X);},style:{cursor:O?ye?"crosshair":ne?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:ze,y:a,width:Ae*(e.progress/100),height:fe,rx:He,fill:oe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${S}`)}),tt&&(Me||Le)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Le&&!Me&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se,height:fe,rx:He,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Me&&jsxRuntime.jsx("rect",{x:ee,y:a,width:se,height:fe,rx:He,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),se>60&&!e.segments&&(()=>{let de=m.taskLabel(e),S=typeof de=="string"?de:e.name,X=S.length>Math.floor(se/8)?`${S.substring(0,Math.floor(se/8))}...`:S;return jsxRuntime.jsx("text",{x:ee+12,y:a+fe/2,dominantBaseline:"middle",fill:st?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:st?"line-through":"none"},children:X})})(),se>100&&e.progress>0&&e.progress<100&&!O&&!e.segments&&jsxRuntime.jsxs("text",{x:ee+se-12,y:a+fe/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&&se>80&&!O&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:ee+se-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:ee+se-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(G||ne)&&!ye&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:ee-2,y:a,width:16,height:fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Q("resize-start"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ee+4,y:a+8,width:3,height:fe-16,rx:1.5,fill:_==="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:ee+se-14,y:a,width:16,height:fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>Q("resize-end"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ee+se-7,y:a+8,width:3,height:fe-16,rx:1.5,fill:_==="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:G&&!O&&!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+18,cy:a+fe/2,r:14,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Q("connect"),onMouseLeave:()=>Q(null),onMouseDown:de=>{de.stopPropagation(),it(de,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+18,cy:a+fe/2,r:7,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_==="connect"?1.3:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsxRuntime.jsx("text",{x:t+r+32,y:a+fe/2,dominantBaseline:"middle",fill:_==="connect"?o.accent:o.textTertiary,fontSize:_==="connect"?"11":"10",fontWeight:_==="connect"?"600":"400",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ye&&A&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+fe/2,x2:A.x,y2:A.y,stroke:U?o.statusCompleted:o.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:A.x,cy:A.y,r:U?8:6,fill:U?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsxRuntime.jsx(framerMotion.motion.text,{x:A.x+15,y:A.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:A.x+10},animate:{opacity:1,x:A.x+15},transition:{duration:.2},children:"Connect"})]}),(G||O)&&!ye&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:ee-2,y:a-2,width:se+4,height:fe+4,rx:He+2,fill:"none",stroke:O?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:O?.6:.4,initial:{opacity:0},animate:{opacity:O?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ne&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:E,y1:0,x2:E,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:E+x,y1:0,x2:E+x,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:G&&!O&&!e.segments&&!T&&(()=>{let X=a<100,he=X?a+fe+13:a-82-13,Ae=X?`M ${ee+se/2-6} ${a+fe+3} L ${ee+se/2} ${a+fe+13} L ${ee+se/2+6} ${a+fe+3}`:`M ${ee+se/2-6} ${a-13} L ${ee+se/2} ${a-3} L ${ee+se/2+6} ${a-13}`,We=he+22,qe=he+40,ze=he+55,nt=he+70,pt=X?he+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:X?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:X?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Ae,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:ee+se/2-120,y:he,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:ee+se/2,y:We,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:ee+se/2-110,y:qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:ee+se/2-70,y:qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:bt(e.startDate)}),jsxRuntime.jsx("text",{x:ee+se/2-110,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:ee+se/2-70,y:ze,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:bt(e.endDate)}),jsxRuntime.jsx("text",{x:ee+se/2+10,y:qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:ee+se/2+65,y:qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ee()}),jsxRuntime.jsx("text",{x:ee+se/2+10,y:ze,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:ee+se/2+65,y:ze,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:ee+se/2-110,y:nt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:ee+se/2-50,y:nt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(V=>V.name).join(", ").substring(0,30),e.assignees.map(V=>V.name).join(", ").length>30?"...":""]})]}),!X&&jsxRuntime.jsx("text",{x:ee+se/2,y:pt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:je?"Left: move \u2022 Right: resize":Re?"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 mc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:n,showBelow:m}=e,p=82,i=13,u=m?o+n+i:o-p-i,d=m?`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=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-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:p,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(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Pn({x1:e,y1:t,x2:a,y2:r,routeY:o,fromIndex:s,toIndex:n,rowHeight:m,theme:p,onDelete:i,onHoverChange:u,lineStyle:d="curved"}){let[g,h]=react.useState(false),C=a-e,T=r-t,c=e+C/2,b=s!==void 0&&n!==void 0&&s===n,y=o??Math.max(t,r)+20,l=30,k;b||Math.abs(T)<5?d==="squared"?k=`M ${e} ${t} L ${a} ${r}`:k=`M ${e} ${t} C ${c} ${t}, ${c} ${r}, ${a} ${r}`:d==="squared"?k=`M ${e} ${t} L ${e+l} ${t} L ${e+l} ${y} L ${a-l} ${y} L ${a-l} ${r} L ${a} ${r}`:k=`M ${e} ${t} C ${e+l*2} ${t}, ${e+l*2} ${y}, ${c} ${y} S ${a-l*2} ${r}, ${a} ${r}`;let v=5,E=a-v,w=r-v*.5,x=a-v,B=r+v*.5,A=p.dependency;react.useEffect(()=>{u&&i&&u(g?{x1:e,y1:t,x2:a,y2:r,routeY:y,onDelete:i,lineStyle:d}:null);},[g,e,t,a,r,y,i,u,d]);let N=!i&&!u;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!N&&h(true),onMouseLeave:()=>!N&&h(false),style:{pointerEvents:N?"none":"auto"},children:[!N&&jsxRuntime.jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:k,fill:"none",stroke:A,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:g&&u?0:g?1:.8,strokeWidth:g?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${E} ${w} M ${a} ${r} L ${x} ${B}`,fill:"none",stroke:A,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:g&&u?0:g?1:.8,scale:g?1.1:1,strokeWidth:g?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:A,initial:{scale:0},animate:{scale:g&&u?0:g?1.3:1,opacity:g&&u?0:g?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),g&&i&&!u&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:U=>{U.stopPropagation(),i();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:p.bgSecondary,stroke:p.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:p.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:p.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function An({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),m=16,p=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:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,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-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+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:p(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 ue={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,m=new Set,p=i=>{if(!n.has(i)){n.add(i),m.add(i);let u=r.get(i)||[];for(let d of u){if(!n.has(d)&&p(d))return true;if(m.has(d))return true}}return m.delete(i),false};return p(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=ue.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ue.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ue.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=ue.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=ue.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=ue.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)=>ue.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ue.findTaskById(e,t);return !a||!a.dependencies?[]:ue.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ue.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ue.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=ue.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=>ue.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=ue.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"]],m=s.map(p=>{let i=p.startDate&&p.endDate?ue.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?ue.formatDate(p.startDate):"N/A",p.endDate?ue.formatDate(p.endDate):"N/A",i>0?`${i} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:n,body:m,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=ue.flattenTasks(e).map(p=>{let i=p.startDate&&p.endDate?ue.calculateDuration(p.startDate,p.endDate):0;return {"Task ID":p.id,"Task Name":p.name,"Start Date":p.startDate?ue.formatDate(p.startDate):"","End Date":p.endDate?ue.formatDate(p.endDate):"","Duration (days)":i>0?i:"","Progress (%)":p.progress,Status:p.status||"",Assignees:p.assignees?.map(u=>u.name).join(", ")||"",Dependencies:p.dependencies?.join(", ")||"","Is Milestone":p.isMilestone?"Yes":"No","Parent ID":p.parentId||"",Level:p.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 m=a.utils.book_new();a.utils.book_append_sheet(m,s,"Gantt Tasks"),a.writeFile(m,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ue.flattenTasks(e),o=new Map;r.forEach((g,h)=>{o.set(g.id,h+1);});let s=g=>g.toISOString().replace("Z",""),n=ue.getEarliestStartDate(e)||new Date,m=ue.getLatestEndDate(e)||new Date,p=r.map((g,h)=>{let C=o.get(g.id),T=g.startDate&&g.endDate?ue.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>${p}
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=ue.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?ue.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,m=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?ue.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){m(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(m);let p=[];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&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=ue.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ue.calculateCriticalPath(e).includes(t))return 0;let o=ue.getDependentTasks(e,t);if(o.length===0){let m=ue.getLatestEndDate(e);if(!m)return null;let p=ue.calculateDuration(a.endDate,m);return Math.max(0,p)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!s)return null;let n=ue.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ue.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ue.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ue.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=ue.calculateDuration(n.startDate,n.endDate),p;a!==void 0?(p=new Date(n.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=ue.calculateEndDate(p,m),u=d=>d.map(g=>g.id===n.id?{...g,startDate:p,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=ue.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=ue.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=ue.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(N=>N.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,w=(l-i)/u*s,x=w+C*s,B=Math.max(v*s,s),A=m+y*n+12;p.push({taskId:b.id,taskName:b.name,originalX:w,previewX:x,width:B,y:A,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ue.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:m,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:m,dependencyLineStyle:p="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),[k,v]=react.useState(null),E=react.useCallback(L=>{l(L);},[]),w=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),x=r==="day"?60:r==="week"?20:8,B=w*x*n,A=L=>{let R=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),D=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-D);let G=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-G.getTime())/864e5+1)/7)},N=L=>{let R=L.getDay();return R===0||R===6},U=react.useCallback(L=>{let R=Math.round(L/(x*n)),D=new Date(o);return D.setDate(D.getDate()+R),D},[o,x,n]),$=react.useCallback((L,R)=>{if(R.startDate&&R.endDate)return;let D=L.currentTarget.ownerSVGElement;if(!D)return;let G=D.createSVGPoint();G.x=L.clientX,G.y=L.clientY;let Y=G.matrixTransform(D.getScreenCTM()?.inverse()),O=U(Y.x),ne=new Date(O);ne.setDate(ne.getDate()+1),g?.(R,O,ne);},[U,g]),_=react.useMemo(()=>{let L=Y=>Y.map(O=>{if(O.subtasks&&O.subtasks.length>0){let ne=L(O.subtasks),ye=ne.filter(Se=>Se.startDate&&Se.endDate);if(ye.length>0){let Se=ye.map(Le=>Le.startDate.getTime()),fe=ye.map(Le=>Le.endDate.getTime()),He=new Date(Math.min(...Se)),Me=new Date(Math.max(...fe));return {...O,subtasks:ne,startDate:He,endDate:Me}}return {...O,subtasks:ne}}return O}),R=(Y,O=[])=>{for(let ne of Y)O.push(ne),ne.subtasks&&ne.subtasks.length>0&&(ne.isExpanded===void 0||ne.isExpanded)&&R(ne.subtasks,O);return O},D=L(e);return R(D)},[e]),Q=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let R=L.startDate.getTime(),D=L.endDate.getTime(),G=o.getTime(),Y=(R-G)/(1e3*60*60*24),O=(D-R)/(1e3*60*60*24),ne=Y*x*n,ye=Math.max(x*n,40),Se=Math.max(O*x*n,ye);return {x:ne,width:Se}},[o,x,n]),Te=react.useMemo(()=>_.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:R,width:D}=Q(L),Y=_.findIndex(O=>O.id===L.id)*a+12;return {id:L.id,x:R,y:Y,width:D,height:32}}),[_,Q]),Oe=react.useCallback((L,R,D)=>{if(!D||R===0){b([]);return}let G=ue.calculateCascadePreview(e,L,R,_,o,x*n,a,48);b(G);},[e,_,o,x,n,a,48]),et=react.useMemo(()=>{let L=[],R=new Date(o);for(;R<=s;){let Y=(R.getTime()-o.getTime())/864e5*x*n;if(r==="day")L.push({date:new Date(R),label:R.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),R.setDate(R.getDate()+1);else if(r==="week"){let O=A(R);L.push({date:new Date(R),label:`Week ${O}`,x:Y}),R.setDate(R.getDate()+7);}else L.push({date:new Date(R),label:R.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),R.setMonth(R.getMonth()+1);}return L},[o,s,r,x,n]),$e=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*x*n,[o,x,n]),Be=Math.max(_.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(B,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(B,1e3),height:48,fill:t.bgGrid}),et.map((L,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${R}`)),$e>=0&&$e<=B&&jsxRuntime.jsx("circle",{cx:$e,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(B,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(B,1e3),height:Be,fill:t.bgPrimary}),et.map((L,R)=>{let D=et[R+1]?.x||B,G=N(L.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:D-L.x,height:_.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:_.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),_.map((L,R)=>{let D=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:B,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:B,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>$(G,L),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-${L.id}`),jsxRuntime.jsx("text",{x:$e>0?$e:100,y:R*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-${L.id}`)]})]},`row-group-${L.id}`)}),_.map((L,R)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(D=>{let G=_.find(tt=>tt.id===D);if(!G||!G.startDate||!G.endDate)return null;let Y=_.findIndex(tt=>tt.id===D),O=Q(G),ne=Q(L),ye=O.x+O.width,Se=Y*a+28,fe=ne.x,He=R*a+28,Le=Math.max(Y,R)*a+a-2;return jsxRuntime.jsx(Pn,{x1:ye,y1:Se,x2:fe,y2:He,routeY:Le,fromIndex:Y,toIndex:R,rowHeight:a,theme:t,lineStyle:p},`dep-${D}-${L.id}`)})),_.map((L,R)=>{if(!L.startDate||!L.endDate)return null;let{x:D,width:G}=Q(L),Y=R*a+12,O=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(An,{task:L,x:D+G/2,y:Y+16,theme:t,onClick:i},L.id):O?jsxRuntime.jsxs("g",{onClick:()=>i?.(L),onContextMenu:ne=>{ne.preventDefault(),ne.stopPropagation(),d?.(L,ne);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:D,y:Y,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:D,y1:Y,x2:D+G,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D,y1:Y,x2:D,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+G,y1:Y,x2:D+G,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D,y1:Y+32,x2:D+G,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:D+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(Dn,{task:L,x:D,y:Y,width:G,theme:t,dayWidth:x*n,startDate:o,templates:m,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:Te,onDragMove:Oe,onHoverChange:E},L.id)}),_.map((L,R)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(D=>{let G=_.find(ie=>ie.id===D);if(!G||!G.startDate||!G.endDate)return null;let Y=_.findIndex(ie=>ie.id===D),O=Q(G),ne=Q(L),ye=O.x+O.width,Se=Y*a+28,fe=ne.x,He=R*a+28,Le=Math.max(Y,R)*a+a-2,tt=Y===R,st=10,Ye;if(tt){let ie=ye+35,ke=fe-15;Ye=`M ${ie} ${Se} L ${ke} ${He}`;}else {let ie=ye+st+25,ke=fe-st-10;Ye=`M ${ie} ${Le} L ${ke} ${Le}`;}if(k&&k.x1===ye&&k.y1===Se&&k.x2===fe&&k.y2===He)return null;let oe=ie=>{let ke=ie.currentTarget.ownerSVGElement;if(!ke)return;let Re=ke.getBoundingClientRect(),je=ie.clientX-Re.left,bt=ie.clientY-Re.top;v({x1:ye,y1:Se,x2:fe,y2:He,routeY:Le,onDelete:()=>C?.(L.id,D),lineStyle:p,mouseX:je,mouseY:bt});};return jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:oe,onMouseMove:oe},`dep-hover-${D}-${L.id}`)})),c.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),k&&(()=>{let{x1:L,y1:R,x2:D,y2:G,routeY:Y,onDelete:O,lineStyle:ne,mouseX:ye,mouseY:Se}=k,fe=D-L,He=G-R,Me=L+fe/2,Le=Math.abs(He)<5,tt=Y??Math.max(R,G)+24,st=10,Ye;Le?ne==="squared"?Ye=`M ${L} ${R} L ${D} ${G}`:Ye=`M ${L} ${R} C ${Me} ${R}, ${Me} ${G}, ${D} ${G}`:ne==="squared"?Ye=`M ${L} ${R} L ${L+st} ${R} L ${L+st} ${tt} L ${D-st} ${tt} L ${D-st} ${G} L ${D} ${G}`:Ye=`M ${L} ${R} C ${L+st*2} ${R}, ${L+st*2} ${tt}, ${Me} ${tt} S ${D-st*2} ${G}, ${D} ${G}`;let z=5,oe=D-z,ie=G-z*.5,ke=D-z,Re=G+z*.5,je=t.dependency,bt="#f87171",Ee="rgba(248, 113, 113, 0.15)",vt=Me,gt=Le?(R+G)/2:tt,wt=false;ye!==void 0&&Se!==void 0&&!Le?(vt=Math.max(L+st+20,Math.min(D-st-20,ye)),gt=tt):ye!==void 0&&Le&&(vt=Math.max(L+20,Math.min(D-20,ye)),gt=(R+G)/2);let it=Math.floor(gt/a);if(it>=0&&it<_.length){let Lt=_[it];if(Lt&&Lt.startDate&&Lt.endDate){let ee=Q(Lt),se=it*a+12,ra=se+32,de=ee.x-15,S=ee.x+ee.width+50;vt>=de&&vt<=S&&gt>=se-5&&gt<=ra+5&&(wt=true);}}return jsxRuntime.jsxs("g",{onMouseLeave:()=>v(null),onMouseMove:Lt=>{let ee=Lt.currentTarget.ownerSVGElement||Lt.currentTarget;if(!ee)return;let se=ee.getBoundingClientRect(),ra=Lt.clientX-se.left,de=Lt.clientY-se.top;v(S=>S?{...S,mouseX:ra,mouseY:de}:null);},children:[jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:je,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${D} ${G} L ${oe} ${ie} M ${D} ${G} L ${ke} ${Re}`,fill:"none",stroke:je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:D,cy:G,r:4,fill:je,opacity:.9,style:{pointerEvents:"none"}}),!wt&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Lt=>{Lt.stopPropagation(),v(null),O();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:vt,cy:gt,r:9,fill:Ee,stroke:bt,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:vt-3,y1:gt-3,x2:vt+3,y2:gt+3,stroke:bt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:vt+3,y1:gt-3,x2:vt-3,y2:gt+3,stroke:bt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),$e>=0&&$e<=B&&jsxRuntime.jsx("line",{x1:$e,y1:0,x2:$e,y2:Be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(mc,{tooltipData:y,theme:t})]})]})}var u0=['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"'],fc=()=>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"})]}),g0=()=>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"})}),f0=()=>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"})}),h0=()=>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"})}),b0=()=>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 In({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:p}){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,k]=react.useState(true),v=react.useRef(null),E=react.useRef(null),w=react.useRef(null),{enabled:x=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:N,suggestions:U=u0,maxHistory:$=50,persistHistory:_}=a,Q=_?.storageKey||"gantt-ai-history",Te=_?.maxMessages??5;react.useEffect(()=>{if(_?.enabled)try{let R=localStorage.getItem(Q);if(R){let G=JSON.parse(R).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));C(G.slice(-Te));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[_?.enabled,Q,Te]),react.useEffect(()=>{if(_?.enabled&&h.length>0)try{let R=h.filter(D=>!D.isLoading).slice(-Te);localStorage.setItem(Q,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[h,_?.enabled,Q,Te]),react.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let Oe=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,s,n,m,p]),et=react.useCallback(async R=>{if(!R.trim()||b)return;let D={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};C(Y=>[...Y.slice(-($-1)),D]),c(""),k(false),y(true);let G={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(Y=>[...Y,G]);try{if(N){let Y=await N(R,e);C(O=>{let ne=O.filter(Se=>!Se.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...ne,ye]}),Oe(Y);}else C(Y=>[...Y.filter(ne=>!ne.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(Y){C(O=>[...O.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,$,N,e,Oe]),$e=R=>{R.preventDefault(),et(T);},Be=R=>{c(R),v.current?.focus();};if(react.useEffect(()=>{let R=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),u(G=>!G),i||g(false)),D.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=G=>{let Y=G.target;w.current&&!w.current.contains(Y)&&u(false);},D=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(D),document.removeEventListener("mousedown",R);}},[i]),!x)return null;let L={"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(ft,{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 ${L[A]} 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(fc,{}),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:w,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 ${L[A]} 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(fc,{}),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(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(h0,{})}),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(f0,{})})]})]}),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:U.slice(0,4).map((R,D)=>jsxRuntime.jsx("button",{onClick:()=>Be(R),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:R.length>30?R.slice(0,30)+"...":R},D))})]}),h.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(b0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:E})]}),jsxRuntime.jsxs("form",{onSubmit:$e,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:R=>c(R.target.value),placeholder:B,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(g0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function hc(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]}});},[]),m=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}});},[]),p=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function bc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&p&&n.key==="y"){n.preventDefault(),t();return}if(m&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var k0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ue.formatDate(e.startDate)} - ${ue.formatDate(e.endDate)}`);let a=ue.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=>ue.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yc(e){return {...k0,...e}}var E0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},kc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:p=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:k,onTaskFilterChange:v,onThemeChange:E,onTaskClick:w,onTaskDblClick:x,onTaskContextMenu:B,onTaskUpdate:A,onProgressChange:N,onTaskEdit:U,onTaskAddSubtask:$,onTaskMarkIncomplete:_,onTaskSetInProgress:Q,onDependencyCreate:Te,onDependencyDelete:Oe,onBeforeTaskAdd:et,onAfterTaskAdd:$e,onBeforeTaskUpdate:Be,onAfterTaskUpdate:L,onBeforeTaskDelete:R,onAfterTaskDelete:D}=a,Y=react.useContext(yn)?.theme,[O,ne]=react.useState(Y||s||"dark"),[ye,Se]=react.useState(n),[fe,He]=react.useState(m),[Me,Le]=react.useState(1),[tt,st]=react.useState("all"),Ye=k??tt,z=v??st,[oe,ie]=react.useState(0),[ke,Re]=react.useState(false),[je,bt]=react.useState(null),[Ee,vt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,wt]=react.useState(null),[it,Jt]=react.useState(null);react.useEffect(()=>{Y&&Y!==O&&ne(Y);},[Y]),react.useEffect(()=>{s&&s!==O&&ne(s);},[s]);let Lt=react.useCallback(F=>{ne(F),E?.(F);},[E]),{state:ee,setState:se,undo:ra,redo:de,canUndo:S,canRedo:X,clearHistory:he}=hc(t,50),Ae=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),We=react.useRef(new Map),qe=react.useRef(false);if(!qe.current&&h){qe.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let I=localStorage.getItem(F);if(I){let j=JSON.parse(I);Array.isArray(j)&&(We.current=new Map(j));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let ze=react.useCallback(()=>{let F=Ae();if(F)try{let I=Array.from(We.current.entries());localStorage.setItem(F,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[Ae]);react.useEffect(()=>{let F=I=>I.map(j=>{let ae=We.current.get(j.id),me=ae!==void 0?{...j,isExpanded:ae}:j;return me.subtasks?.length?{...me,subtasks:F(me.subtasks)}:me});We.current.size>0?se(F(t)):se(t);},[t,se]);let nt=react.useRef(t),pt=react.useRef(true);react.useEffect(()=>{if(pt.current){pt.current=false,nt.current=ee;return}if(!r)return;let F=JSON.stringify(nt.current),I=JSON.stringify(ee);F!==I&&(nt.current=ee,r(ee));},[ee,r]);let V=react.useMemo(()=>ei(T,c),[T,c]),te=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}],[]),[De,Xe]=react.useState(()=>te(V));react.useEffect(()=>{Xe(F=>F.map(I=>({...I,label:V.columns[I.id==="name"?"taskName":I.id]||I.label})));},[V]);let Ge=react.useMemo(()=>De.filter(I=>I.visible).reduce((I,j)=>I+j.width,0),[De]),W=react.useRef(De.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=De.filter(ae=>ae.visible),I=F.map(ae=>ae.id).join(","),j=W.current;if(I!==j){let ae=F.some(Ce=>Ce.id!=="name"),me=j.includes(",");ae?!me&&ae&&bt(null):bt(null),W.current=I;}},[De]);let le=60,Ie=.6,At=react.useMemo(()=>{let I=Ge+le,j=typeof window<"u"?window.innerWidth*Ie:800,ae=Math.max(I,j);return je!==null?Math.max(200,Math.min(je,ae)):Math.max(200,I)},[je,Ge]),at=react.useRef(null),xa=react.useRef(null),fa=react.useRef(null),P=react.useMemo(()=>Ud(O),[O]),be=react.useMemo(()=>({theme:P,themeName:O}),[P,O]),J=react.useMemo(()=>yc(d),[d]),Pe=react.useMemo(()=>{if(!g)return ee;let F=ue.calculateCriticalPath(ee),I=j=>j.map(ae=>({...ae,isCriticalPath:F.includes(ae.id),subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(ee)},[ee,g]),lt=react.useMemo(()=>{if(Ye==="all")return Pe;let F=I=>{let j=[];for(let ae of I){let me=ae.subtasks?.length?F(ae.subtasks):void 0,Ce=false;switch(Ye){case "incomplete":Ce=ae.progress<100;break;case "in_progress":Ce=ae.progress>0&&ae.progress<100;break;case "completed":Ce=ae.progress===100;break}(Ce||me&&me.length>0)&&j.push({...ae,subtasks:me});}return j};return F(Pe)},[Pe,Ye]),re=E0(fe);bc({undo:ra,redo:de,canUndo:S,canRedo:X,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>ue.findTaskById(ee,F),addTask:(F,I)=>{se(j=>{if(!I)return [...j,{...F,level:0}];let ae=me=>me.map(Ce=>Ce.id===I?{...Ce,subtasks:[...Ce.subtasks||[],{...F,parentId:I,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:ae(Ce.subtasks)}:Ce);return ae(j)});},updateTask:(F,I)=>{se(j=>{let ae=me=>me.map(Ce=>Ce.id===F?{...Ce,...I}:Ce.subtasks?{...Ce,subtasks:ae(Ce.subtasks)}:Ce);return ae(j)});},deleteTask:F=>{se(I=>{let j=ae=>ae.filter(me=>me.id===F?false:(me.subtasks&&(me.subtasks=j(me.subtasks)),true));return j(I)});},deleteTasks:F=>{se(I=>ci(I,F));},duplicateTask:F=>{se(I=>pi(I,[F]));},splitTask:(F,I,j=3)=>{se(ae=>ue.splitTask(ae,F,I,j));},calculateEndDate:ue.calculateEndDate,calculateDuration:ue.calculateDuration,validateDependency:(F,I)=>!ue.validateDependencies(ee,F,I),getAllTasks:()=>ue.flattenTasks(ee),getTasksByStatus:F=>ue.flattenTasks(ee).filter(I=>I.status===F),getTasksByParent:F=>F?ue.findTaskById(ee,F)?.subtasks||[]:ee.filter(j=>!j.parentId),getCriticalPath:()=>ue.flattenTasks(ee).filter(F=>F.isCriticalPath),indentTask:F=>{se(I=>ii(I,[F]));},outdentTask:F=>{se(I=>li(I,[F]));},moveTask:(F,I)=>{se(j=>di(j,[F],I));},createSubtask:async F=>{let{tasks:I,newTask:j}=gi(ee,F);if(et){let ae=et({...j,parentId:F});if((ae instanceof Promise?await ae:ae)===false)return}se(I),$e&&$e({...j,parentId:F});},scrollToTask:F=>{let j=ue.flattenTasks(ee).findIndex(ae=>ae.id===F);if(j!==-1&&at.current){let ae=j*re;at.current.scrollTo({top:ae,behavior:"smooth"}),xa.current&&xa.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(F,I=2e3)=>{},expandTask:F=>{se(I=>{let j=ae=>ae.map(me=>me.id===F?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},collapseTask:F=>{se(I=>{let j=ae=>ae.map(me=>me.id===F?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},expandAll:()=>{se(F=>{let I=j=>j.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},collapseAll:()=>{se(F=>{let I=j=>j.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},undo:ra,redo:de,canUndo:()=>S,canRedo:()=>X,clearHistory:he,exportToPNG:async()=>{if(!fa.current||!at.current||!xa.current)throw new Error("Gantt container not found");let F=fa.current,I=at.current.querySelector(".gantt-grid-scroll"),j=xa.current,ae=I?.scrollTop||0,me=j.scrollTop,Ce=F.style.overflow,Ct=F.style.height;try{let ea=I?.querySelector(".gantt-taskgrid-content"),ka=j.querySelector("svg"),wa=ea?.scrollHeight||I?.scrollHeight||600,Aa=ka?.getBoundingClientRect().height||j.scrollHeight,Br=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Aa)+20;I&&(I.scrollTop=0),j.scrollTop=0,F.style.overflow="visible",F.style.height=`${Br}px`,await new Promise(kr=>setTimeout(kr,100));let xr=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let ro=window.getComputedStyle(kr),Rr=parseInt(ro.zIndex,10);return !isNaN(Rr)&&Rr>=50||ro.position==="fixed"}});return new Promise((kr,ro)=>{xr.toBlob(Rr=>{Rr?kr(Rr):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ce,F.style.height=Ct,I&&(I.scrollTop=ae),j.scrollTop=me;}},exportToPDF:async F=>{await ue.exportToPDF(ee,F);},exportToExcel:async F=>{await ue.exportToExcel(ee,F);},exportToJSON:()=>ue.exportToJSON(ee),exportToCSV:()=>ue.exportToCSV(ee),importFromJSON:F=>{let I=ue.importFromJSON(F);se(I);},getTasks:()=>ee,refresh:()=>{se(F=>[...F]);},clearAll:()=>{se([]);}}),[ee,ra,de,S,X,he,P,re]);let Ue=react.useCallback(F=>{Xe(I=>I.map(j=>j.id===F?{...j,visible:!j.visible}:j));},[]),St=react.useCallback((F,I)=>{Xe(j=>j.map(ae=>{if(ae.id!==F)return ae;let me=ae.minWidth??100,Ce=ae.maxWidth??800,Ct=Math.max(me,Math.min(Ce,I));return {...ae,width:Ct}}));},[]),Fe=react.useCallback(F=>{se(I=>{let j=ui(I,F),ae=me=>{for(let Ce of me){if(Ce.id===F){We.current.set(F,Ce.isExpanded??true);return}Ce.subtasks?.length&&ae(Ce.subtasks);}};return ae(j),ze(),j}),a.onTaskToggleExpand?.(F);},[a,ze]),Bt=react.useCallback((F,I)=>{if(Be&&Be(F,I)===false)return;let ae=ue.findTaskById(ee,F)?.progress,me=Ct=>Ct.map(ea=>ea.id===F?{...ea,...I}:ea.subtasks?{...ea,subtasks:me(ea.subtasks)}:ea);se(me(ee));let Ce=ue.findTaskById(me(ee),F);Ce&&(A?.(Ce),L?.(Ce),I.progress!==void 0&&ae!==void 0&&I.progress!==ae&&N?.(F,ae,I.progress));},[ee,A,Be,L,N]),mt=react.useCallback(F=>{F.length!==0&&(se(I=>ii(I,F)),a.onTaskIndent?.(F[0]));},[a]),ha=react.useCallback(F=>{F.length!==0&&(se(I=>li(I,F)),a.onTaskOutdent?.(F[0]));},[a]),Wt=react.useCallback((F,I,j)=>{se(ae=>oc(ae,F,I,j)),a.onTaskReparent?.(F,I,j);},[a]),Ke=react.useCallback((F,I)=>{F.length!==0&&(se(j=>di(j,F,I)),a.onTaskMove?.(F[0],I));},[a]),Et=react.useCallback(async F=>{let I=[];for(let j of F)R&&await Promise.resolve(R(j))===false||I.push(j);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(se(j=>ci(j,I)),I.forEach(j=>a.onTaskDelete?.(j))),D&&I.forEach(j=>D(j)));},[a,R,D]),ca=react.useCallback(F=>{se(I=>pi(I,F)),F.forEach(I=>a.onTaskDuplicate?.(I));},[a]),yr=react.useCallback((F,I)=>{se(j=>{let{tasks:ae,newTask:me}=rc(j,F,I);return et&&et(me)===false?j:(a.onTaskCreate?.(me.parentId,me.position||0),$e?.(me),ae)});},[a,et,$e]),Up=react.useCallback((F,I)=>{se(j=>mi(j,F,I)),a.onTaskRename?.(F,I);},[a]),Zn=react.useCallback(F=>{se(I=>{let{tasks:j}=gi(I,F);return a.onTaskCreate?.(F,0),j});},[a]),Hp=react.useCallback((F,I,j)=>{let ae=F.startDate?Math.round((I.getTime()-F.startDate.getTime())/864e5):0,me=ea=>ea.map(ka=>ka.id===F.id?{...ka,startDate:I,endDate:j,...F.segments&&{segments:F.segments}}:ka.subtasks?{...ka,subtasks:me(ka.subtasks)}:ka),Ce=me(ee);Ce=ue.autoScheduleDependents(Ce,F.id,ae),se(Ce);let Ct={...F,startDate:I,endDate:j};A?.(Ct);},[ee,A]),Wp=react.useCallback((F,I)=>{B?.(F,I),vt({isOpen:true,x:I.clientX,y:I.clientY,task:F});},[B]),Gp=react.useCallback((F,I)=>{let j=ue.splitTask(ee,F.id,I);se(j),vt({isOpen:false,x:0,y:0,task:null});},[ee]),hl=react.useCallback(F=>{let I=ue.findTaskById(ee,F.id)||F;x?.(I),U||wt(I);},[ee,x,U]),bl=react.useCallback((F,I,j)=>{let ae=new Map,me=wa=>{wa.forEach(Aa=>{Aa.dependencies&&ae.set(Aa.id,Aa.dependencies),Aa.subtasks&&me(Aa.subtasks);});};me(j);let Ce=ae.get(I)||[];ae.set(I,[...Ce,F]);let Ct=new Set,ea=new Set,ka=wa=>{if(!Ct.has(wa)){Ct.add(wa),ea.add(wa);let Aa=ae.get(wa)||[];for(let vr of Aa){if(!Ct.has(vr)&&ka(vr))return true;if(ea.has(vr))return true}}return ea.delete(wa),false};return ka(I)},[]),yl=react.useCallback((F,I)=>{if(bl(F.id,I,ee)){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=ue.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?ue.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,m=i=>{if(n.has(i.id))return;let u=i.startDate&&i.endDate?ue.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){m(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(m);let p=[];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&&p.push(i.id);}}return p},calculateSlack:(e,t)=>{let a=ue.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ue.calculateCriticalPath(e).includes(t))return 0;let o=ue.getDependentTasks(e,t);if(o.length===0){let m=ue.getLatestEndDate(e);if(!m)return null;let p=ue.calculateDuration(a.endDate,m);return Math.max(0,p)}let s=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!s)return null;let n=ue.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ue.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ue.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ue.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let m=ue.calculateDuration(n.startDate,n.endDate),p;a!==void 0?(p=new Date(n.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let i=ue.calculateEndDate(p,m),u=d=>d.map(g=>g.id===n.id?{...g,startDate:p,endDate:i}:g.subtasks?{...g,subtasks:u(g.subtasks)}:g);s=u(s),s=ue.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,m)=>{if(a===0)return [];let p=[],i=o.getTime(),u=1e3*60*60*24,d=ue.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=ue.getDependentTasks(e,h);for(let b of c){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(N=>N.id===b.id);if(y===-1)continue;let l=b.startDate.getTime(),v=(b.endDate.getTime()-l)/u,w=(l-i)/u*s,x=w+C*s,B=Math.max(v*s,s),A=m+y*n+12;p.push({taskId:b.id,taskName:b.name,originalX:w,previewX:x,width:B,y:A,rowIndex:y,daysDelta:C,color:b.color}),g(b.id,C,T);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=ue.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 m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:m}],i=u=>u.map(d=>d.id===o.id?{...d,endDate:m,segments:p}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ln({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,templates:m,dependencyLineStyle:p="curved",onTaskClick:i,onTaskDblClick:u,onTaskContextMenu:d,onTaskDateChange:g,onDependencyCreate:h,onDependencyDelete:C}){let[c,b]=react.useState([]),[y,l]=react.useState(null),[k,v]=react.useState(null),E=react.useCallback(L=>{l(L);},[]),w=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),x=r==="day"?60:r==="week"?20:8,B=w*x*n,A=L=>{let R=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),D=R.getUTCDay()||7;R.setUTCDate(R.getUTCDate()+4-D);let G=new Date(Date.UTC(R.getUTCFullYear(),0,1));return Math.ceil(((R.getTime()-G.getTime())/864e5+1)/7)},N=L=>{let R=L.getDay();return R===0||R===6},U=react.useCallback(L=>{let R=Math.round(L/(x*n)),D=new Date(o);return D.setDate(D.getDate()+R),D},[o,x,n]),$=react.useCallback((L,R)=>{if(R.startDate&&R.endDate)return;let D=L.currentTarget.ownerSVGElement;if(!D)return;let G=D.createSVGPoint();G.x=L.clientX,G.y=L.clientY;let Y=G.matrixTransform(D.getScreenCTM()?.inverse()),O=U(Y.x),ne=new Date(O);ne.setDate(ne.getDate()+1),g?.(R,O,ne);},[U,g]),_=react.useMemo(()=>{let L=Y=>Y.map(O=>{if(O.subtasks&&O.subtasks.length>0){let ne=L(O.subtasks),ye=ne.filter(Se=>Se.startDate&&Se.endDate);if(ye.length>0){let Se=ye.map(Le=>Le.startDate.getTime()),fe=ye.map(Le=>Le.endDate.getTime()),He=new Date(Math.min(...Se)),Me=new Date(Math.max(...fe));return {...O,subtasks:ne,startDate:He,endDate:Me}}return {...O,subtasks:ne}}return O}),R=(Y,O=[])=>{for(let ne of Y)O.push(ne),ne.subtasks&&ne.subtasks.length>0&&(ne.isExpanded===void 0||ne.isExpanded)&&R(ne.subtasks,O);return O},D=L(e);return R(D)},[e]),Q=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let R=L.startDate.getTime(),D=L.endDate.getTime(),G=o.getTime(),Y=(R-G)/(1e3*60*60*24),O=(D-R)/(1e3*60*60*24),ne=Y*x*n,ye=Math.max(x*n,40),Se=Math.max(O*x*n,ye);return {x:ne,width:Se}},[o,x,n]),Te=react.useMemo(()=>_.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:R,width:D}=Q(L),Y=_.findIndex(O=>O.id===L.id)*a+12;return {id:L.id,x:R,y:Y,width:D,height:32}}),[_,Q]),Oe=react.useCallback((L,R,D)=>{if(!D||R===0){b([]);return}let G=ue.calculateCascadePreview(e,L,R,_,o,x*n,a,48);b(G);},[e,_,o,x,n,a,48]),et=react.useMemo(()=>{let L=[],R=new Date(o);for(;R<=s;){let Y=(R.getTime()-o.getTime())/864e5*x*n;if(r==="day")L.push({date:new Date(R),label:R.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),R.setDate(R.getDate()+1);else if(r==="week"){let O=A(R);L.push({date:new Date(R),label:`Week ${O}`,x:Y}),R.setDate(R.getDate()+7);}else L.push({date:new Date(R),label:R.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),R.setMonth(R.getMonth()+1);}return L},[o,s,r,x,n]),$e=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*x*n,[o,x,n]),Be=Math.max(_.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(B,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(B,1e3),height:48,fill:t.bgGrid}),et.map((L,R)=>jsxRuntime.jsxs("g",{children:[R>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${R}`)),$e>=0&&$e<=B&&jsxRuntime.jsx("circle",{cx:$e,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(B,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(B,1e3),height:Be,fill:t.bgPrimary}),et.map((L,R)=>{let D=et[R+1]?.x||B,G=N(L.date);return jsxRuntime.jsxs("g",{children:[G&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:D-L.x,height:_.length*a,fill:t.bgWeekend,opacity:1}),R>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:_.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},R)}),_.map((L,R)=>{let D=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:B,height:a,fill:R%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:R*a,width:B,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:G=>$(G,L),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-${L.id}`),jsxRuntime.jsx("text",{x:$e>0?$e:100,y:R*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-${L.id}`)]})]},`row-group-${L.id}`)}),_.map((L,R)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(D=>{let G=_.find(tt=>tt.id===D);if(!G||!G.startDate||!G.endDate)return null;let Y=_.findIndex(tt=>tt.id===D),O=Q(G),ne=Q(L),ye=O.x+O.width,Se=Y*a+28,fe=ne.x,He=R*a+28,Le=(Math.max(Y,R)+1)*a;return jsxRuntime.jsx(Pn,{x1:ye,y1:Se,x2:fe,y2:He,routeY:Le,fromIndex:Y,toIndex:R,rowHeight:a,theme:t,lineStyle:p},`dep-${D}-${L.id}`)})),_.map((L,R)=>{if(!L.startDate||!L.endDate)return null;let{x:D,width:G}=Q(L),Y=R*a+12,O=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(An,{task:L,x:D+G/2,y:Y+16,theme:t,onClick:i},L.id):O?jsxRuntime.jsxs("g",{onClick:()=>i?.(L),onContextMenu:ne=>{ne.preventDefault(),ne.stopPropagation(),d?.(L,ne);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:D,y:Y,width:G,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:D,y1:Y,x2:D+G,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D,y1:Y,x2:D,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D+G,y1:Y,x2:D+G,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:D,y1:Y+32,x2:D+G,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),G>60&&jsxRuntime.jsx("text",{x:D+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(Dn,{task:L,x:D,y:Y,width:G,theme:t,dayWidth:x*n,startDate:o,templates:m,onClick:i,onDoubleClick:u,onContextMenu:d,onDateChange:g,onDependencyCreate:h,allTaskPositions:Te,onDragMove:Oe,onHoverChange:E},L.id)}),_.map((L,R)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(D=>{let G=_.find(ie=>ie.id===D);if(!G||!G.startDate||!G.endDate)return null;let Y=_.findIndex(ie=>ie.id===D),O=Q(G),ne=Q(L),ye=O.x+O.width,Se=Y*a+28,fe=ne.x,He=R*a+28,Le=(Math.max(Y,R)+1)*a,tt=Y===R,st=30,Ye;if(tt){let ie=ye+35,ke=fe-15;Ye=`M ${ie} ${Se} L ${ke} ${He}`;}else {let ie=ye+st+5,ke=fe-st-5;Ye=`M ${ie} ${Le} L ${ke} ${Le}`;}if(k&&k.x1===ye&&k.y1===Se&&k.x2===fe&&k.y2===He)return null;let oe=ie=>{let ke=ie.currentTarget.ownerSVGElement;if(!ke)return;let Re=ke.getBoundingClientRect(),je=ie.clientX-Re.left,bt=ie.clientY-Re.top;v({x1:ye,y1:Se,x2:fe,y2:He,routeY:Le,onDelete:()=>C?.(L.id,D),lineStyle:p,mouseX:je,mouseY:bt});};return jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:oe,onMouseMove:oe},`dep-hover-${D}-${L.id}`)})),c.map(L=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsxRuntime.jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),k&&(()=>{let{x1:L,y1:R,x2:D,y2:G,routeY:Y,onDelete:O,lineStyle:ne,mouseX:ye,mouseY:Se}=k,fe=D-L,He=G-R,Me=L+fe/2,Le=Math.abs(He)<5,tt=Y??Math.max(R,G)+20,st=30,Ye;Le?ne==="squared"?Ye=`M ${L} ${R} L ${D} ${G}`:Ye=`M ${L} ${R} C ${Me} ${R}, ${Me} ${G}, ${D} ${G}`:ne==="squared"?Ye=`M ${L} ${R} L ${L+st} ${R} L ${L+st} ${tt} L ${D-st} ${tt} L ${D-st} ${G} L ${D} ${G}`:Ye=`M ${L} ${R} C ${L+st*2} ${R}, ${L+st*2} ${tt}, ${Me} ${tt} S ${D-st*2} ${G}, ${D} ${G}`;let z=5,oe=D-z,ie=G-z*.5,ke=D-z,Re=G+z*.5,je=t.dependency,bt="#f87171",Ee="rgba(248, 113, 113, 0.15)",vt=Me,gt=Le?(R+G)/2:tt,wt=false;ye!==void 0&&Se!==void 0&&!Le?(vt=Math.max(L+st+20,Math.min(D-st-20,ye)),gt=tt):ye!==void 0&&Le&&(vt=Math.max(L+20,Math.min(D-20,ye)),gt=(R+G)/2);let it=Math.floor(gt/a);if(it>=0&&it<_.length){let Lt=_[it];if(Lt&&Lt.startDate&&Lt.endDate){let ee=Q(Lt),se=it*a+12,ra=se+32,de=ee.x-15,S=ee.x+ee.width+50;vt>=de&&vt<=S&&gt>=se-5&&gt<=ra+5&&(wt=true);}}return jsxRuntime.jsxs("g",{onMouseLeave:()=>v(null),onMouseMove:Lt=>{let ee=Lt.currentTarget.ownerSVGElement||Lt.currentTarget;if(!ee)return;let se=ee.getBoundingClientRect(),ra=Lt.clientX-se.left,de=Lt.clientY-se.top;v(S=>S?{...S,mouseX:ra,mouseY:de}:null);},children:[jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:je,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Ye,fill:"none",stroke:je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${D} ${G} L ${oe} ${ie} M ${D} ${G} L ${ke} ${Re}`,fill:"none",stroke:je,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:D,cy:G,r:4,fill:je,opacity:.9,style:{pointerEvents:"none"}}),!wt&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Lt=>{Lt.stopPropagation(),v(null),O();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:vt,cy:gt,r:9,fill:Ee,stroke:bt,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:vt-3,y1:gt-3,x2:vt+3,y2:gt+3,stroke:bt,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:vt+3,y1:gt-3,x2:vt-3,y2:gt+3,stroke:bt,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),$e>=0&&$e<=B&&jsxRuntime.jsx("line",{x1:$e,y1:0,x2:$e,y2:Be,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),y&&jsxRuntime.jsx(mc,{tooltipData:y,theme:t})]})]})}var u0=['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"'],fc=()=>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"})]}),g0=()=>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"})}),f0=()=>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"})}),h0=()=>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"})}),b0=()=>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 In({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:m,onDependencyDelete:p}){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,k]=react.useState(true),v=react.useRef(null),E=react.useRef(null),w=react.useRef(null),{enabled:x=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:N,suggestions:U=u0,maxHistory:$=50,persistHistory:_}=a,Q=_?.storageKey||"gantt-ai-history",Te=_?.maxMessages??5;react.useEffect(()=>{if(_?.enabled)try{let R=localStorage.getItem(Q);if(R){let G=JSON.parse(R).map(Y=>({...Y,timestamp:new Date(Y.timestamp)}));C(G.slice(-Te));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[_?.enabled,Q,Te]),react.useEffect(()=>{if(_?.enabled&&h.length>0)try{let R=h.filter(D=>!D.isLoading).slice(-Te);localStorage.setItem(Q,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[h,_?.enabled,Q,Te]),react.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"});},[h]),react.useEffect(()=>{i&&!d&&v.current&&setTimeout(()=>v.current?.focus(),100);},[i,d]);let Oe=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&n?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,s,n,m,p]),et=react.useCallback(async R=>{if(!R.trim()||b)return;let D={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};C(Y=>[...Y.slice(-($-1)),D]),c(""),k(false),y(true);let G={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};C(Y=>[...Y,G]);try{if(N){let Y=await N(R,e);C(O=>{let ne=O.filter(Se=>!Se.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:Y.message,timestamp:new Date,command:Y};return [...ne,ye]}),Oe(Y);}else C(Y=>[...Y.filter(ne=>!ne.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(Y){C(O=>[...O.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Y instanceof Error?Y.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,$,N,e,Oe]),$e=R=>{R.preventDefault(),et(T);},Be=R=>{c(R),v.current?.focus();};if(react.useEffect(()=>{let R=D=>{(D.metaKey||D.ctrlKey)&&D.key==="k"&&(D.preventDefault(),u(G=>!G),i||g(false)),D.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),react.useEffect(()=>{if(!i)return;let R=G=>{let Y=G.target;w.current&&!w.current.contains(Y)&&u(false);},D=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(D),document.removeEventListener("mousedown",R);}},[i]),!x)return null;let L={"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(ft,{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 ${L[A]} 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(fc,{}),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:w,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 ${L[A]} 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(fc,{}),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(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(h0,{})}),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(f0,{})})]})]}),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:U.slice(0,4).map((R,D)=>jsxRuntime.jsx("button",{onClick:()=>Be(R),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:R.length>30?R.slice(0,30)+"...":R},D))})]}),h.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(b0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:E})]}),jsxRuntime.jsxs("form",{onSubmit:$e,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:R=>c(R.target.value),placeholder:B,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(g0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function hc(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]}});},[]),m=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}});},[]),p=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function bc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!m&&p&&n.key==="y"){n.preventDefault(),t();return}if(m&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var k0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ue.formatDate(e.startDate)} - ${ue.formatDate(e.endDate)}`);let a=ue.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=>ue.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yc(e){return {...k0,...e}}var E0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},kc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:m="comfortable",showThemeSelector:p=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:k,onTaskFilterChange:v,onThemeChange:E,onTaskClick:w,onTaskDblClick:x,onTaskContextMenu:B,onTaskUpdate:A,onProgressChange:N,onTaskEdit:U,onTaskAddSubtask:$,onTaskMarkIncomplete:_,onTaskSetInProgress:Q,onDependencyCreate:Te,onDependencyDelete:Oe,onBeforeTaskAdd:et,onAfterTaskAdd:$e,onBeforeTaskUpdate:Be,onAfterTaskUpdate:L,onBeforeTaskDelete:R,onAfterTaskDelete:D}=a,Y=react.useContext(yn)?.theme,[O,ne]=react.useState(Y||s||"dark"),[ye,Se]=react.useState(n),[fe,He]=react.useState(m),[Me,Le]=react.useState(1),[tt,st]=react.useState("all"),Ye=k??tt,z=v??st,[oe,ie]=react.useState(0),[ke,Re]=react.useState(false),[je,bt]=react.useState(null),[Ee,vt]=react.useState({isOpen:false,x:0,y:0,task:null}),[gt,wt]=react.useState(null),[it,Jt]=react.useState(null);react.useEffect(()=>{Y&&Y!==O&&ne(Y);},[Y]),react.useEffect(()=>{s&&s!==O&&ne(s);},[s]);let Lt=react.useCallback(F=>{ne(F),E?.(F);},[E]),{state:ee,setState:se,undo:ra,redo:de,canUndo:S,canRedo:X,clearHistory:he}=hc(t,50),Ae=react.useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),We=react.useRef(new Map),qe=react.useRef(false);if(!qe.current&&h){qe.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let I=localStorage.getItem(F);if(I){let j=JSON.parse(I);Array.isArray(j)&&(We.current=new Map(j));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let ze=react.useCallback(()=>{let F=Ae();if(F)try{let I=Array.from(We.current.entries());localStorage.setItem(F,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[Ae]);react.useEffect(()=>{let F=I=>I.map(j=>{let ae=We.current.get(j.id),me=ae!==void 0?{...j,isExpanded:ae}:j;return me.subtasks?.length?{...me,subtasks:F(me.subtasks)}:me});We.current.size>0?se(F(t)):se(t);},[t,se]);let nt=react.useRef(t),pt=react.useRef(true);react.useEffect(()=>{if(pt.current){pt.current=false,nt.current=ee;return}if(!r)return;let F=JSON.stringify(nt.current),I=JSON.stringify(ee);F!==I&&(nt.current=ee,r(ee));},[ee,r]);let V=react.useMemo(()=>ei(T,c),[T,c]),te=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}],[]),[De,Xe]=react.useState(()=>te(V));react.useEffect(()=>{Xe(F=>F.map(I=>({...I,label:V.columns[I.id==="name"?"taskName":I.id]||I.label})));},[V]);let Ge=react.useMemo(()=>De.filter(I=>I.visible).reduce((I,j)=>I+j.width,0),[De]),W=react.useRef(De.filter(F=>F.visible).map(F=>F.id).join(","));react.useEffect(()=>{let F=De.filter(ae=>ae.visible),I=F.map(ae=>ae.id).join(","),j=W.current;if(I!==j){let ae=F.some(Ce=>Ce.id!=="name"),me=j.includes(",");ae?!me&&ae&&bt(null):bt(null),W.current=I;}},[De]);let le=60,Ie=.6,At=react.useMemo(()=>{let I=Ge+le,j=typeof window<"u"?window.innerWidth*Ie:800,ae=Math.max(I,j);return je!==null?Math.max(200,Math.min(je,ae)):Math.max(200,I)},[je,Ge]),at=react.useRef(null),xa=react.useRef(null),fa=react.useRef(null),P=react.useMemo(()=>Ud(O),[O]),be=react.useMemo(()=>({theme:P,themeName:O}),[P,O]),J=react.useMemo(()=>yc(d),[d]),Pe=react.useMemo(()=>{if(!g)return ee;let F=ue.calculateCriticalPath(ee),I=j=>j.map(ae=>({...ae,isCriticalPath:F.includes(ae.id),subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(ee)},[ee,g]),lt=react.useMemo(()=>{if(Ye==="all")return Pe;let F=I=>{let j=[];for(let ae of I){let me=ae.subtasks?.length?F(ae.subtasks):void 0,Ce=false;switch(Ye){case "incomplete":Ce=ae.progress<100;break;case "in_progress":Ce=ae.progress>0&&ae.progress<100;break;case "completed":Ce=ae.progress===100;break}(Ce||me&&me.length>0)&&j.push({...ae,subtasks:me});}return j};return F(Pe)},[Pe,Ye]),re=E0(fe);bc({undo:ra,redo:de,canUndo:S,canRedo:X,enabled:true}),react.useImperativeHandle(o,()=>({getTask:F=>ue.findTaskById(ee,F),addTask:(F,I)=>{se(j=>{if(!I)return [...j,{...F,level:0}];let ae=me=>me.map(Ce=>Ce.id===I?{...Ce,subtasks:[...Ce.subtasks||[],{...F,parentId:I,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:ae(Ce.subtasks)}:Ce);return ae(j)});},updateTask:(F,I)=>{se(j=>{let ae=me=>me.map(Ce=>Ce.id===F?{...Ce,...I}:Ce.subtasks?{...Ce,subtasks:ae(Ce.subtasks)}:Ce);return ae(j)});},deleteTask:F=>{se(I=>{let j=ae=>ae.filter(me=>me.id===F?false:(me.subtasks&&(me.subtasks=j(me.subtasks)),true));return j(I)});},deleteTasks:F=>{se(I=>ci(I,F));},duplicateTask:F=>{se(I=>pi(I,[F]));},splitTask:(F,I,j=3)=>{se(ae=>ue.splitTask(ae,F,I,j));},calculateEndDate:ue.calculateEndDate,calculateDuration:ue.calculateDuration,validateDependency:(F,I)=>!ue.validateDependencies(ee,F,I),getAllTasks:()=>ue.flattenTasks(ee),getTasksByStatus:F=>ue.flattenTasks(ee).filter(I=>I.status===F),getTasksByParent:F=>F?ue.findTaskById(ee,F)?.subtasks||[]:ee.filter(j=>!j.parentId),getCriticalPath:()=>ue.flattenTasks(ee).filter(F=>F.isCriticalPath),indentTask:F=>{se(I=>ii(I,[F]));},outdentTask:F=>{se(I=>li(I,[F]));},moveTask:(F,I)=>{se(j=>di(j,[F],I));},createSubtask:async F=>{let{tasks:I,newTask:j}=gi(ee,F);if(et){let ae=et({...j,parentId:F});if((ae instanceof Promise?await ae:ae)===false)return}se(I),$e&&$e({...j,parentId:F});},scrollToTask:F=>{let j=ue.flattenTasks(ee).findIndex(ae=>ae.id===F);if(j!==-1&&at.current){let ae=j*re;at.current.scrollTo({top:ae,behavior:"smooth"}),xa.current&&xa.current.scrollTo({top:ae,behavior:"smooth"});}},highlightTask:(F,I=2e3)=>{},expandTask:F=>{se(I=>{let j=ae=>ae.map(me=>me.id===F?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},collapseTask:F=>{se(I=>{let j=ae=>ae.map(me=>me.id===F?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(I)});},expandAll:()=>{se(F=>{let I=j=>j.map(ae=>({...ae,isExpanded:true,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},collapseAll:()=>{se(F=>{let I=j=>j.map(ae=>({...ae,isExpanded:false,subtasks:ae.subtasks?I(ae.subtasks):void 0}));return I(F)});},undo:ra,redo:de,canUndo:()=>S,canRedo:()=>X,clearHistory:he,exportToPNG:async()=>{if(!fa.current||!at.current||!xa.current)throw new Error("Gantt container not found");let F=fa.current,I=at.current.querySelector(".gantt-grid-scroll"),j=xa.current,ae=I?.scrollTop||0,me=j.scrollTop,Ce=F.style.overflow,Ct=F.style.height;try{let ea=I?.querySelector(".gantt-taskgrid-content"),ka=j.querySelector("svg"),wa=ea?.scrollHeight||I?.scrollHeight||600,Aa=ka?.getBoundingClientRect().height||j.scrollHeight,Br=(F.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(wa,Aa)+20;I&&(I.scrollTop=0),j.scrollTop=0,F.style.overflow="visible",F.style.height=`${Br}px`,await new Promise(kr=>setTimeout(kr,100));let xr=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:kr=>{let ro=window.getComputedStyle(kr),Rr=parseInt(ro.zIndex,10);return !isNaN(Rr)&&Rr>=50||ro.position==="fixed"}});return new Promise((kr,ro)=>{xr.toBlob(Rr=>{Rr?kr(Rr):ro(new Error("Failed to create blob from canvas"));},"image/png");})}finally{F.style.overflow=Ce,F.style.height=Ct,I&&(I.scrollTop=ae),j.scrollTop=me;}},exportToPDF:async F=>{await ue.exportToPDF(ee,F);},exportToExcel:async F=>{await ue.exportToExcel(ee,F);},exportToJSON:()=>ue.exportToJSON(ee),exportToCSV:()=>ue.exportToCSV(ee),importFromJSON:F=>{let I=ue.importFromJSON(F);se(I);},getTasks:()=>ee,refresh:()=>{se(F=>[...F]);},clearAll:()=>{se([]);}}),[ee,ra,de,S,X,he,P,re]);let Ue=react.useCallback(F=>{Xe(I=>I.map(j=>j.id===F?{...j,visible:!j.visible}:j));},[]),St=react.useCallback((F,I)=>{Xe(j=>j.map(ae=>{if(ae.id!==F)return ae;let me=ae.minWidth??100,Ce=ae.maxWidth??800,Ct=Math.max(me,Math.min(Ce,I));return {...ae,width:Ct}}));},[]),Fe=react.useCallback(F=>{se(I=>{let j=ui(I,F),ae=me=>{for(let Ce of me){if(Ce.id===F){We.current.set(F,Ce.isExpanded??true);return}Ce.subtasks?.length&&ae(Ce.subtasks);}};return ae(j),ze(),j}),a.onTaskToggleExpand?.(F);},[a,ze]),Bt=react.useCallback((F,I)=>{if(Be&&Be(F,I)===false)return;let ae=ue.findTaskById(ee,F)?.progress,me=Ct=>Ct.map(ea=>ea.id===F?{...ea,...I}:ea.subtasks?{...ea,subtasks:me(ea.subtasks)}:ea);se(me(ee));let Ce=ue.findTaskById(me(ee),F);Ce&&(A?.(Ce),L?.(Ce),I.progress!==void 0&&ae!==void 0&&I.progress!==ae&&N?.(F,ae,I.progress));},[ee,A,Be,L,N]),mt=react.useCallback(F=>{F.length!==0&&(se(I=>ii(I,F)),a.onTaskIndent?.(F[0]));},[a]),ha=react.useCallback(F=>{F.length!==0&&(se(I=>li(I,F)),a.onTaskOutdent?.(F[0]));},[a]),Wt=react.useCallback((F,I,j)=>{se(ae=>oc(ae,F,I,j)),a.onTaskReparent?.(F,I,j);},[a]),Ke=react.useCallback((F,I)=>{F.length!==0&&(se(j=>di(j,F,I)),a.onTaskMove?.(F[0],I));},[a]),Et=react.useCallback(async F=>{let I=[];for(let j of F)R&&await Promise.resolve(R(j))===false||I.push(j);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(se(j=>ci(j,I)),I.forEach(j=>a.onTaskDelete?.(j))),D&&I.forEach(j=>D(j)));},[a,R,D]),ca=react.useCallback(F=>{se(I=>pi(I,F)),F.forEach(I=>a.onTaskDuplicate?.(I));},[a]),yr=react.useCallback((F,I)=>{se(j=>{let{tasks:ae,newTask:me}=rc(j,F,I);return et&&et(me)===false?j:(a.onTaskCreate?.(me.parentId,me.position||0),$e?.(me),ae)});},[a,et,$e]),Up=react.useCallback((F,I)=>{se(j=>mi(j,F,I)),a.onTaskRename?.(F,I);},[a]),Zn=react.useCallback(F=>{se(I=>{let{tasks:j}=gi(I,F);return a.onTaskCreate?.(F,0),j});},[a]),Hp=react.useCallback((F,I,j)=>{let ae=F.startDate?Math.round((I.getTime()-F.startDate.getTime())/864e5):0,me=ea=>ea.map(ka=>ka.id===F.id?{...ka,startDate:I,endDate:j,...F.segments&&{segments:F.segments}}:ka.subtasks?{...ka,subtasks:me(ka.subtasks)}:ka),Ce=me(ee);Ce=ue.autoScheduleDependents(Ce,F.id,ae),se(Ce);let Ct={...F,startDate:I,endDate:j};A?.(Ct);},[ee,A]),Wp=react.useCallback((F,I)=>{B?.(F,I),vt({isOpen:true,x:I.clientX,y:I.clientY,task:F});},[B]),Gp=react.useCallback((F,I)=>{let j=ue.splitTask(ee,F.id,I);se(j),vt({isOpen:false,x:0,y:0,task:null});},[ee]),hl=react.useCallback(F=>{let I=ue.findTaskById(ee,F.id)||F;x?.(I),U||wt(I);},[ee,x,U]),bl=react.useCallback((F,I,j)=>{let ae=new Map,me=wa=>{wa.forEach(Aa=>{Aa.dependencies&&ae.set(Aa.id,Aa.dependencies),Aa.subtasks&&me(Aa.subtasks);});};me(j);let Ce=ae.get(I)||[];ae.set(I,[...Ce,F]);let Ct=new Set,ea=new Set,ka=wa=>{if(!Ct.has(wa)){Ct.add(wa),ea.add(wa);let Aa=ae.get(wa)||[];for(let vr of Aa){if(!Ct.has(vr)&&ka(vr))return true;if(ea.has(vr))return true}}return ea.delete(wa),false};return ka(I)},[]),yl=react.useCallback((F,I)=>{if(bl(F.id,I,ee)){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 j=ae=>ae.map(me=>{if(me.id===I){let Ce=me.dependencies||[];if(!Ce.includes(F.id))return {...me,dependencies:[...Ce,F.id]}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});se(j(ee)),Te?.(F.id,I);},[ee,Te,bl]),vl=react.useCallback((F,I)=>{let j=ae=>ae.map(me=>{if(me.id===F&&me.dependencies){let Ce=me.dependencies.filter(Ct=>Ct!==I);return {...me,dependencies:Ce}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});se(j(ee)),Oe?.(F,I);},[ee,Oe]),{startDate:_p,endDate:Vp}=react.useMemo(()=>{let F=ee.filter(Ce=>Ce.startDate&&Ce.endDate);if(F.length===0){let Ce=new Date,Ct=new Date(Ce);Ct.setDate(Ct.getDate()-30);let ea=new Date(Ce);return ea.setDate(ea.getDate()+60),{startDate:Ct,endDate:ea}}let I=F.flatMap(Ce=>[Ce.startDate,Ce.endDate]).filter(Ce=>Ce!==void 0),j=new Date(Math.min(...I.map(Ce=>Ce.getTime()))),ae=new Date(Math.max(...I.map(Ce=>Ce.getTime()))),me=ye==="day"?7:ye==="week"?14:30;return j.setDate(j.getDate()-me),ae.setDate(ae.getDate()+me),{startDate:j,endDate:ae}},[ee,ye]),jp=react.useCallback(async()=>{if(!fa.current||!at.current||!xa.current)return;await new Promise(Br=>setTimeout(Br,200));let F=fa.current,I=at.current.querySelector(".gantt-grid-scroll"),j=xa.current,ae=I?.scrollTop||0,me=I?.scrollLeft||0,Ce=j.scrollTop,Ct=j.scrollLeft,ea=F.style.overflow,ka=F.style.height,wa=I?.style.overflow||"",Aa=j.style.overflow,vr=F.style.width,Jo=j.style.width;try{let Br=I?.querySelector(".gantt-taskgrid-content"),xr=j.querySelector("svg"),kr=xr?.getAttribute("height")?parseInt(xr.getAttribute("height"),10):xr?.getBoundingClientRect().height||0,ro=Br?.scrollHeight||I?.scrollHeight||600,Rr=Math.max(kr,j.scrollHeight),xl=xr?.getAttribute("width")?parseInt(xr.getAttribute("width"),10):xr?.getBoundingClientRect().width||j.scrollWidth,Qp=F.querySelector('[class*="h-12"]')?.offsetHeight||48,Qn=Math.max(ro,Rr,kr),es=Qp+Qn+50,ts=(I?.offsetWidth||300)+xl+10;I&&(I.scrollTop=0,I.scrollLeft=0),j.scrollTop=0,j.scrollLeft=0,F.style.overflow="visible",F.style.height=`${es}px`,F.style.width=`${ts}px`,I&&(I.style.overflow="visible",I.style.height=`${Qn+50}px`),j.style.overflow="visible",j.style.height=`${Qn+50}px`,j.style.width=`${xl+10}px`,await new Promise(rs=>setTimeout(rs,150));let em=await xc__default.default(F,{backgroundColor:P.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ts,height:es,windowWidth:ts+100,windowHeight:es+100,scrollX:0,scrollY:0,ignoreElements:rs=>{let kl=window.getComputedStyle(rs),wl=parseInt(kl.zIndex,10);return !isNaN(wl)&&wl>=50||kl.position==="fixed"}}),as=document.createElement("a");as.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,as.href=em.toDataURL("image/png"),as.click();}finally{F.style.overflow=ea,F.style.height=ka,F.style.width=vr,I&&(I.style.overflow=wa,I.style.height="",I.scrollTop=ae,I.scrollLeft=me),j.style.overflow=Aa,j.style.height="",j.style.width=Jo,j.scrollTop=Ce,j.scrollLeft=Ct;}},[P]),Kp=react.useCallback(async()=>{await ue.exportToPDF(ee);},[ee]),Yp=react.useCallback(async()=>{await ue.exportToExcel(ee);},[ee]),qp=react.useCallback(()=>{let F=ue.exportToCSV(ee),I=new Blob([F],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[ee]),Xp=react.useCallback(()=>{let F=ue.exportToJSON(ee),I=new Blob([F],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(I),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[ee]),Jp=react.useCallback(()=>{ue.exportToMSProject(ee,"Gantt Project","project.xml");},[ee]),Zp=F=>{F.preventDefault(),Re(true);},ao=react.useRef(false);return react.useEffect(()=>{let F=xa.current,I=at.current?.querySelector(".gantt-grid-scroll");if(!F||!I)return;let j=()=>{if(ao.current)return;ao.current=true;let Ct=F.scrollTop;ie(Ct),I.scrollTop=Ct,requestAnimationFrame(()=>{ao.current=false;});},ae=()=>{if(ao.current)return;ao.current=true;let Ct=I.scrollTop;ie(Ct),F.scrollTop=Ct,requestAnimationFrame(()=>{ao.current=false;});},me=Ct=>{if(ke&&I){let ka=I.parentElement?.getBoundingClientRect()?.left||0,wa=Ct.clientX-ka,Aa=200,vr=Ge+le,Jo=window.innerWidth*Ie,Br=Math.max(vr,Jo);wa>=Aa&&wa<=Br&&bt(wa);}},Ce=()=>{Re(false);};return F.addEventListener("scroll",j),I.addEventListener("scroll",ae),document.addEventListener("mousemove",me),document.addEventListener("mouseup",Ce),()=>{F.removeEventListener("scroll",j),I.removeEventListener("scroll",ae),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Ce);}},[ke,Ge]),jsxRuntime.jsx(ho.Provider,{value:V,children:jsxRuntime.jsx(ls.Provider,{value:be,children:jsxRuntime.jsxs("div",{ref:fa,className:"flex flex-col h-full w-full",style:{backgroundColor:P.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(kn,{theme:P,timeScale:ye,onTimeScaleChange:Se,zoom:Me,onZoomChange:Le,currentTheme:O,onThemeChange:Lt,rowDensity:fe,onRowDensityChange:He,showThemeSelector:p,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:l,taskFilter:Ye,onTaskFilterChange:z,onExportPNG:i?jp:void 0,onExportPDF:i?Kp:void 0,onExportExcel:i?Yp:void 0,onExportCSV:i?qp:void 0,onExportJSON:i?Xp:void 0,onExportMSProject:i?Jp:void 0}),jsxRuntime.jsxs("div",{ref:at,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:At,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(Nn,{tasks:lt,theme:P,rowHeight:re,availableUsers:u,templates:J,onTaskClick:w,onTaskDblClick:hl,onTaskContextMenu:B,onTaskToggle:Fe,scrollTop:oe,columns:De,onToggleColumn:Ue,onColumnResize:St,onTaskUpdate:Bt,onTaskIndent:mt,onTaskOutdent:ha,onTaskMove:Ke,onMultiTaskDelete:Et,onTaskDuplicate:ca,onTaskCreate:yr,onTaskRename:Up,onCreateSubtask:Zn,onOpenTaskModal:w?F=>w(F):void 0,onDeleteRequest:(F,I)=>Jt({taskId:F,taskName:I}),onTaskReparent:Wt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:P.border,zIndex:15},onMouseDown:Zp}),jsxRuntime.jsx("div",{ref:xa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ln,{tasks:lt,theme:P,rowHeight:re,timeScale:ye,startDate:_p,endDate:Vp,zoom:Me,templates:J,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:w,onTaskDblClick:hl,onTaskContextMenu:Wp,onTaskDateChange:Hp,onDependencyCreate:yl,onDependencyDelete:vl})})]}),Ee.task&&jsxRuntime.jsx(yo,{isOpen:Ee.isOpen,x:Ee.x,y:Ee.y,theme:P,onClose:()=>vt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Ee.task;if(!F)return [];let I=ue.findTaskById(ee,F.id)||F;return I.subtasks&&I.subtasks.length>0?[{id:"addSubtask",label:V.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{$?$(I):Zn(I.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:V.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{Jt({taskId:I.id,taskName:I.name});}}]:[{id:"edit",label:V.contextMenu?.editTask||"Edit Task",icon:Ut.Pencil,onClick:()=>{U?U(I):wt(I);}},{id:"addSubtask",label:V.contextMenu?.addSubtask||"Add Subtask",icon:Ut.Add,onClick:()=>{$?$(I):Zn(I.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:V.contextMenu?.markIncomplete||"Mark Incomplete",icon:Ut.MarkIncomplete,onClick:()=>{_?_(I):Bt(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"},{id:"setInProgress",label:V.contextMenu?.setInProgress||"Set In Progress",icon:Ut.SetInProgress,onClick:()=>{Q?Q(I):Bt(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"},{id:"markComplete",label:V.contextMenu?.markComplete||"Mark Complete",icon:Ut.MarkComplete,onClick:()=>{Bt(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:V.contextMenu?.splitTask||"Split Task",icon:Ut.Split,onClick:()=>{if(!I.startDate||!I.endDate){console.warn("Cannot split task without dates");return}let ae=I.startDate.getTime(),me=I.endDate.getTime(),Ce=ae+(me-ae)/2,Ct=new Date(Ce);Gp(I,Ct);},disabled:!I.startDate||!I.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:V.contextMenu?.deleteTask||"Delete Task",icon:Ut.Delete,onClick:()=>{Jt({taskId:I.id,taskName:I.name});}}]})()}),jsxRuntime.jsx(Gr,{task:gt,isOpen:!!gt,onClose:()=>wt(null),onTaskUpdate:F=>{gt&&(Bt(gt.id,F),wt(null));},theme:O==="light"?"light":"dark",locale:T==="es"?"es":"en",availableUsers:u,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:it&&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:P.bgSecondary,border:`1px solid ${P.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${P.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:P.textPrimary,fontFamily:"Inter, sans-serif"},children:[V.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:P.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:P.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:P.textPrimary},children:['"',it.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:P.bgPrimary,borderTop:`1px solid ${P.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Jt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:P.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=P.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:T==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Et([it.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(In,{tasks:ee,theme:P,config:C,onTasksUpdate:se,onTaskUpdate:Bt,onTaskCreate:F=>{se(I=>[...I,F]);},onTaskDelete:F=>{Et([F]);},onDependencyCreate:(F,I)=>{let j=ue.findTaskById(ee,F);j&&yl(j,I);},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 Tc({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:m=a?"edit":"create",theme:p="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:d,attachments:g=[],onUploadAttachments:h,onDeleteAttachment:C}){let T=[...ki,...i.filter(z=>!ki.some(oe=>oe.id===z.id))],c=Je[p]||Je.dark,[b,y]=react.useState(false),[l,k]=react.useState(false),[v,E]=react.useState(false),[w,x]=react.useState(false),[B,A]=react.useState({top:0,left:0}),[N,U]=react.useState(null),[$,_]=react.useState(new Date),[Q,Te]=react.useState({top:0,left:0}),[Oe,et]=react.useState(false),[$e,Be]=react.useState([]),L=react.useRef(null),R=react.useRef(null),D=react.useRef(null),G=react.useRef(null),Y=react.useRef(null),[O,ne]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[ye,Se]=react.useState({});react.useEffect(()=>{a?(ne({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)&&et(true)):(ne({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),et(false),Be([]));},[a,e]),react.useEffect(()=>{let z=oe=>{L.current&&!L.current.contains(oe.target)&&y(false),R.current&&!R.current.contains(oe.target)&&k(false),D.current&&!D.current.contains(oe.target)&&E(false),G.current&&!G.current.contains(oe.target)&&x(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let fe=()=>{let z={};return O.name.trim()||(z.name="El nombre es requerido"),O.startDate&&O.endDate&&O.startDate>O.endDate&&(z.endDate="La fecha de fin debe ser posterior a la de inicio"),Se(z),Object.keys(z).length===0},He=async z=>{if(z.preventDefault(),!!fe())try{let oe=m==="create"&&$e.length>0?{...O,pendingFiles:$e}:O;await s(oe),Be([]),t();}catch(oe){console.error("Error submitting task:",oe);}},Me=(z,oe)=>{ne(ie=>{let ke={...ie,[z]:oe};if(z==="status"){let Re=oe;Re==="todo"?ke.progress=0:Re==="in-progress"?(ie.progress===0||ie.progress===100)&&(ke.progress=50):Re==="completed"||Re==="closed"?ke.progress=100:(Re==="in-review"||Re==="review")&&(ke.progress=75);}if(z==="progress"){let Re=typeof oe=="number"?oe:parseInt(oe,10);Re===100&&ie.status!=="completed"?ke.status="completed":Re>0&&Re<100&&ie.status==="todo"?ke.status="in-progress":Re===0&&ie.status!=="todo"&&(ke.status="todo");}return ke}),ye[z]&&Se(ie=>{let ke={...ie};return delete ke[z],ke});},Le=T.find(z=>z.id===O.status)??ki[0],tt=wi.find(z=>z.id===O.priority)??wi[1],st=sr.find(z=>z.value===O.color)??sr[0],Ye={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":p,style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.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:Le.color||c.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=c.hoverBg,z.currentTarget.style.color=c.textPrimary;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent",z.currentTarget.style.color=c.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:He,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:O.name,onChange:z=>Me("name",z.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}),ye.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"}),ye.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:O.description||"",onChange:z=>Me("description",z.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:L,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:{...Ye,borderColor:Le.color,backgroundColor:`${Le.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Le.color}}),jsxRuntime.jsx("span",{style:{color:Le.color},children:Le.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Le.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(z=>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:oe=>oe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{Me("status",z.id),y(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:z.color}}),z.title,O.status===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),jsxRuntime.jsxs("div",{ref:R,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:tt.color}}),jsxRuntime.jsx("span",{children:tt.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(z=>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:oe=>oe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{Me("priority",z.id),k(false);},children:[jsxRuntime.jsx("span",{children:z.icon}),z.label,O.priority===z.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},z.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:D,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&E(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[O.assignees&&O.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,3).map((z,oe)=>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:z.color||c.accent,borderColor:c.bgSecondary},children:z.initials},oe))}),O.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:c.textTertiary},children:["+",O.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(z=>{let oe=O.assignees?.some(ie=>ie.name===z.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:ie=>ie.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ie=oe?(O.assignees||[]).filter(ke=>ke.name!==z.name):[...O.assignees||[],{name:z.name,avatar:z.avatar,initials:z.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:c.accent}];Me("assignees",ie);},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:z.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:z.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},z.id)})})})]}),jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(w)x(false);else {if(G.current){let z=G.current.getBoundingClientRect(),oe=window.innerHeight,ie=120,Re=oe-z.bottom<ie?z.top-ie-8:z.bottom+8;A({top:Re,left:z.left});}x(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ye,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:O.color}}),jsxRuntime.jsx("span",{children:st.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>x(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:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:z=>z.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(z=>{let oe=O.color===z.value;return jsxRuntime.jsx("button",{type:"button",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),Me("color",z.value),x(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:z.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:z.value,outline:oe?`2px solid ${z.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},z.value)})})})})]})})]}),u.length>0||d?jsxRuntime.jsx(nr,{selectedTags:O.tags||[],availableTags:u,onChange:z=>Me("tags",z),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:Y,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!O.isMilestone)if(N==="start")U(null);else {if(Y.current){let z=Y.current.getBoundingClientRect(),oe=window.innerHeight,ie=320,Re=oe-z.bottom<ie?z.top-ie-8:z.bottom+8;Te({top:Re,left:z.left});}U("start"),_(O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:n||O.isMilestone,children:O.startDate?O.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&&!O.isMilestone)if(N==="end")U(null);else {if(Y.current){let z=Y.current.getBoundingClientRect(),oe=window.innerHeight,ie=320,Re=oe-z.bottom<ie?z.top-ie-8:z.bottom+8;Te({top:Re,left:z.left});}U("end"),_(O.endDate||O.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ye,opacity:O.isMilestone?.5:1,cursor:O.isMilestone?"not-allowed":"pointer"},disabled:n||O.isMilestone,children:O.endDate?O.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:N&&jsxRuntime.jsxs(ft,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${Q.top}px`,left:`${Q.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:z=>z.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let z=new Date,oe=new Date(z);oe.setDate(z.getDate()+1);let ie=new Date(z);ie.setDate(z.getDate()+7);let ke=new Date(z);return ke.setDate(z.getDate()+14),[{label:"Hoy",date:z},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:ie},{label:"2 semanas",date:ke}].map((je,bt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",onClick:()=>{N==="start"?(Me("startDate",je.date),(!O.endDate||je.date>O.endDate)&&Me("endDate",je.date),U("end")):(Me("endDate",je.date),(!O.startDate||je.date<O.startDate)&&Me("startDate",je.date),U(null));},children:je.label},bt))})(),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:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.currentTarget.style.backgroundColor="transparent",onClick:()=>{Me("startDate",void 0),Me("endDate",void 0),U(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:()=>_(new Date($.getFullYear(),$.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:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>_(new Date($.getFullYear(),$.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((z,oe)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:z},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let z=$.getFullYear(),oe=$.getMonth(),ie=new Date(z,oe,1).getDay(),ke=new Date(z,oe+1,0).getDate(),Re=new Date,je=[];for(let Ee=ie-1;Ee>=0;Ee--)je.push({day:new Date(z,oe,-Ee).getDate(),date:new Date(z,oe-1,new Date(z,oe,-Ee).getDate()),isCurrentMonth:false});for(let Ee=1;Ee<=ke;Ee++)je.push({day:Ee,date:new Date(z,oe,Ee),isCurrentMonth:true});let bt=42-je.length;for(let Ee=1;Ee<=bt;Ee++)je.push({day:Ee,date:new Date(z,oe+1,Ee),isCurrentMonth:false});return je.map((Ee,vt)=>{let gt=Ee.date.toDateString()===Re.toDateString(),wt=O.startDate?.toDateString()===Ee.date.toDateString(),it=O.endDate?.toDateString()===Ee.date.toDateString(),Jt=O.startDate&&O.endDate&&Ee.date>=O.startDate&&Ee.date<=O.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:Ee.isCurrentMonth?wt||it?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:wt?"#3B82F6":it?"#7C3AED":Jt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:gt&&!wt&&!it?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{N==="start"?(Me("startDate",Ee.date),O.endDate&&Ee.date>O.endDate&&Me("endDate",Ee.date),U("end")):(Me("endDate",Ee.date),O.startDate&&Ee.date<O.startDate&&Me("startDate",Ee.date),U(null));},children:Ee.day},vt)})})()})]})]})]})})]}),ye.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:ye.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:O.progress,onChange:z=>Me("progress",parseInt(z.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:O.progress<30?"#EF4444":O.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:`${O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"}20`,color:O.progress<30?"#EF4444":O.progress<70?"#F59E0B":"#10B981"},children:[O.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>et(!Oe),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 ${Oe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Oe&&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||m==="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 ",m==="create"?$e.length>0&&`(${$e.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(dr,{cardId:"pending",attachments:$e.map((z,oe)=>({id:`pending-${oe}`,cardId:"pending",name:z.name,size:z.size,type:z.type,url:URL.createObjectURL(z),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:z=>Be(oe=>[...oe,...z]),onDelete:z=>{let oe=parseInt(z.replace("pending-",""),10);Be(ie=>ie.filter((ke,Re)=>Re!==oe));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(dr,{cardId:a?.id||"new",attachments:g,onUpload:h&&a?.id?z=>h(a.id,z):void 0,onDelete:C,maxSizeMB:10,maxFiles:20}),m==="create"&&$e.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:c.textTertiary},children:[$e.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:O.isMilestone,onChange:z=>Me("isMilestone",z.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(z=>z.id!==a?.id).map(z=>{let oe=O.dependencies?.includes(z.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ie=oe?(O.dependencies||[]).filter(ke=>ke!==z.id):[...O.dependencies||[],z.id];Me("dependencies",ie);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:oe?`${c.accent}30`:c.bgPrimary,color:oe?c.accent:c.textSecondary,border:`1px solid ${oe?c.accent:c.borderLight}`},disabled:n,children:z.name},z.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:z=>z.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:z=>z.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:z=>!n&&(z.currentTarget.style.opacity="0.9"),onMouseLeave:z=>!n&&(z.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:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Nc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
345
345