@libxai/board 1.4.3 → 1.4.4

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
@@ -122,7 +122,7 @@
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxRuntime.jsxs("div",{className:u("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:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,c])=>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:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(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 Xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[m,i]=react.useState("json"),[c,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let T=o?.current||void 0,p=await $d(e,m,T);zd(p,m);},x=async T=>{let p=T.target.files?.[0];if(p){try{let h=await Wd(p),b=p.name.endsWith(".json")?"json":"csv",y=Hd(h,b);d(y),y.success&&r&&r(y,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:u("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:()=>l("export"),className:u("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:()=>l("import"),className:u("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:u("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:f,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:x,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"})]})]}),c&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((T,p)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},p))})]})]})]})]})]})}var Gb=["URGENT","HIGH","MEDIUM","LOW"],Vb=[{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"}],_b=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ji({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:g=false,groupBy:f="none",onGroupByChange:x}){let[T,p]=react.useState(true),h=react.useCallback(N=>{a({search:N.target.value});},[a]),b=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),y=react.useCallback(N=>{r({by:N.target.value});},[r]),w=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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:()=>p(!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:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.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"}),D&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,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:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Gb.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),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:y,className:"filter-bar__select filter-bar__select--sm",children:Vb.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:_b.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Zi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),c(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 l?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 Qi={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"}},el={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"}},tl={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"}},yo={dark:Qi,light:el,neutral:tl},ls="dark";var ds=react.createContext(void 0),th="asakaa-theme";function um({children:e,defaultTheme:t=ls,storageKey:a=th}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${ah(c)}`,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(([c,d])=>{let g=m.colors[c];g&&l.style.setProperty(d,g);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsxRuntime.jsx(ds.Provider,{value:n,children:e})}function Uo(){let e=react.useContext(ds);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ah(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function al({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Uo();return e?jsxRuntime.jsxs("div",{className:u("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(yo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("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 pm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var cs={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:"Filters",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",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},gm={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:"Filtros",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",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},rl={en:cs,es:gm};function fm(e){return rl[e]||rl.en}function ol(e,t){let a=fm(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 Wo=react.createContext(cs);function Xr(){return react.useContext(Wo)}function Ch({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=react.useState(false),[i,c]=react.useState(null),d=react.useRef(null),g=Xr();if(react.useEffect(()=>{let p=h=>{d.current&&!d.current.contains(h.target)&&m(false);};return l&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),!(t||a||r||o||s||n))return null;let x=[{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(p=>p.handler),T=async(p,h)=>{if(h){c(p);try{await h();}catch(b){console.error(`Export ${p} failed:`,b);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:x.map((p,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(p.id,p.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:h<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.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===p.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"})}):p.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:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Th({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 Nh({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 Dh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Xr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,c)=>{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:c<l.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:c*.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 Sh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),m=Xr();react.useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let f=T=>{l.current&&!l.current.contains(T.target)&&n(false);},x=T=>{T.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",x),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(g),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g=>{g.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(g=>{let f=t===g.value&&!r,x=()=>g.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(g.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?g.color:"text-gray-400"} flex-shrink-0`,children:x()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:g.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},g.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function us({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:x,hideCompleted:T=false,onHideCompletedChange:p,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}){let E=Xr(),k=h||b||y||w||D||N,R=[{value:"day",label:E.toolbar.day},{value:"week",label:E.toolbar.week},{value:"month",label:E.toolbar.month}],I=[{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(Nh,{options:R,value:t,onChange:C=>a(C),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(Dh,{theme:e,value:l,onChange:m}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Sh,{theme:e,value:f,onChange:x,hideCompleted:T,onHideCompletedChange:p})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&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||E.toolbar.createTask})]}),(k||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ch,{theme:e,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Th,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function ps({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(yt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Go({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,g=8,f=window.innerWidth,x=window.innerHeight,T=t,p=a;t+c+g>f&&(T=t-c,T<g&&(T=g)),a+d+g>x&&(p=x-d-g,p<g&&(p=g)),m({x:T,y:p});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${l.x}px`,top:`${l.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(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Rt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{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 Tm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:g=true}){let f=react.useRef(false),x=react.useCallback(y=>{f.current=y;},[]),T=react.useCallback(y=>{let w=[],D=N=>{for(let E of N)w.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(y),w},[]),p=react.useCallback(()=>{let y=T(e);for(let w of y)if(t.has(w.id))return w;return null},[e,t,T]),h=react.useCallback((y,w)=>{let D=T(e);if(D.length===0)return;let N=p();if(!N){a(D[0].id,false);return}let E=D.findIndex(I=>I.id===N.id);if(E===-1)return;let k=y==="up"?E-1:E+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,w);},[e,p,T,a]),b=react.useCallback(y=>{if(!g)return;let w=y.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){y.key==="Escape"&&(w.blur(),f.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?y.metaKey:y.ctrlKey,k=Array.from(t),R=p();if(y.key==="ArrowUp"){y.preventDefault(),h("up",y.shiftKey);return}if(y.key==="ArrowDown"){y.preventDefault(),h("down",y.shiftKey);return}if(R&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(y.preventDefault(),(y.key==="ArrowRight"&&!R.isExpanded||y.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(y.altKey&&(y.key==="ArrowUp"||y.key==="ArrowDown")){k.length>0&&(y.preventDefault(),n(k,y.key==="ArrowUp"?"up":"down"));return}if(y.key==="Tab"&&!y.shiftKey){k.length>0&&(y.preventDefault(),l(k));return}if(y.key==="Tab"&&y.shiftKey){k.length>0&&(y.preventDefault(),m(k));return}if(y.key==="Enter"&&!y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"below"));return}if(y.key==="Enter"&&y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"above"));return}if(y.key==="Enter"&&E){R&&(y.preventDefault(),d(R.id));return}if(y.key==="F2"){R&&(y.preventDefault(),i(R.id));return}if(y.key==="Delete"||y.key==="Backspace"&&E){k.length>0&&(y.preventDefault(),o(k));return}if(y.key==="d"&&E&&!y.shiftKey){k.length>0&&(y.preventDefault(),s(k));return}},[g,t,p,h,r,o,s,n,l,m,i,c,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[g,b]),{setIsEditing:x}}function Dm(){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 f=new Set(g);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let f=g.indexOf(a),x=g.indexOf(d);if(f===-1||x===-1){o(d);return}let T=Math.min(f,x),p=Math.max(f,x),h=g.slice(T,p+1);t(new Set(h)),r(d);},[a,o]),l=react.useCallback((d,g,f,x)=>{x?n(d,g):f?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(f=>{let x=new Set(f);return x.add(d),x}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Sm(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Sm(a.subtasks,t);if(r)return r}}return null}function ml(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ml(a.subtasks,t);if(r)return r}return null}function ul(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 f=[];return {tasks:d.filter(T=>{if(g.has(T.id))return f.push(T),false;if(T.subtasks){let p=n(T.subtasks,g);T.subtasks=p.tasks,f.push(...p.removed);}return true}),removed:f}},l=(d,g,f)=>d.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function pl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ml(a,r);if(!o)continue;let s=ml(a,o.id),n=(i,c,d)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===c&&f.subtasks){let x=f.subtasks.findIndex(T=>T.id===d);if(x!==-1){let[T]=f.subtasks.splice(x,1);return T}}if(f.subtasks){let x=n(f.subtasks,c,d);if(x)return x}}return null},l=(i,c,d)=>{let g=i.findIndex(f=>f.id===c);if(g!==-1)return i.splice(g+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function gl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function fl(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 gs(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function Em(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"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function bl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:bl(r.subtasks,t,a)}:r)}function hl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:hl(a.subtasks,t)}:a)}function yl(e,t){let a=c=>{for(let d of c){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,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function Pm(e,t,a,r){if(t===a)return e;let o=Sm(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,g=[...c];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function hs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:g,onTaskUpdate:f,onTaskIndent:x,onTaskOutdent:T,onTaskMove:p,onMultiTaskDelete:h,onTaskDuplicate:b,onTaskCreate:y,onTaskRename:w,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:k}){let R=react.useContext(Wo),[I,C]=react.useState(null),[W,H]=react.useState(null),[v,te]=react.useState(""),oe=react.useRef(null),[ne,A]=react.useState(null),[ke,Ie]=react.useState(0),[L,U]=react.useState(0),[S,K]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,ie]=react.useState(null),[ue,ye]=react.useState(null),[Oe,ee]=react.useState(null),Je=react.useRef(0),Me=5,rt=react.useRef(false),[ut,It]=react.useState(null),[Xe,pt]=react.useState(false),[ce,Ge]=react.useState(null),[Be,B]=react.useState(false),X=react.useRef(null);react.useEffect(()=>{function G(q){X.current&&!X.current.contains(q.target)&&B(false);}if(Be)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Be]),react.useEffect(()=>{W&&oe.current&&(oe.current.focus(),oe.current.select());},[W]),react.useEffect(()=>{if(!ne)return;let G=Ee=>{let Ye=Ee.clientX-ke,$e=L+Ye;g?.(ne,$e);},q=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,L,g]);let{selectedTaskIds:ge,handleTaskClick:Ae,isTaskSelected:Ue}=Dm(),{setIsEditing:nt}=Tm({tasks:e,selectedTaskIds:ge,onTaskSelect:(G,q)=>{let Ye=Vo(e).map($e=>$e.id);Ae(G,Ye,q||false,false);},onTaskCreate:y||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:p||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:G=>{let q=Vo(e).find(Ee=>Ee.id===G);q&&je(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:G=>{let q=Vo(e).find(Ee=>Ee.id===G);q&&N&&N(q);},enableKeyboard:true}),Pt=(G,q=0)=>{let Ee=[];for(let Ye of G)Ee.push({task:Ye,level:q}),Ye.subtasks&&Ye.subtasks.length>0&&Ye.isExpanded&&Ee.push(...Pt(Ye.subtasks,q+1));return Ee},ze=Pt(e),O=48,ae=Math.max(ze.length*a,600-O),Le=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,je=G=>{H(G.id),te(G.name),nt(true);},qe=G=>{v.trim()&&v!==e.find(q=>q.id===G)?.name&&w?.(G,v.trim()),H(null),te(""),nt(false);},j=()=>{H(null),te(""),nt(false);},$=(G,q)=>{q.stopPropagation(),D?.(G.id);},De=(G,q)=>{q.preventDefault(),Je.current=q.clientY,ie(G),rt.current=false,pt(false),It({x:q.clientX,y:q.clientY});},ht=G=>{if(!J||(Math.abs(G.clientY-Je.current)>Me&&!rt.current&&(rt.current=true,pt(true)),It({x:G.clientX,y:G.clientY}),!rt.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ye=null,$e=null;Ee.forEach(V=>{let me=V.getBoundingClientRect(),_e=V.getAttribute("data-task-row");if(_e&&_e!==J&&G.clientY>=me.top&&G.clientY<=me.bottom){Ye=_e;let Tt=G.clientY-me.top,gt=me.height;Tt<gt*.25?$e="above":Tt>gt*.75?$e="below":$e="child";}}),ye(Ye),ee($e);},le=()=>{if(rt.current&&J&&ue&&Oe){if(Oe==="child")k?.(J,ue);else if(Oe==="above"||Oe==="below"){let G=(Ye,$e,V=null)=>{for(let me of Ye){if(me.id===$e)return V;if(me.subtasks){let _e=G(me.subtasks,$e,me.id);if(_e!==void 0)return _e}}},q=G(e,ue,null),Ee=(Ye,$e)=>{let V=Ye.findIndex(me=>me.id===$e);return Oe==="below"?V+1:V};if(q===null){let Ye=Ee(e,ue);k?.(J,null,Ye);}else {let Ye=ze.find($e=>$e.task.id===q)?.task;if(Ye?.subtasks){let $e=Ee(Ye.subtasks,ue);k?.(J,q,$e);}}}}ie(null),ye(null),ee(null),It(null),rt.current=false,pt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,ue,Oe]);let He=(G,q,Ee)=>{switch(G.id){case "name":let Ye=W===q.id,$e=I===q.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[k&&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:$e?1:.3},onMouseDown:fe=>De(q.id,fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.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:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ye?jsxRuntime.jsx("input",{ref:oe,type:"text",value:v,onChange:fe=>te(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?qe(q.id):fe.key==="Escape"&&j();},onBlur:()=>qe(q.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:fe=>fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),$e&&!Ye&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:fe=>$(q,fe),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:fe=>{fe.stopPropagation(),je(q);},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 me=G.id==="startDate"?"startDate":"endDate",_e=q[me],Tt=ce?.taskId===q.id&&ce?.field===me,gt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).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:fe=>fe.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:fe=>{if(Tt)Ge(null);else {let Nt=fe.currentTarget.getBoundingClientRect();Ge({taskId:q.id,field:me,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Nt.bottom+4,left:Nt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:gt(_e)})]}),Tt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ge(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:ce?.position.top,left:ce?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,Nt=new Date(fe);Nt.setDate(fe.getDate()+1);let ot=new Date(fe);ot.setDate(fe.getDate()+7);let Or=new Date(fe);return Or.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:Nt},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:Or}].map((hr,P)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[me]:hr.date}),Ge(null);},children:hr.label},P))})(),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:fe=>fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[me]:void 0}),Ge(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:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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((fe,Nt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},Nt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=ce?.month||new Date,Nt=fe.getFullYear(),ot=fe.getMonth(),Or=new Date(Nt,ot,1).getDay(),oo=new Date(Nt,ot+1,0).getDate(),hr=new Date,P=[];for(let ve=Or-1;ve>=0;ve--)P.push({day:new Date(Nt,ot,-ve).getDate(),date:new Date(Nt,ot-1,new Date(Nt,ot,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=oo;ve++)P.push({day:ve,date:new Date(Nt,ot,ve),isCurrentMonth:true});let re=42-P.length;for(let ve=1;ve<=re;ve++)P.push({day:ve,date:new Date(Nt,ot+1,ve),isCurrentMonth:false});return P.map((ve,Ze)=>{let ra=ve.date.toDateString()===hr.toDateString(),oa=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===ve.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:ve.isCurrentMonth?oa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:oa?"#3B82F6":"transparent",boxShadow:ra&&!oa?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(q.id,{[me]:ve.date}),Ge(null);},children:ve.day},Ze)})})()})]})]})]}),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:Le(q)})});case "assignees":let Sr=r.filter(fe=>q.assignees?.some(Nt=>Nt.name===fe.name||Nt.initials===fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(uo,{assignedUsers:Sr,availableUsers:r,onChange:fe=>{let Nt=fe.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));f?.(q.id,{assignees:Nt.length>0?Nt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(ic,{status:q.status||"todo",onChange:fe=>{f?.(q.id,{status:fe,progress:fe==="completed"?100:q.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:`${q.progress}%`,backgroundColor:q.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:[q.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ba={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ra=br[q.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(co,{priority:Ra,onChange:fe=>{fe&&f?.(q.id,{priority:Ba[fe]||"medium"});}})});default:return null}},Se=G=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Re=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{D?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{E?E(G.id,G.name):h?.([G.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(G);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{D?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{f?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{f?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{f?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:R?.contextMenu?.duplicateTask||"Duplicate Task",icon:Rt.Duplicate,onClick:()=>{b?.([G.id]);}},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{E?E(G.id,G.name):h?.([G.id]);}}],de=c.filter(G=>G.visible),Ve=de.reduce((G,q)=>G+q.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ve},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}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:de.map((G,q)=>{let Ee=q===de.length-1,Ye=G.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ye?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(Ye?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:$e=>{$e.preventDefault(),K({isOpen:true,x:$e.clientX,y:$e.clientY,type:"header",columnId:G.id});},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:$e=>{$e.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:G.label,children:G.label}),G.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:$e=>{$e.preventDefault(),$e.stopPropagation(),A(G.id),Ie($e.clientX),U(G.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},G.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(ps,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!Be),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"})}),Be&&jsxRuntime.jsxs("div",{ref:X,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:G=>G.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:()=>B(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:ae},children:ze.map(({task:G,level:q},Ee)=>{let Ye=Ue(G.id),$e=ue===G.id,V=$e&&Oe==="above",me=$e&&Oe==="below",_e=$e&&Oe==="child",Tt={};return _e&&(Tt.backgroundColor=`${t.accent}15`,Tt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${J===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ye?t.accentLight:_e?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Tt},onMouseEnter:()=>C(G.id),onMouseLeave:()=>C(null),onClick:gt=>{let br=Vo(e).map(fe=>fe.id),Ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;Ae(G.id,br,Ra,gt.shiftKey),s?.(G);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(G);},onContextMenu:gt=>{gt.preventDefault(),K({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:G}),l?.(G,gt);},whileHover:{backgroundColor:Ye?t.accentLight:t.hoverBg},children:[V&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),me&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de.map((gt,Sr)=>{let br=Sr===de.length-1,Ba=gt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ba?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ba?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${I===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:He(gt,G,Ba?q:0)},`${G.id}-${gt.id}`)})]},G.id)})}),jsxRuntime.jsx(Go,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Se(S.columnId):S.type==="task"&&S.task?Re(S.task):[],onClose:()=>K({...S,isOpen:false}),theme:t}),Xe&&ut&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=ze.find(q=>q.task.id===J)?.task;return G?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:G.name})}):null})()}),document.body)]})}function Im(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[m,i]=react.useState(t),[c,d]=react.useState(null),[g,f]=react.useState(null),[x,T]=react.useState(null),[p,h]=react.useState(null),[b,y]=react.useState(0),[w,D]=react.useState(0),[N,E]=react.useState(null),[k,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:f,activeZone:x,setActiveZone:T,draggedSegmentIndex:p,setDraggedSegmentIndex:h,draggedSegmentStartX:b,setDraggedSegmentStartX:y,segmentDragOffsetX:w,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(v,te)=>{r("none"),d(null),f(null),l(v),i(te),D(0),h(null),y(0);}}}function vs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:x,onHoverChange:T}){let p=Im(t,r),h=react.useRef(null),b=react.useRef(null),y=react.useRef(null),{dragMode:w,setDragMode:D,dragOffset:N,setDragOffset:E,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:H,hoveredTaskId:v,setHoveredTaskId:te,activeZone:oe,setActiveZone:ne,draggedSegmentIndex:A,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ie,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:S,hoveredSegmentIndex:K,setHoveredSegmentIndex:J,isHovered:ie,setIsHovered:ue,isDragging:ye,isResizing:Oe,isConnecting:ee,resetDragState:Je}=p,Me=32,rt=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Be=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,X=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),ge=r<50,Ae=r<40;react.useEffect(()=>{if(T)if(ie&&!ye&&!e.segments){let le=a<100;T({task:e,x:t,y:a,width:r,height:Me,showBelow:le});}else T(null);},[ie,ye,e,t,a,r,Me,T]);let Ue=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},Pt=le=>Math.round(le/s)*s,ze=le=>{let He=Math.round(le/s),Se=new Date(n);return Se.setDate(Se.getDate()+He),Se},O=(le,He)=>{for(let Se of f){if(Se.id===e.id)continue;let Re=5;if(le>=Se.x-Re&&le<=Se.x+Se.width+Re&&He>=Se.y-Re&&He<=Se.y+Se.height+Re)return Se.id}return null},ae=react.useCallback((le,He,Se)=>{le.preventDefault(),le.stopPropagation();let Re=h.current?.ownerSVGElement;if(!Re)return;let de=Re.createSVGPoint();de.x=le.clientX,de.y=le.clientY;let Ve=de.matrixTransform(Re.getScreenCTM()?.inverse()),G=Se!==void 0?Se:t,q=He;if(!q){let Ee=Ve.x-G;le.shiftKey?(q="connect",H({x:t+r,y:a+Me/2})):le.ctrlKey||le.metaKey?q="move":le.altKey?q=Ee<r/2?"resize-start":"resize-end":Ae?Ee<r/2?q="move":q="resize-end":ge?Ee<=X/2?q="resize-start":Ee>=r-X/2?q="resize-end":q="move":Ee<=X?q="resize-start":Ee>=r-X?q="resize-end":q="move";}D(q),ue(false),ne(null),q==="move"?E(Ve.x-G):q==="connect"?H({x:t+r,y:a+Me/2}):E(0),R(G),C(r);},[t,r,a,Me]),Le=react.useCallback(le=>{let He=h.current?.ownerSVGElement;if(!He)return;let Se=He.closest(".gantt-timeline-scroll");if(!Se)return;let Re=Se.getBoundingClientRect(),de=60,Ve=15,G=0;if(le.clientX<Re.left+de){let q=Re.left+de-le.clientX;G=-Math.min(Ve,q/2);}else if(le.clientX>Re.right-de){let q=le.clientX-(Re.right-de);G=Math.min(Ve,q/2);}return G!==0&&(Se.scrollLeft+=G),G!==0},[]),je=react.useCallback(le=>{if(w==="none")return;y.current=le;let He=h.current?.ownerSVGElement;if(!He)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let de=Le(le);de&&!b.current?b.current=window.setInterval(()=>{y.current&&(Le(y.current),je(y.current));},16):!de&&b.current&&(window.clearInterval(b.current),b.current=null);}let Se=He.createSVGPoint();Se.x=le.clientX,Se.y=le.clientY;let Re=Se.matrixTransform(He.getScreenCTM()?.inverse());if(w==="connect"){H({x:Re.x,y:Re.y});let de=O(Re.x,Re.y);te(de);}else if(w==="move"){let de=Re.x-N,Ve=Pt(de);R(Ve),C(r);let G=Math.round((Ve-t)/s);if(x?.(e.id,G,true),e.segments&&e.segments.length>0&&A!==null){let q=Ve-Ie;S(q);}}else if(w==="resize-start"){let de=Re.x,Ve=Pt(de),G=t+r-Ve;G>=s&&(R(Ve),C(G));}else if(w==="resize-end"){let de=Re.x,G=Pt(de)-t;G>=s&&C(G);}},[w,t,r,s,N,e,Pt,A,Ie,O,te,H,R,C,S,x,Le]),qe=react.useCallback(()=>{if(b.current&&(window.clearInterval(b.current),b.current=null),y.current=null,w!=="none"){if(w==="connect")v&&g&&g(e,v),H(null),te(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),He,Se,Re=true;if(w==="move"){if(He=ze(k),Se=new Date(He.getTime()+le),e.segments&&e.segments.length>0&&A!==null){let de=Math.round(U/s),Ve=e.segments.map((Ye,$e)=>{if($e===A){let V=new Date(Ye.startDate),me=new Date(Ye.endDate);return V.setDate(V.getDate()+de),me.setDate(me.getDate()+de),{startDate:V,endDate:me}}return Ye}),G=Ve.flatMap(Ye=>[Ye.startDate,Ye.endDate]),q=new Date(Math.min(...G.map(Ye=>Ye.getTime()))),Ee=new Date(Math.max(...G.map(Ye=>Ye.getTime())));d?.({...e,segments:Ve},q,Ee),Je(t,r);return}}else w==="resize-start"?(He=ze(k),Se=e.endDate,He>Se&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):w==="resize-end"?(He=e.startDate,Se=ze(k+I),Se<He&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&He&&Se&&(Se.getTime()<He.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,He,Se));}x?.(e.id,0,false),Je(t,r);}},[w,k,I,e,d,v,g,t,r,s,ze,U,A,Je,x]);react.useEffect(()=>{if(w==="none")return;let le=Se=>{je(Se);},He=()=>{qe();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",He),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",He),b.current&&(window.clearInterval(b.current),b.current=null);}},[w,je,qe]);let j=ye&&!ee?k:t,$=ye&&!ee?I:r,De=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,"data-task-bar":"true",onClick:()=>!ye&&m?.(e),onDoubleClick:le=>{ye||(le.stopPropagation(),i?.(e));},onContextMenu:le=>{le.preventDefault(),c?.(e,le);},onMouseEnter:()=>!ye&&ue(true),onMouseLeave:()=>{ye||(ue(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Me,fill:"transparent",style:{pointerEvents:"all"}}),ie&&!ye&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:X,height:Me,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:le=>ae(le,"resize-start")}),jsxRuntime.jsx("rect",{x:t+X,y:a,width:r-X*2,height:Me,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r-X,y:a,width:X,height:Me,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")})]}),ie&&!ye&&Ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Me,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Me,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")}),ie&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ye&&!ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:a,width:I,height:Me,rx:rt,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:j,y:a,width:$,height:Me,rx:rt,fill:Be,"data-task-class":De,initial:{opacity:0,scale:.95},animate:{opacity:ye&&!ee?.15:e.parentId?.6:ie?.9:.8,scale:ie&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>ae(le),style:{cursor:ye?ee?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:j,y:a,width:$*(e.progress/100),height:Me,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,He)=>{let Se=(le.startDate.getTime()-n.getTime())/864e5*s,de=(le.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Se+s,Ve=ye&&w==="move"&&A===He,G=K===He,q=Ve?Se+U:Se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ye&&J(He),onMouseLeave:()=>!ye&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:q,y:a,width:de,height:Me,rx:rt,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:G?.9:.8,scale:G&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ee=>{Ee.stopPropagation(),ke(He),L(Se),ae(Ee,void 0,Se);},style:{cursor:ye?ee?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:q,y:a,width:de*(e.progress/100),height:Me,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${He}`)}),Xe&&(ut||It)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[It&&!ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Me,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Me,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$>60&&!e.segments&&(()=>{let le=l.taskLabel(e),He=typeof le=="string"?le:e.name,Se=He.length>Math.floor($/8)?`${He.substring(0,Math.floor($/8))}...`:He;return jsxRuntime.jsx("text",{x:j+12,y:a+Me/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:Se})})(),$>100&&e.progress>0&&e.progress<100&&!ye&&!e.segments&&jsxRuntime.jsxs("text",{x:j+$-12,y:a+Me/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&&$>80&&!ye&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ie||Oe)&&!ee&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-2,y:a,width:16,height:Me,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+4,y:a+8,width:3,height:Me-16,rx:1.5,fill:oe==="resize-start"||w==="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:j+$-14,y:a,width:16,height:Me,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+$-7,y:a+8,width:3,height:Me-16,rx:1.5,fill:oe==="resize-end"||w==="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:ie&&!ye&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Me/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Me/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:oe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ee&&W&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Me/2,x2:W.x,y2:W.y,stroke:v?o.statusCompleted:o.accent,strokeWidth:v?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:v?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:W.x,cy:W.y,r:v?8:6,fill:v?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),v&&jsxRuntime.jsx(framerMotion.motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(ie||ye)&&!ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:j-2,y:a-2,width:$+4,height:Me+4,rx:rt+2,fill:"none",stroke:ye?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ye?.6:.4,initial:{opacity:0},animate:{opacity:ye?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&!ye&&!e.segments&&!T&&(()=>{let Se=a<100,Re=Se?a+Me+13:a-82-13,de=Se?`M ${j+$/2-6} ${a+Me+3} L ${j+$/2} ${a+Me+13} L ${j+$/2+6} ${a+Me+3}`:`M ${j+$/2-6} ${a-13} L ${j+$/2} ${a-3} L ${j+$/2+6} ${a-13}`,Ve=Re+22,G=Re+40,q=Re+55,Ee=Re+70,Ye=Se?Re+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:j+$/2-120,y:Re,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:j+$/2,y:Ve,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:j+$/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsxRuntime.jsx("text",{x:j+$/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsxRuntime.jsx("text",{x:j+$/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:j+$/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:j+$/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:j+$/2+65,y:q,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:j+$/2-110,y:Ee,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:j+$/2-50,y:Ee,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($e=>$e.name).join(", ").substring(0,30),e.assignees.map($e=>$e.name).join(", ").length>30?"...":""]})]}),!Se&&jsxRuntime.jsx("text",{x:j+$/2,y:Ye,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":ge?"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 Om({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,g=m?s+l+d:s-c-d,f=m?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,x=g+22,T=g+40,p=g+55,h=g+70,b=g+90,y=g+105,w=g+120,D=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},E=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),H=C%60;return W===0?`${H}m`:H===0?`${W}h`:`${W}h ${H}m`},k={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};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:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:g,width:240,height:c,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:o+n/2,y:x,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:E(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.soldEffortMinutes)})]})]})]})})}function ks({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=react.useState(false),[c,d]=react.useState(null),g=r-t,f=g>0,x=Math.abs(g)<5,T=20,p=!x&&a<=e,h,b,y=a-e,w=e+y/2;if(b=w,n==="squared")if(x)h=`M ${e} ${t} L ${a} ${r}`;else if(p){let ne=e+15,A=a-T,ke=f?t+20:t-20;b=A,h=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${A} ${ke} L ${A} ${r} L ${a} ${r}`;}else b=a-T,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let D=5,N=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,E=o.dependency,k=o.dependencyHover||E,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=b,W=(t+r)/2;if(c)if(x)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(p){let oe=e+15,ne=a-T,A=f?t+20:t-20,ke=[[e,t,oe,t],[oe,t,oe,A],[oe,A,ne,A],[ne,A,ne,r],[ne,r,a,r]],Ie=1/0,L={x:C,y:W};for(let U of ke){let S=H(c.x,c.y,U[0],U[1],U[2],U[3]),K=Math.hypot(c.x-S.x,c.y-S.y);K<Ie&&(Ie=K,L=S);}C=L.x,W=L.y;}else {let oe=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],ne=1/0,A={x:C,y:W};for(let ke of oe){let Ie=H(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),L=Math.hypot(c.x-Ie.x,c.y-Ie.y);L<ne&&(ne=L,A=Ie);}C=A.x,W=A.y;}function H(oe,ne,A,ke,Ie,L){let U=Ie-A,S=L-ke,K=U*U+S*S;if(K===0)return {x:A,y:ke};let J=((oe-A)*U+(ne-ke)*S)/K;return J=Math.max(0,Math.min(1,J)),{x:A+J*U,y:ke+J*S}}let v=oe=>{let ne=oe.currentTarget.ownerSVGElement;if(!ne)return;let A=ne.getBoundingClientRect();d({x:oe.clientX-A.left,y:oe.clientY-A.top});},te=()=>{i(false),d(null);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:v,children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:v,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:h,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:E,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Cs({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var xe={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Yi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=react.useRef(null);react.useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxRuntime.jsxs("div",{className:u("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:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([i,c])=>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:c.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(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 Xi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=react.useState("export"),[m,i]=react.useState("json"),[c,d]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let T=o?.current||void 0,p=await $d(e,m,T);zd(p,m);},x=async T=>{let p=T.target.files?.[0];if(p){try{let h=await Wd(p),b=p.name.endsWith(".json")?"json":"csv",y=Hd(h,b);d(y),y.success&&r&&r(y,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:u("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:()=>l("export"),className:u("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:()=>l("import"),className:u("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:u("p-4 rounded-lg border-2 transition-all text-center",m===T?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[T==="json"&&"\u{1F4C4}",T==="csv"&&"\u{1F4CA}",T==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:T})]},T))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:f,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:x,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"})]})]}),c&&jsxRuntime.jsxs("div",{className:u("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:c.errors.map((T,p)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",T]},p))})]})]})]})]})]})}var Gb=["URGENT","HIGH","MEDIUM","LOW"],Vb=[{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"}],_b=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ji({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:g=false,groupBy:f="none",onGroupByChange:x}){let[T,p]=react.useState(true),h=react.useCallback(N=>{a({search:N.target.value});},[a]),b=react.useCallback(N=>{a({dateFilter:N.target.value});},[a]),y=react.useCallback(N=>{r({by:N.target.value});},[r]),w=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=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:()=>p(!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:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.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"}),D&&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"}),l&&jsxRuntime.jsx("button",{onClick:l,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:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,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:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Gb.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(N=>jsxRuntime.jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsxRuntime.jsx("option",{value:N,children:N},N))]})}),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:y,className:"filter-bar__select filter-bar__select--sm",children:Vb.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),x&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:N=>x(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:_b.map(N=>jsxRuntime.jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Zi({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:m}){let[i,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let f=x=>{d.current&&!d.current.contains(x.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let g=f=>{f(),c(false);};return jsxRuntime.jsxs("div",{className:u("relative",r),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>c(!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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 l?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 Qi={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"}},el={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"}},tl={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"}},yo={dark:Qi,light:el,neutral:tl},ls="dark";var ds=react.createContext(void 0),th="asakaa-theme";function um({children:e,defaultTheme:t=ls,storageKey:a=th}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=react.useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${ah(c)}`,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(([c,d])=>{let g=m.colors[c];g&&l.style.setProperty(d,g);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsxRuntime.jsx(ds.Provider,{value:n,children:e})}function Uo(){let e=react.useContext(ds);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ah(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function al({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Uo();return e?jsxRuntime.jsxs("div",{className:u("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(yo).map(([s,n])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:u("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 pm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing)}}var cs={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:"Filters",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",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",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",week:"Week",clickToSetDates:"Click to set dates..."},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"}},gm={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:"Filtros",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",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",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",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},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"}},rl={en:cs,es:gm};function fm(e){return rl[e]||rl.en}function ol(e,t){let a=fm(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 Wo=react.createContext(cs);function Xr(){return react.useContext(Wo)}function Ch({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,m]=react.useState(false),[i,c]=react.useState(null),d=react.useRef(null),g=Xr();if(react.useEffect(()=>{let p=h=>{d.current&&!d.current.contains(h.target)&&m(false);};return l&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]),!(t||a||r||o||s||n))return null;let x=[{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(p=>p.handler),T=async(p,h)=>{if(h){c(p);try{await h();}catch(b){console.error(`Export ${p} failed:`,b);}finally{c(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&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:x.map((p,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>T(p.id,p.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:h<x.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.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===p.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"})}):p.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:p.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:p.description})]})]},p.id))})})})]})}function Th({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 Nh({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 Dh({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),n=Xr();react.useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=l.find(i=>i.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:l.map((i,c)=>{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:c<l.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:c*.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 Sh({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=react.useState(false),l=react.useRef(null),m=Xr();react.useEffect(()=>{if(!s)return;let g=setTimeout(()=>{let f=T=>{l.current&&!l.current.contains(T.target)&&n(false);},x=T=>{T.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",x),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",x);};},100);return ()=>{clearTimeout(g),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g=>{g.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsxRuntime.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsxRuntime.jsx("div",{className:"py-2",children:i.map(g=>{let f=t===g.value&&!r,x=()=>g.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(g.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx("span",{className:`${f?g.color:"text-gray-400"} flex-shrink-0`,children:x()}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:g.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},g.value)})}),jsxRuntime.jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsxRuntime.jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function us({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:g,taskFilter:f="all",onTaskFilterChange:x,hideCompleted:T=false,onHideCompletedChange:p,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}){let E=Xr(),k=h||b||y||w||D||N,R=[{value:"day",label:E.toolbar.day},{value:"week",label:E.toolbar.week},{value:"month",label:E.toolbar.month}],I=[{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(Nh,{options:R,value:t,onChange:C=>a(C),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(Dh,{theme:e,value:l,onChange:m}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Sh,{theme:e,value:f,onChange:x,hideCompleted:T,onHideCompletedChange:p})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[c&&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||E.toolbar.createTask})]}),(k||i)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ch,{theme:e,onExportPNG:h,onExportPDF:b,onExportExcel:y,onExportCSV:w,onExportJSON:D,onExportMSProject:N}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Th,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function ps({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,n]=react.useState({x:0,y:0}),l=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(yt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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(c=>jsxRuntime.jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Go({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=react.useRef(null),[l,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,g=8,f=window.innerWidth,x=window.innerHeight,T=t,p=a;t+c+g>f&&(T=t-c,T<g&&(T=g)),a+d+g>x&&(p=x-d-g,p<g&&(p=g)),m({x:T,y:p});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let c=g=>{n.current&&!n.current.contains(g.target)&&o();},d=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${l.x}px`,top:`${l.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(c=>jsxRuntime.jsxs("div",{children:[c.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Rt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),Duplicate:jsxRuntime.jsx(lucideReact.Copy,{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 Tm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:g=true}){let f=react.useRef(false),x=react.useCallback(y=>{f.current=y;},[]),T=react.useCallback(y=>{let w=[],D=N=>{for(let E of N)w.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&D(E.subtasks);};return D(y),w},[]),p=react.useCallback(()=>{let y=T(e);for(let w of y)if(t.has(w.id))return w;return null},[e,t,T]),h=react.useCallback((y,w)=>{let D=T(e);if(D.length===0)return;let N=p();if(!N){a(D[0].id,false);return}let E=D.findIndex(I=>I.id===N.id);if(E===-1)return;let k=y==="up"?E-1:E+1;if(k<0||k>=D.length)return;let R=D[k];a(R.id,w);},[e,p,T,a]),b=react.useCallback(y=>{if(!g)return;let w=y.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||f.current){y.key==="Escape"&&(w.blur(),f.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?y.metaKey:y.ctrlKey,k=Array.from(t),R=p();if(y.key==="ArrowUp"){y.preventDefault(),h("up",y.shiftKey);return}if(y.key==="ArrowDown"){y.preventDefault(),h("down",y.shiftKey);return}if(R&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(y.preventDefault(),(y.key==="ArrowRight"&&!R.isExpanded||y.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(y.altKey&&(y.key==="ArrowUp"||y.key==="ArrowDown")){k.length>0&&(y.preventDefault(),n(k,y.key==="ArrowUp"?"up":"down"));return}if(y.key==="Tab"&&!y.shiftKey){k.length>0&&(y.preventDefault(),l(k));return}if(y.key==="Tab"&&y.shiftKey){k.length>0&&(y.preventDefault(),m(k));return}if(y.key==="Enter"&&!y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"below"));return}if(y.key==="Enter"&&y.shiftKey&&!E){R&&(y.preventDefault(),r(R.id,"above"));return}if(y.key==="Enter"&&E){R&&(y.preventDefault(),d(R.id));return}if(y.key==="F2"){R&&(y.preventDefault(),i(R.id));return}if(y.key==="Delete"||y.key==="Backspace"&&E){k.length>0&&(y.preventDefault(),o(k));return}if(y.key==="d"&&E&&!y.shiftKey){k.length>0&&(y.preventDefault(),s(k));return}},[g,t,p,h,r,o,s,n,l,m,i,c,d]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[g,b]),{setIsEditing:x}}function Dm(){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 f=new Set(g);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=react.useCallback((d,g)=>{if(!a){o(d);return}let f=g.indexOf(a),x=g.indexOf(d);if(f===-1||x===-1){o(d);return}let T=Math.min(f,x),p=Math.max(f,x),h=g.slice(T,p+1);t(new Set(h)),r(d);},[a,o]),l=react.useCallback((d,g,f,x)=>{x?n(d,g):f?s(d):o(d);},[o,s,n]),m=react.useCallback((d,g)=>{g?t(f=>{let x=new Set(f);return x.add(d),x}):o(d);},[o]),i=react.useCallback(()=>{t(new Set),r(null);},[]),c=react.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Vo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Sm(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Sm(a.subtasks,t);if(r)return r}}return null}function ml(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ml(a.subtasks,t);if(r)return r}return null}function ul(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 f=[];return {tasks:d.filter(T=>{if(g.has(T.id))return f.push(T),false;if(T.subtasks){let p=n(T.subtasks,g);T.subtasks=p.tasks,f.push(...p.removed);}return true}),removed:f}},l=(d,g,f)=>d.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),m=new Set(t),{tasks:i,removed:c}=n(e,m);return l(i,s.id,c)}function pl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ml(a,r);if(!o)continue;let s=ml(a,o.id),n=(i,c,d)=>{for(let g=0;g<i.length;g++){let f=i[g];if(f.id===c&&f.subtasks){let x=f.subtasks.findIndex(T=>T.id===d);if(x!==-1){let[T]=f.subtasks.splice(x,1);return T}}if(f.subtasks){let x=n(f.subtasks,c,d);if(x)return x}}return null},l=(i,c,d)=>{let g=i.findIndex(f=>f.id===c);if(g!==-1)return i.splice(g+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?l(s.subtasks,o.id,m):l(a,o.id,m));}return a}function gl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,m)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function fl(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 gs(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(c=>c.id===r);if(l===-1){for(let c of n)if(c.subtasks&&o(c.subtasks))return true;return false}let m=n[l],i={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function Em(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"},l=m=>{let i=m.findIndex(d=>d.id===t);if(i===-1){for(let d of m)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function bl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:bl(r.subtasks,t,a)}:r)}function hl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:hl(a.subtasks,t)}:a)}function yl(e,t){let a=c=>{for(let d of c){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,l=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=c=>c.map(d=>{if(d.id===t){let g=d.subtasks||[];return {...d,subtasks:[...g,m],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:m}}function Pm(e,t,a,r){if(t===a)return e;let o=Sm(e,t);if(!o)return e;if(a){let l=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>l.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,g=[...c];return g.splice(d,0,{...o,parentId:a}),{...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function hs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:g,onTaskUpdate:f,onTaskIndent:x,onTaskOutdent:T,onTaskMove:p,onMultiTaskDelete:h,onTaskDuplicate:b,onTaskCreate:y,onTaskRename:w,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:k}){let R=react.useContext(Wo),[I,C]=react.useState(null),[W,H]=react.useState(null),[v,te]=react.useState(""),oe=react.useRef(null),[ne,A]=react.useState(null),[ke,Ie]=react.useState(0),[L,U]=react.useState(0),[S,K]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[J,ie]=react.useState(null),[ue,ye]=react.useState(null),[Oe,ee]=react.useState(null),Je=react.useRef(0),Me=5,rt=react.useRef(false),[ut,It]=react.useState(null),[Xe,pt]=react.useState(false),[ce,Ge]=react.useState(null),[Be,B]=react.useState(false),X=react.useRef(null);react.useEffect(()=>{function G(q){X.current&&!X.current.contains(q.target)&&B(false);}if(Be)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Be]),react.useEffect(()=>{W&&oe.current&&(oe.current.focus(),oe.current.select());},[W]),react.useEffect(()=>{if(!ne)return;let G=Ee=>{let Ye=Ee.clientX-ke,$e=L+Ye;g?.(ne,$e);},q=()=>{A(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,ke,L,g]);let{selectedTaskIds:ge,handleTaskClick:Ae,isTaskSelected:Ue}=Dm(),{setIsEditing:nt}=Tm({tasks:e,selectedTaskIds:ge,onTaskSelect:(G,q)=>{let Ye=Vo(e).map($e=>$e.id);Ae(G,Ye,q||false,false);},onTaskCreate:y||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:p||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:T||(()=>{}),onTaskRename:G=>{let q=Vo(e).find(Ee=>Ee.id===G);q&&je(q);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:G=>{let q=Vo(e).find(Ee=>Ee.id===G);q&&N&&N(q);},enableKeyboard:true}),Pt=(G,q=0)=>{let Ee=[];for(let Ye of G)Ee.push({task:Ye,level:q}),Ye.subtasks&&Ye.subtasks.length>0&&Ye.isExpanded&&Ee.push(...Pt(Ye.subtasks,q+1));return Ee},ze=Pt(e),O=48,ae=Math.max(ze.length*a,600-O),Le=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,je=G=>{H(G.id),te(G.name),nt(true);},qe=G=>{v.trim()&&v!==e.find(q=>q.id===G)?.name&&w?.(G,v.trim()),H(null),te(""),nt(false);},j=()=>{H(null),te(""),nt(false);},$=(G,q)=>{q.stopPropagation(),D?.(G.id);},De=(G,q)=>{q.preventDefault(),Je.current=q.clientY,ie(G),rt.current=false,pt(false),It({x:q.clientX,y:q.clientY});},ht=G=>{if(!J||(Math.abs(G.clientY-Je.current)>Me&&!rt.current&&(rt.current=true,pt(true)),It({x:G.clientX,y:G.clientY}),!rt.current))return;let Ee=document.querySelectorAll("[data-task-row]"),Ye=null,$e=null;Ee.forEach(V=>{let me=V.getBoundingClientRect(),_e=V.getAttribute("data-task-row");if(_e&&_e!==J&&G.clientY>=me.top&&G.clientY<=me.bottom){Ye=_e;let Tt=G.clientY-me.top,gt=me.height;Tt<gt*.25?$e="above":Tt>gt*.75?$e="below":$e="child";}}),ye(Ye),ee($e);},le=()=>{if(rt.current&&J&&ue&&Oe){if(Oe==="child")k?.(J,ue);else if(Oe==="above"||Oe==="below"){let G=(Ye,$e,V=null)=>{for(let me of Ye){if(me.id===$e)return V;if(me.subtasks){let _e=G(me.subtasks,$e,me.id);if(_e!==void 0)return _e}}},q=G(e,ue,null),Ee=(Ye,$e)=>{let V=Ye.findIndex(me=>me.id===$e);return Oe==="below"?V+1:V};if(q===null){let Ye=Ee(e,ue);k?.(J,null,Ye);}else {let Ye=ze.find($e=>$e.task.id===q)?.task;if(Ye?.subtasks){let $e=Ee(Ye.subtasks,ue);k?.(J,q,$e);}}}}ie(null),ye(null),ee(null),It(null),rt.current=false,pt(false);};react.useEffect(()=>{if(J)return document.addEventListener("mousemove",ht),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ht),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[J,ue,Oe]);let He=(G,q,Ee)=>{switch(G.id){case "name":let Ye=W===q.id,$e=I===q.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Ee*20}px`},children:[k&&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:$e?1:.3},onMouseDown:fe=>De(q.id,fe),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),q.subtasks&&q.subtasks.length>0?jsxRuntime.jsx("button",{onClick:fe=>{fe.stopPropagation(),m?.(q.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:q.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:q.color||"#3B82F6",opacity:q.parentId?.6:1,borderColor:q.isMilestone?t.accent:"transparent",borderWidth:q.isMilestone?"2px":"0px"},title:q.isMilestone?"Milestone":q.parentId?"Subtask":"Task"})}),Ye?jsxRuntime.jsx("input",{ref:oe,type:"text",value:v,onChange:fe=>te(fe.target.value),onKeyDown:fe=>{fe.key==="Enter"?qe(q.id):fe.key==="Escape"&&j();},onBlur:()=>qe(q.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:fe=>fe.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:q.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:q.parentId?"13px":"14px",fontWeight:q.isMilestone?600:q.parentId?400:600,letterSpacing:q.parentId?"0":"-0.01em"},title:q.name,children:q.name}),$e&&!Ye&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:fe=>$(q,fe),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:fe=>{fe.stopPropagation(),je(q);},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 me=G.id==="startDate"?"startDate":"endDate",_e=q[me],Tt=ce?.taskId===q.id&&ce?.field===me,gt=fe=>fe?(typeof fe=="string"?new Date(fe):fe).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:fe=>fe.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:fe=>{if(Tt)Ge(null);else {let Nt=fe.currentTarget.getBoundingClientRect();Ge({taskId:q.id,field:me,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:Nt.bottom+4,left:Nt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:gt(_e)})]}),Tt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ge(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:ce?.position.top,left:ce?.position.left},onClick:fe=>fe.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let fe=new Date,Nt=new Date(fe);Nt.setDate(fe.getDate()+1);let ot=new Date(fe);ot.setDate(fe.getDate()+7);let Or=new Date(fe);return Or.setDate(fe.getDate()+14),[{label:"Hoy",date:fe},{label:"Ma\xF1ana",date:Nt},{label:"Pr\xF3xima semana",date:ot},{label:"2 semanas",date:Or}].map((hr,P)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[me]:hr.date}),Ge(null);},children:hr.label},P))})(),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:fe=>fe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(q.id,{[me]:void 0}),Ge(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:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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:ce?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>Ge(fe=>fe?{...fe,month:new Date(fe.month.getFullYear(),fe.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((fe,Nt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:fe},Nt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let fe=ce?.month||new Date,Nt=fe.getFullYear(),ot=fe.getMonth(),Or=new Date(Nt,ot,1).getDay(),oo=new Date(Nt,ot+1,0).getDate(),hr=new Date,P=[];for(let ve=Or-1;ve>=0;ve--)P.push({day:new Date(Nt,ot,-ve).getDate(),date:new Date(Nt,ot-1,new Date(Nt,ot,-ve).getDate()),isCurrentMonth:false});for(let ve=1;ve<=oo;ve++)P.push({day:ve,date:new Date(Nt,ot,ve),isCurrentMonth:true});let re=42-P.length;for(let ve=1;ve<=re;ve++)P.push({day:ve,date:new Date(Nt,ot+1,ve),isCurrentMonth:false});return P.map((ve,Ze)=>{let ra=ve.date.toDateString()===hr.toDateString(),oa=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===ve.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:ve.isCurrentMonth?oa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:oa?"#3B82F6":"transparent",boxShadow:ra&&!oa?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(q.id,{[me]:ve.date}),Ge(null);},children:ve.day},Ze)})})()})]})]})]}),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:Le(q)})});case "assignees":let Sr=r.filter(fe=>q.assignees?.some(Nt=>Nt.name===fe.name||Nt.initials===fe.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(uo,{assignedUsers:Sr,availableUsers:r,onChange:fe=>{let Nt=fe.map(ot=>({id:ot.id,name:ot.name,initials:ot.initials,color:ot.color}));f?.(q.id,{assignees:Nt.length>0?Nt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(ic,{status:q.status||"todo",onChange:fe=>{f?.(q.id,{status:fe,progress:fe==="completed"?100:q.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:`${q.progress}%`,backgroundColor:q.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:[q.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ba={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ra=br[q.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:fe=>fe.stopPropagation(),children:jsxRuntime.jsx(co,{priority:Ra,onChange:fe=>{fe&&f?.(q.id,{priority:Ba[fe]||"medium"});}})});default:return null}},Se=G=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Re=G=>G.subtasks&&G.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{D?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{E?E(G.id,G.name):h?.([G.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(G);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{D?.(G.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{f?.(G.id,{status:"todo",progress:0});},disabled:G.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{f?.(G.id,{status:"in-progress"});},disabled:G.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{f?.(G.id,{status:"completed",progress:100});},disabled:G.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:R?.contextMenu?.duplicateTask||"Duplicate Task",icon:Rt.Duplicate,onClick:()=>{b?.([G.id]);}},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{E?E(G.id,G.name):h?.([G.id]);}}],de=c.filter(G=>G.visible),Ve=de.reduce((G,q)=>G+q.width,0);return jsxRuntime.jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ve},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}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:de.map((G,q)=>{let Ee=q===de.length-1,Ye=G.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ye?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(Ye?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:$e=>{$e.preventDefault(),K({isOpen:true,x:$e.clientX,y:$e.clientY,type:"header",columnId:G.id});},onMouseEnter:$e=>{$e.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:$e=>{$e.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:G.label,children:G.label}),G.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:$e=>{$e.preventDefault(),$e.stopPropagation(),A(G.id),Ie($e.clientX),U(G.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},G.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(ps,{columns:c,onToggleColumn:d,theme:t}),jsxRuntime.jsx("button",{onClick:()=>B(!Be),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"})}),Be&&jsxRuntime.jsxs("div",{ref:X,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:G=>G.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:()=>B(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:ae},children:ze.map(({task:G,level:q},Ee)=>{let Ye=Ue(G.id),$e=ue===G.id,V=$e&&Oe==="above",me=$e&&Oe==="below",_e=$e&&Oe==="child",Tt={};return _e&&(Tt.backgroundColor=`${t.accent}15`,Tt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${J===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ye?t.accentLight:_e?`${t.accent}15`:Ee%2===0?t.bgPrimary:t.bgGrid,...Tt},onMouseEnter:()=>C(G.id),onMouseLeave:()=>C(null),onClick:gt=>{let br=Vo(e).map(fe=>fe.id),Ra=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;Ae(G.id,br,Ra,gt.shiftKey),s?.(G);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(G);},onContextMenu:gt=>{gt.preventDefault(),K({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:G}),l?.(G,gt);},whileHover:{backgroundColor:Ye?t.accentLight:t.hoverBg},children:[V&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),me&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),de.map((gt,Sr)=>{let br=Sr===de.length-1,Ba=gt.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Ba?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ba?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${I===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:He(gt,G,Ba?q:0)},`${G.id}-${gt.id}`)})]},G.id)})}),jsxRuntime.jsx(Go,{isOpen:S.isOpen,x:S.x,y:S.y,items:S.type==="header"&&S.columnId?Se(S.columnId):S.type==="task"&&S.task?Re(S.task):[],onClose:()=>K({...S,isOpen:false}),theme:t}),Xe&&ut&&J&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=ze.find(q=>q.task.id===J)?.task;return G?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:G.name})}):null})()}),document.body)]})}function Im(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[n,l]=react.useState(e),[m,i]=react.useState(t),[c,d]=react.useState(null),[g,f]=react.useState(null),[x,T]=react.useState(null),[p,h]=react.useState(null),[b,y]=react.useState(0),[w,D]=react.useState(0),[N,E]=react.useState(null),[k,R]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:g,setHoveredTaskId:f,activeZone:x,setActiveZone:T,draggedSegmentIndex:p,setDraggedSegmentIndex:h,draggedSegmentStartX:b,setDraggedSegmentStartX:y,segmentDragOffsetX:w,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(v,te)=>{r("none"),d(null),f(null),l(v),i(te),D(0),h(null),y(0);}}}function vs({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:x,onHoverChange:T}){let p=Im(t,r),h=react.useRef(null),b=react.useRef(null),y=react.useRef(null),{dragMode:w,setDragMode:D,dragOffset:N,setDragOffset:E,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:H,hoveredTaskId:v,setHoveredTaskId:te,activeZone:oe,setActiveZone:ne,draggedSegmentIndex:A,setDraggedSegmentIndex:ke,draggedSegmentStartX:Ie,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:S,hoveredSegmentIndex:K,setHoveredSegmentIndex:J,isHovered:ie,setIsHovered:ue,isDragging:ye,isResizing:Oe,isConnecting:ee,resetDragState:Je}=p,Me=24,rt=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,It=e.isCriticalPath,Xe=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,ce={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},Be=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&ce[e.priority]?ce[e.priority]:o.taskBarPrimary,X=(le=>le>=80?20:le>=60?15:le>=50?12:10)(r),ge=r<50,Ae=r<40;react.useEffect(()=>{if(T)if(ie&&!ye&&!e.segments){let le=a<100;T({task:e,x:t,y:a,width:r,height:Me,showBelow:le});}else T(null);},[ie,ye,e,t,a,r,Me,T]);let Ue=le=>le.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let le=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${le} day${le!==1?"s":""}`},Pt=le=>Math.round(le/s)*s,ze=le=>{let He=Math.round(le/s),Se=new Date(n);return Se.setDate(Se.getDate()+He),Se},O=(le,He)=>{for(let Se of f){if(Se.id===e.id)continue;let Re=5;if(le>=Se.x-Re&&le<=Se.x+Se.width+Re&&He>=Se.y-Re&&He<=Se.y+Se.height+Re)return Se.id}return null},ae=react.useCallback((le,He,Se)=>{le.preventDefault(),le.stopPropagation();let Re=h.current?.ownerSVGElement;if(!Re)return;let de=Re.createSVGPoint();de.x=le.clientX,de.y=le.clientY;let Ve=de.matrixTransform(Re.getScreenCTM()?.inverse()),G=Se!==void 0?Se:t,q=He;if(!q){let Ee=Ve.x-G;le.shiftKey?(q="connect",H({x:t+r,y:a+Me/2})):le.ctrlKey||le.metaKey?q="move":le.altKey?q=Ee<r/2?"resize-start":"resize-end":Ae?Ee<r/2?q="move":q="resize-end":ge?Ee<=X/2?q="resize-start":Ee>=r-X/2?q="resize-end":q="move":Ee<=X?q="resize-start":Ee>=r-X?q="resize-end":q="move";}D(q),ue(false),ne(null),q==="move"?E(Ve.x-G):q==="connect"?H({x:t+r,y:a+Me/2}):E(0),R(G),C(r);},[t,r,a,Me]),Le=react.useCallback(le=>{let He=h.current?.ownerSVGElement;if(!He)return;let Se=He.closest(".gantt-timeline-scroll");if(!Se)return;let Re=Se.getBoundingClientRect(),de=60,Ve=15,G=0;if(le.clientX<Re.left+de){let q=Re.left+de-le.clientX;G=-Math.min(Ve,q/2);}else if(le.clientX>Re.right-de){let q=le.clientX-(Re.right-de);G=Math.min(Ve,q/2);}return G!==0&&(Se.scrollLeft+=G),G!==0},[]),je=react.useCallback(le=>{if(w==="none")return;y.current=le;let He=h.current?.ownerSVGElement;if(!He)return;if(w==="move"||w==="resize-start"||w==="resize-end"){let de=Le(le);de&&!b.current?b.current=window.setInterval(()=>{y.current&&(Le(y.current),je(y.current));},16):!de&&b.current&&(window.clearInterval(b.current),b.current=null);}let Se=He.createSVGPoint();Se.x=le.clientX,Se.y=le.clientY;let Re=Se.matrixTransform(He.getScreenCTM()?.inverse());if(w==="connect"){H({x:Re.x,y:Re.y});let de=O(Re.x,Re.y);te(de);}else if(w==="move"){let de=Re.x-N,Ve=Pt(de);R(Ve),C(r);let G=Math.round((Ve-t)/s);if(x?.(e.id,G,true),e.segments&&e.segments.length>0&&A!==null){let q=Ve-Ie;S(q);}}else if(w==="resize-start"){let de=Re.x,Ve=Pt(de),G=t+r-Ve;G>=s&&(R(Ve),C(G));}else if(w==="resize-end"){let de=Re.x,G=Pt(de)-t;G>=s&&C(G);}},[w,t,r,s,N,e,Pt,A,Ie,O,te,H,R,C,S,x,Le]),qe=react.useCallback(()=>{if(b.current&&(window.clearInterval(b.current),b.current=null),y.current=null,w!=="none"){if(w==="connect")v&&g&&g(e,v),H(null),te(null);else {let le=e.endDate.getTime()-e.startDate.getTime(),He,Se,Re=true;if(w==="move"){if(He=ze(k),Se=new Date(He.getTime()+le),e.segments&&e.segments.length>0&&A!==null){let de=Math.round(U/s),Ve=e.segments.map((Ye,$e)=>{if($e===A){let V=new Date(Ye.startDate),me=new Date(Ye.endDate);return V.setDate(V.getDate()+de),me.setDate(me.getDate()+de),{startDate:V,endDate:me}}return Ye}),G=Ve.flatMap(Ye=>[Ye.startDate,Ye.endDate]),q=new Date(Math.min(...G.map(Ye=>Ye.getTime()))),Ee=new Date(Math.max(...G.map(Ye=>Ye.getTime())));d?.({...e,segments:Ve},q,Ee),Je(t,r);return}}else w==="resize-start"?(He=ze(k),Se=e.endDate,He>Se&&(console.warn("Invalid date range: start date must be before or equal to end date"),Re=false)):w==="resize-end"?(He=e.startDate,Se=ze(k+I),Se<He&&(console.warn("Invalid date range: end date must be after or equal to start date"),Re=false)):Re=false;Re&&He&&Se&&(Se.getTime()<He.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,He,Se));}x?.(e.id,0,false),Je(t,r);}},[w,k,I,e,d,v,g,t,r,s,ze,U,A,Je,x]);react.useEffect(()=>{if(w==="none")return;let le=Se=>{je(Se);},He=()=>{qe();};return window.addEventListener("mousemove",le),window.addEventListener("mouseup",He),()=>{window.removeEventListener("mousemove",le),window.removeEventListener("mouseup",He),b.current&&(window.clearInterval(b.current),b.current=null);}},[w,je,qe]);let j=ye&&!ee?k:t,$=ye&&!ee?I:r,De=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,"data-task-bar":"true",onClick:()=>!ye&&m?.(e),onDoubleClick:le=>{ye||(le.stopPropagation(),i?.(e));},onContextMenu:le=>{le.preventDefault(),c?.(e,le);},onMouseEnter:()=>!ye&&ue(true),onMouseLeave:()=>{ye||(ue(false),ne(null));},children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r+24,height:Me,fill:"transparent",style:{pointerEvents:"all"}}),ie&&!ye&&!ge&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:X,height:Me,fill:oe==="resize-start"?o.accent:"transparent",opacity:oe==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:le=>ae(le,"resize-start")}),jsxRuntime.jsx("rect",{x:t+X,y:a,width:r-X*2,height:Me,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r-X,y:a,width:X,height:Me,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")})]}),ie&&!ye&&Ae&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Me,fill:oe==="move"?o.accent:"transparent",opacity:oe==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:le=>ae(le,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Me,fill:oe==="resize-end"?o.accent:"transparent",opacity:oe==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:le=>ae(le,"resize-end")}),ie&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ye&&!ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:a,width:I,height:Me,rx:rt,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:j,y:a,width:$,height:Me,rx:rt,fill:Be,"data-task-class":De,initial:{opacity:0,scale:.95},animate:{opacity:ye&&!ee?.15:e.parentId?.6:ie?.9:.8,scale:ie&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:le=>ae(le),style:{cursor:ye?ee?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:j,y:a,width:$*(e.progress/100),height:Me,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((le,He)=>{let Se=(le.startDate.getTime()-n.getTime())/864e5*s,de=(le.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Se+s,Ve=ye&&w==="move"&&A===He,G=K===He,q=Ve?Se+U:Se;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!ye&&J(He),onMouseLeave:()=>!ye&&J(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:q,y:a,width:de,height:Me,rx:rt,fill:Be,initial:{opacity:0,scale:.95},animate:{opacity:Ve||e.parentId?.6:G?.9:.8,scale:G&&!ye?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Ee=>{Ee.stopPropagation(),ke(He),L(Se),ae(Ee,void 0,Se);},style:{cursor:ye?ee?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:q,y:a,width:de*(e.progress/100),height:Me,rx:rt,fill:Be,opacity:1,style:{pointerEvents:"none"}})]},`segment-${He}`)}),Xe&&(ut||It)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[It&&!ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Me,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsxRuntime.jsx("rect",{x:j,y:a,width:$,height:Me,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),$>60&&!e.segments&&(()=>{let le=l.taskLabel(e),He=typeof le=="string"?le:e.name,Se=He.length>Math.floor($/8)?`${He.substring(0,Math.floor($/8))}...`:He;return jsxRuntime.jsx("text",{x:j+12,y:a+Me/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:Se})})(),$>100&&e.progress>0&&e.progress<100&&!ye&&!e.segments&&jsxRuntime.jsxs("text",{x:j+$-12,y:a+Me/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&&$>80&&!ye&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:j+$-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ie||Oe)&&!ee&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:j-2,y:a,width:16,height:Me,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-start");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+4,y:a+8,width:3,height:Me-16,rx:1.5,fill:oe==="resize-start"||w==="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:j+$-14,y:a,width:16,height:Me,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"resize-end");}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:j+$-7,y:a+8,width:3,height:Me-16,rx:1.5,fill:oe==="resize-end"||w==="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:ie&&!ye&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx("circle",{cx:t+r+10,cy:a+Me/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:le=>{le.stopPropagation(),ae(le,"connect");}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+r+10,cy:a+Me/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:oe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ee&&W&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Me/2,x2:W.x,y2:W.y,stroke:v?o.statusCompleted:o.accent,strokeWidth:v?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:v?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:W.x,cy:W.y,r:v?8:6,fill:v?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),v&&jsxRuntime.jsx(framerMotion.motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(ie||ye)&&!ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:j-2,y:a-2,width:$+4,height:Me+4,rx:rt+2,fill:"none",stroke:ye?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ye?.6:.4,initial:{opacity:0},animate:{opacity:ye?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ie&&!ye&&!e.segments&&!T&&(()=>{let Se=a<100,Re=Se?a+Me+13:a-82-13,de=Se?`M ${j+$/2-6} ${a+Me+3} L ${j+$/2} ${a+Me+13} L ${j+$/2+6} ${a+Me+3}`:`M ${j+$/2-6} ${a-13} L ${j+$/2} ${a-3} L ${j+$/2+6} ${a-13}`,Ve=Re+22,G=Re+40,q=Re+55,Ee=Re+70,Ye=Se?Re+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Se?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Se?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:de,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:j+$/2-120,y:Re,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:j+$/2,y:Ve,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:j+$/2-110,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.startDate)}),jsxRuntime.jsx("text",{x:j+$/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:j+$/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ue(e.endDate)}),jsxRuntime.jsx("text",{x:j+$/2+10,y:G,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:j+$/2+65,y:G,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsxRuntime.jsx("text",{x:j+$/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:j+$/2+65,y:q,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:j+$/2-110,y:Ee,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:j+$/2-50,y:Ee,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map($e=>$e.name).join(", ").substring(0,30),e.assignees.map($e=>$e.name).join(", ").length>30?"...":""]})]}),!Se&&jsxRuntime.jsx("text",{x:j+$/2,y:Ye,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Ae?"Left: move \u2022 Right: resize":ge?"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 Om({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,g=m?s+l+d:s-c-d,f=m?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,x=g+22,T=g+40,p=g+55,h=g+70,b=g+90,y=g+105,w=g+120,D=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},E=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),H=C%60;return W===0?`${H}m`:H===0?`${W}h`:`${W}h ${H}m`},k={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};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:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:o+n/2-120,y:g,width:240,height:c,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:o+n/2,y:x,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsxRuntime.jsx("text",{x:o+n/2-110,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsxRuntime.jsx("text",{x:o+n/2-70,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2-110,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsxRuntime.jsx("text",{x:o+n/2-70,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsxRuntime.jsx("text",{x:o+n/2+10,y:T,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsxRuntime.jsx("text",{x:o+n/2+65,y:T,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsxRuntime.jsx("text",{x:o+n/2+10,y:p,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxRuntime.jsxs("text",{x:o+n/2+65,y:p,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxRuntime.jsxs("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[r.effortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsxRuntime.jsx("text",{x:o+n/2-50,y:b,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsxRuntime.jsx("text",{x:o+n/2-50,y,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:E(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsxRuntime.jsx("text",{x:o+n/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:E(r.soldEffortMinutes)})]})]})]})})}function ks({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[m,i]=react.useState(false),[c,d]=react.useState(null),g=r-t,f=g>0,x=Math.abs(g)<5,T=20,p=!x&&a<=e,h,b,y=a-e,w=e+y/2;if(b=w,n==="squared")if(x)h=`M ${e} ${t} L ${a} ${r}`;else if(p){let ne=e+15,A=a-T,ke=f?t+20:t-20;b=A,h=`M ${e} ${t} L ${ne} ${t} L ${ne} ${ke} L ${A} ${ke} L ${A} ${r} L ${a} ${r}`;}else b=a-T,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${w} ${t}, ${w} ${r}, ${a} ${r}`;let D=5,N=`M ${a} ${r} L ${a-D} ${r-D*.5} M ${a} ${r} L ${a-D} ${r+D*.5}`,E=o.dependency,k=o.dependencyHover||E,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=b,W=(t+r)/2;if(c)if(x)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(p){let oe=e+15,ne=a-T,A=f?t+20:t-20,ke=[[e,t,oe,t],[oe,t,oe,A],[oe,A,ne,A],[ne,A,ne,r],[ne,r,a,r]],Ie=1/0,L={x:C,y:W};for(let U of ke){let S=H(c.x,c.y,U[0],U[1],U[2],U[3]),K=Math.hypot(c.x-S.x,c.y-S.y);K<Ie&&(Ie=K,L=S);}C=L.x,W=L.y;}else {let oe=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],ne=1/0,A={x:C,y:W};for(let ke of oe){let Ie=H(c.x,c.y,ke[0],ke[1],ke[2],ke[3]),L=Math.hypot(c.x-Ie.x,c.y-Ie.y);L<ne&&(ne=L,A=Ie);}C=A.x,W=A.y;}function H(oe,ne,A,ke,Ie,L){let U=Ie-A,S=L-ke,K=U*U+S*S;if(K===0)return {x:A,y:ke};let J=((oe-A)*U+(ne-ke)*S)/K;return J=Math.max(0,Math.min(1,J)),{x:A+J*U,y:ke+J*S}}let v=oe=>{let ne=oe.currentTarget.ownerSVGElement;if(!ne)return;let A=ne.getBoundingClientRect();d({x:oe.clientX-A.left,y:oe.clientY-A.top});},te=()=>{i(false),d(null);};return l?jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseLeave:te,onMouseMove:v,children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:h,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:N,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxRuntime.jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:te,onMouseMove:v,style:{cursor:s?"pointer":"default"},children:[jsxRuntime.jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:h,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:N,fill:"none",stroke:m?k:E,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:E,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:oe=>{oe.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsxRuntime.jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Cs({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=react.useState(false),l=16,m=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{"data-task-bar":"true",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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var xe={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,m=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&m(d))return true;if(l.has(d))return true}}return l.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
126
126
  `)},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=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],l=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:l,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=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((g,f)=>{o.set(g.id,f+1);});let s=g=>g.toISOString().replace("Z",""),n=xe.getEarliestStartDate(e)||new Date,l=xe.getLatestEndDate(e)||new Date,m=r.map((g,f)=>{let x=o.get(g.id),T=g.startDate&&g.endDate?xe.calculateDuration(g.startDate,g.endDate):0,p=(g.dependencies||[]).filter(h=>o.has(h)).map(h=>`
127
127
  <PredecessorLink>
128
128
  <PredecessorUID>${o.get(h)}</PredecessorUID>
@@ -353,7 +353,7 @@
353
353
  </Calendars>
354
354
  <Tasks>${m}
355
355
  </Tasks>
356
- </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.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 c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let x=t.find(T=>T.id===f);if(x){o(x);let T=r.get(f)?.ef||0;d=Math.max(d,T);}}let g=d+c;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,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),g=s;if(d.length>0)for(let x of d){l(x);let T=n.get(x.id)?.ls||0;g=Math.min(g,T);}let f=g-c;n.set(i.id,{ls:f,lf:g});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let g=d.ls-c.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=xe.calculateEndDate(m,l),c=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:c(g.subtasks)}:g);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(f,x,T=new Set)=>{if(T.has(f))return;T.add(f);let p=xe.getDependentTasks(e,f);for(let h of p){if(!h.startDate||!h.endDate)continue;let b=r.findIndex(C=>C.id===h.id);if(b===-1)continue;let y=h.startDate.getTime(),D=(h.endDate.getTime()-y)/c,E=(y-i)/c*s,k=E+x*s,R=Math.max(D*s,s),I=l+b*n+12;m.push({taskId:h.id,taskName:h.name,originalX:E,previewX:k,width:R,y:I,rowIndex:b,daysDelta:x,color:h.color}),g(h.id,x,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ns({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:T}){let h=Xr(),[b,y]=react.useState([]),[w,D]=react.useState(null),N=react.useCallback(L=>{D(L);},[]),E=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=E*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-S);let K=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-K.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=react.useCallback(L=>{let U=Math.round(L/(k*n)),S=new Date(o);return S.setDate(S.getDate()+U),S},[o,k,n]),H=react.useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let K=S.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let J=K.matrixTransform(S.getScreenCTM()?.inverse()),ie=W(J.x),ue=new Date(ie);ue.setDate(ue.getDate()+1),f?.(U,ie,ue);},[W,f]),v=react.useMemo(()=>{let L=J=>J.map(ie=>{if(ie.subtasks&&ie.subtasks.length>0){let ue=L(ie.subtasks),ye=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(ye.length>0){let Oe=ye.map(rt=>rt.startDate.getTime()),ee=ye.map(rt=>rt.endDate.getTime()),Je=new Date(Math.min(...Oe)),Me=new Date(Math.max(...ee));return {...ie,subtasks:ue,startDate:Je,endDate:Me}}return {...ie,subtasks:ue}}return ie}),U=(J,ie=[])=>{for(let ue of J)ie.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,ie);return ie},S=L(e);return U(S)},[e]),te=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),S=L.endDate.getTime(),K=o.getTime(),J=(U-K)/(1e3*60*60*24),ie=(S-U)/(1e3*60*60*24),ue=J*k*n,ye=Math.max(k*n,40),Oe=Math.max(ie*k*n,ye);return {x:ue,width:Oe}},[o,k,n]),oe=react.useMemo(()=>v.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:S}=te(L),J=v.findIndex(ie=>ie.id===L.id)*a+12;return {id:L.id,x:U,y:J,width:S,height:32}}),[v,te]),ne=react.useCallback((L,U,S)=>{if(!S||U===0){y([]);return}let K=xe.calculateCascadePreview(e,L,U,v,o,k*n,a,48);y(K);},[e,v,o,k,n,a,48]),A=react.useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let J=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),U.setDate(U.getDate()+1);else if(r==="week"){let ie=I(U);L.push({date:new Date(U),label:`${h.labels.week} ${ie}`,x:J}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,h.labels.week]),ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ie=Math.max(v.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),A.map((L,U)=>jsxRuntime.jsxs("g",{children:[U>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-${U}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:Ie,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(R,1e3),height:Ie,fill:t.bgPrimary}),A.map((L,U)=>{let S=A[U+1]?.x||R,K=C(L.date);return jsxRuntime.jsxs("g",{children:[K&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:S-L.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),v.map((L,U)=>{let S=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>H(K,L),onMouseEnter:K=>{K.currentTarget.setAttribute("fill",t.accentLight),K.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:K=>{K.currentTarget.setAttribute("fill","transparent"),K.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:ke>0?ke:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:h.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),v.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:K}=te(L),J=U*a+12,ie=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(Cs,{task:L,x:S+K/2,y:J+16,theme:t,onClick:c},L.id):ie?jsxRuntime.jsxs("g",{onClick:()=>c?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),g?.(L,ue);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:J,width:K,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S+K,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+K,y1:J,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J+32,x2:S+K,y2:J+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),K>60&&jsxRuntime.jsx("text",{x:S+12,y:J+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(vs,{task:L,x:S,y:J,width:K,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:oe,onDragMove:ne,onHoverChange:N},L.id)}),v.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let K=v.find(Me=>Me.id===S);if(!K||!K.startDate||!K.endDate)return null;let J=v.findIndex(Me=>Me.id===S),ie=te(K),ue=te(L),ye=ie.x+ie.width,Oe=J*a+28,ee=ue.x,Je=U*a+28;return jsxRuntime.jsx(ks,{x1:ye,y1:Oe,x2:ee,y2:Je,theme:t,lineStyle:i,onDelete:()=>T?.(L.id,S)},`dep-${S}-${L.id}`)})),b.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}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("line",{x1:ke,y1:0,x2:ke,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsxRuntime.jsx(Om,{tooltipData:w,theme:t,locale:l==="es"?"es":"en"})]})]})}var by=['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"'],Hm=()=>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"})]}),hy=()=>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"})}),yy=()=>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"})}),vy=()=>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"})}),xy=()=>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 Ds({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=react.useState(false),[d,g]=react.useState(false),[f,x]=react.useState([]),[T,p]=react.useState(""),[h,b]=react.useState(false),[y,w]=react.useState(true),D=react.useRef(null),N=react.useRef(null),E=react.useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=by,maxHistory:H=50,persistHistory:v}=a,te=v?.storageKey||"gantt-ai-history",oe=v?.maxMessages??5;react.useEffect(()=>{if(v?.enabled)try{let U=localStorage.getItem(te);if(U){let K=JSON.parse(U).map(J=>({...J,timestamp:new Date(J.timestamp)}));x(K.slice(-oe));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[v?.enabled,te,oe]),react.useEffect(()=>{if(v?.enabled&&f.length>0)try{let U=f.filter(S=>!S.isLoading).slice(-oe);localStorage.setItem(te,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,v?.enabled,te,oe]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ne=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,m]),A=react.useCallback(async U=>{if(!U.trim()||h)return;let S={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};x(J=>[...J.slice(-(H-1)),S]),p(""),w(false),b(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(J=>[...J,K]);try{if(C){let J=await C(U,e);x(ie=>{let ue=ie.filter(Oe=>!Oe.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...ue,ye]}),ne(J);}else x(J=>[...J.filter(ue=>!ue.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(J){x(ie=>[...ie.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[h,H,C,e,ne]),ke=U=>{U.preventDefault(),A(T);},Ie=U=>{p(U),D.current?.focus();};if(react.useEffect(()=>{let U=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(K=>!K),i||g(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),react.useEffect(()=>{if(!i)return;let U=K=>{let J=K.target;E.current&&!E.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",U);}},[i]),!k)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(yt,{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[I]} 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:()=>c(true),children:[jsxRuntime.jsx(Hm,{}),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:E,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[I]} 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(Hm,{}),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(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(vy,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(yy,{})})]})]}),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:[f.length===0&&y&&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:W.slice(0,4).map((U,S)=>jsxRuntime.jsx("button",{onClick:()=>Ie(U),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:U.length>30?U.slice(0,30)+"...":U},S))})]}),f.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(xy,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:ke,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:D,type:"text",value:T,onChange:U=>p(U.target.value),placeholder:R,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||h,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(hy,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Wm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!c)return {...d,present:g};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=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:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Gm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ty={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Vm(e){return {...Ty,...e}}var Ay=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Km=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:f,persistFilter:x,aiAssistant:T,locale:p="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:w,taskFilter:D,onTaskFilterChange:N,onThemeChange:E,onTaskClick:k,onTaskDblClick:R,onTaskContextMenu:I,onTaskUpdate:C,onProgressChange:W,onTaskEdit:H,onTaskAddSubtask:v,onTaskMarkIncomplete:te,onTaskSetInProgress:oe,onDependencyCreate:ne,onDependencyDelete:A,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:L,onAfterTaskUpdate:U,onBeforeTaskDelete:S,onAfterTaskDelete:K}=a,ie=react.useContext(ds)?.theme,[ue,ye]=react.useState(ie||s||"dark"),[Oe,ee]=react.useState(n),[Je,Me]=react.useState(l),[rt,ut]=react.useState(1),It=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Xe,pt]=react.useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ce=D??Xe,Ge=N??pt,[Be,B]=react.useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=It();if(M)try{let F={taskFilter:ce,hideCompleted:Be};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ce,Be,It]);let[X,ge]=react.useState(0),[Ae,Ue]=react.useState(false),[nt,Pt]=react.useState(null),[ze,O]=react.useState({isOpen:false,x:0,y:0,task:null}),[ae,Le]=react.useState(null),[je,qe]=react.useState(null);react.useEffect(()=>{ie&&ie!==ue&&ye(ie);},[ie]),react.useEffect(()=>{s&&s!==ue&&ye(s);},[s]);let j=react.useCallback(M=>{ye(M),E?.(M);},[E]),{state:$,setState:De,undo:ht,redo:le,canUndo:He,canRedo:Se,clearHistory:Re}=Wm(t,50),de=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),Ve=react.useRef(new Map),G=react.useRef(false);if(!G.current&&f){G.current=true;let M=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let _=JSON.parse(F);Array.isArray(_)&&(Ve.current=new Map(_));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let q=react.useCallback(()=>{let M=de();if(M)try{let F=Array.from(Ve.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[de]);react.useEffect(()=>{let M=_=>{let Q=new Map;for(let pe of _){let we=pe.id;Q.get(we)||Q.set(we,pe);}return Array.from(Q.values())},F=_=>_.map(Q=>{let pe=Ve.current.get(Q.id),we=pe!==void 0?{...Q,isExpanded:pe}:Q;if(we.subtasks?.length){let Dt=M(we.subtasks);return {...we,subtasks:F(Dt)}}return we});if(Ve.current.size>0)De(F(t));else {let _=Q=>Q.map(pe=>pe.subtasks?.length?{...pe,subtasks:M(_(pe.subtasks))}:pe);De(_(t));}},[t,De]);let Ee=react.useRef(t),Ye=react.useRef(true);react.useEffect(()=>{if(Ye.current){Ye.current=false,Ee.current=$;return}if(!r)return;let M=JSON.stringify(Ee.current),F=JSON.stringify($);M!==F&&(Ee.current=$,r($));},[$,r]);let $e=react.useMemo(()=>ol(p,h),[p,h]),V=react.useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[me,_e]=react.useState(()=>V($e));react.useEffect(()=>{_e(M=>M.map(F=>({...F,label:$e.columns[F.id==="name"?"taskName":F.id]||F.label})));},[$e]);let Tt=react.useMemo(()=>me.filter(F=>F.visible).reduce((F,_)=>F+_.width,0),[me]),gt=react.useRef(me.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=me.filter(Q=>Q.visible),F=M.map(Q=>Q.id).join(","),_=gt.current;if(F!==_){let Q=M.some(we=>we.id!=="name"),pe=_.includes(",");Q?!pe&&Q&&Pt(null):Pt(null),gt.current=F;}},[me]);let Sr=60,br=.6,Ba=react.useMemo(()=>{let F=Tt+Sr,_=typeof window<"u"?window.innerWidth*br:800,Q=Math.max(F,_);return nt!==null?Math.max(200,Math.min(nt,Q)):Math.max(200,F)},[nt,Tt]),Ra=react.useRef(null),fe=react.useRef(null),Nt=react.useRef(null),ot=react.useMemo(()=>pm(ue),[ue]),Or=react.useMemo(()=>({theme:ot,themeName:ue}),[ot,ue]),oo=react.useMemo(()=>Vm(d),[d]),hr=react.useMemo(()=>{if(!g)return $;let M=xe.calculateCriticalPath($),F=_=>_.map(Q=>({...Q,isCriticalPath:M.includes(Q.id),subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F($)},[$,g]),P=react.useMemo(()=>{if(ce==="all"&&!Be)return hr;let M=F=>{let _=[];for(let Q of F){let pe=Q.subtasks?.length?M(Q.subtasks):void 0,we=false;if(Be)we=Q.progress<100;else switch(ce){case "all":we=true;break;case "incomplete":we=Q.progress<100;break;case "in_progress":we=Q.progress>0&&Q.progress<100;break;case "completed":we=Q.progress===100;break}(we||pe&&pe.length>0)&&_.push({...Q,subtasks:pe});}return _};return M(hr)},[hr,ce,Be]),re=Ay(Je);Gm({undo:ht,redo:le,canUndo:He,canRedo:Se,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>xe.findTaskById($,M),addTask:(M,F)=>{De(_=>{if(!F)return [..._,{...M,level:0}];let Q=pe=>pe.map(we=>we.id===F?{...we,subtasks:[...we.subtasks||[],{...M,parentId:F,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(_)});},updateTask:(M,F)=>{De(_=>{let Q=pe=>pe.map(we=>we.id===M?{...we,...F}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(_)});},deleteTask:M=>{De(F=>{let _=Q=>Q.filter(pe=>pe.id===M?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(F)});},deleteTasks:M=>{De(F=>fl(F,M));},duplicateTask:M=>{De(F=>gs(F,[M]));},splitTask:(M,F,_=3)=>{De(Q=>xe.splitTask(Q,M,F,_));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(M,F)=>!xe.validateDependencies($,M,F),getAllTasks:()=>xe.flattenTasks($),getTasksByStatus:M=>xe.flattenTasks($).filter(F=>F.status===M),getTasksByParent:M=>M?xe.findTaskById($,M)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>xe.flattenTasks($).filter(M=>M.isCriticalPath),indentTask:M=>{De(F=>ul(F,[M]));},outdentTask:M=>{De(F=>pl(F,[M]));},moveTask:(M,F)=>{De(_=>gl(_,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:_}=yl($,M);if(ke){let Q=ke({..._,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}De(F),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=xe.flattenTasks($).findIndex(Q=>Q.id===M);if(_!==-1&&Ra.current){let Q=_*re;Ra.current.scrollTo({top:Q,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{De(F=>{let _=Q=>Q.map(pe=>pe.id===M?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},collapseTask:M=>{De(F=>{let _=Q=>Q.map(pe=>pe.id===M?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},expandAll:()=>{De(M=>{let F=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F(M)});},collapseAll:()=>{De(M=>{let F=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F(M)});},undo:ht,redo:le,canUndo:()=>He,canRedo:()=>Se,clearHistory:Re,exportToPNG:async()=>{if(!Nt.current||!Ra.current||!fe.current)throw new Error("Gantt container not found");let M=Nt.current,F=Ra.current.querySelector(".gantt-grid-scroll"),_=fe.current,Q=F?.scrollTop||0,pe=_.scrollTop,we=M.style.overflow,Dt=M.style.height;try{let ft=F?.querySelector(".gantt-taskgrid-content"),jt=_.querySelector("svg"),Na=ft?.scrollHeight||F?.scrollHeight||600,Ea=jt?.getBoundingClientRect().height||_.scrollHeight,so=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Ea)+20;F&&(F.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${so}px`,await new Promise(zr=>setTimeout(zr,100));let yr=await jm__default.default(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:zr=>{let Po=window.getComputedStyle(zr),io=parseInt(Po.zIndex,10);return !isNaN(io)&&io>=50||Po.position==="fixed"}});return new Promise((zr,Po)=>{yr.toBlob(io=>{io?zr(io):Po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=we,M.style.height=Dt,F&&(F.scrollTop=Q),_.scrollTop=pe;}},exportToPDF:async M=>{await xe.exportToPDF($,M);},exportToExcel:async M=>{await xe.exportToExcel($,M);},exportToJSON:()=>xe.exportToJSON($),exportToCSV:()=>xe.exportToCSV($),importFromJSON:M=>{let F=xe.importFromJSON(M);De(F);},getTasks:()=>$,refresh:()=>{De(M=>[...M]);},clearAll:()=>{De([]);}}),[$,ht,le,He,Se,Re,ot,re]);let ve=react.useCallback(M=>{_e(F=>F.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),Ze=react.useCallback((M,F)=>{_e(_=>_.map(Q=>{if(Q.id!==M)return Q;let pe=Q.minWidth??100,we=Q.maxWidth??800,Dt=Math.max(pe,Math.min(we,F));return {...Q,width:Dt}}));},[]),ra=react.useCallback(M=>{De(F=>{let _=hl(F,M),Q=pe=>{for(let we of pe){if(we.id===M){Ve.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&Q(we.subtasks);}};return Q(_),q(),_}),a.onTaskToggleExpand?.(M);},[a,q]),la=react.useCallback((M,F)=>{if(L&&L(M,F)===false)return;let Q=xe.findTaskById($,M)?.progress,pe=Dt=>Dt.map(ft=>ft.id===M?{...ft,...F}:ft.subtasks?{...ft,subtasks:pe(ft.subtasks)}:ft);De(pe($));let we=xe.findTaskById(pe($),M);we&&(C?.(we),U?.(we),F.progress!==void 0&&Q!==void 0&&F.progress!==Q&&W?.(M,Q,F.progress));},[$,C,L,U,W]),oa=react.useCallback(M=>{M.length!==0&&(De(F=>ul(F,M)),a.onTaskIndent?.(M[0]));},[a]),or=react.useCallback(M=>{M.length!==0&&(De(F=>pl(F,M)),a.onTaskOutdent?.(M[0]));},[a]),Ta=react.useCallback((M,F,_)=>{De(Q=>Pm(Q,M,F,_)),a.onTaskReparent?.(M,F,_);},[a]),Sa=react.useCallback((M,F)=>{M.length!==0&&(De(_=>gl(_,M,F)),a.onTaskMove?.(M[0],F));},[a]),no=react.useCallback(async M=>{let F=[];for(let _ of M)S&&await Promise.resolve(S(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(De(_=>fl(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),K&&F.forEach(_=>K(_)));},[a,S,K]),ug=react.useCallback(M=>{De(F=>gs(F,M)),M.forEach(F=>a.onTaskDuplicate?.(F));},[a]),pg=react.useCallback((M,F)=>{De(_=>{let{tasks:Q,newTask:pe}=Em(_,M,F);return ke&&ke(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ie?.(pe),Q)});},[a,ke,Ie]),gg=react.useCallback((M,F)=>{De(_=>bl(_,M,F)),a.onTaskRename?.(M,F);},[a]),Js=react.useCallback(M=>{De(F=>{let{tasks:_}=yl(F,M);return a.onTaskCreate?.(M,0),_});},[a]),fg=react.useCallback((M,F,_)=>{let Q=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/864e5):0,pe=ft=>ft.map(jt=>jt.id===M.id?{...jt,startDate:F,endDate:_,...M.segments&&{segments:M.segments}}:jt.subtasks?{...jt,subtasks:pe(jt.subtasks)}:jt),we=pe($);we=xe.autoScheduleDependents(we,M.id,Q),De(we);let Dt={...M,startDate:F,endDate:_};C?.(Dt);},[$,C]),bg=react.useCallback((M,F)=>{I?.(M,F),O({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[I]),hg=react.useCallback((M,F)=>{let _=xe.splitTask($,M.id,F);De(_),O({isOpen:false,x:0,y:0,task:null});},[$]),Nd=react.useCallback(M=>{let F=xe.findTaskById($,M.id)||M;R?.(F),H||Le(F);},[$,R,H]),Dd=react.useCallback((M,F,_)=>{let Q=new Map,pe=Na=>{Na.forEach(Ea=>{Ea.dependencies&&Q.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(_);let we=Q.get(F)||[];Q.set(F,[...we,M]);let Dt=new Set,ft=new Set,jt=Na=>{if(!Dt.has(Na)){Dt.add(Na),ft.add(Na);let Ea=Q.get(Na)||[];for(let $r of Ea){if(!Dt.has($r)&&jt($r))return true;if(ft.has($r))return true}}return ft.delete(Na),false};return jt(F)},[]),Sd=react.useCallback((M,F)=>{if(Dd(M.id,F,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
356
+ </Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=xe.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 c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let x=t.find(T=>T.id===f);if(x){o(x);let T=r.get(f)?.ef||0;d=Math.max(d,T);}}let g=d+c;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,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,d=t.filter(x=>x.dependencies&&x.dependencies.includes(i.id)),g=s;if(d.length>0)for(let x of d){l(x);let T=n.get(x.id)?.ls||0;g=Math.min(g,T);}let f=g-c;n.set(i.id,{ls:f,lf:g});};a.forEach(l);let m=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let g=d.ls-c.es;Math.abs(g)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let l=xe.getLatestEndDate(e);if(!l)return null;let m=xe.calculateDuration(a.endDate,l);return Math.max(0,m)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,m)=>l-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=xe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=xe.calculateEndDate(m,l),c=d=>d.map(g=>g.id===n.id?{...g,startDate:m,endDate:i}:g.subtasks?{...g,subtasks:c(g.subtasks)}:g);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,d=xe.findTaskById(e,t);if(!d||!d.endDate)return [];let g=(f,x,T=new Set)=>{if(T.has(f))return;T.add(f);let p=xe.getDependentTasks(e,f);for(let h of p){if(!h.startDate||!h.endDate)continue;let b=r.findIndex(C=>C.id===h.id);if(b===-1)continue;let y=h.startDate.getTime(),D=(h.endDate.getTime()-y)/c,E=(y-i)/c*s,k=E+x*s,R=Math.max(D*s,s),I=l+b*n+12;m.push({taskId:h.id,taskName:h.name,originalX:E,previewX:k,width:R,y:I,rowIndex:b,daysDelta:x,color:h.color}),g(h.id,x,T);}};return g(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 l=new Date(o.endDate);l.setDate(l.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:m}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ns({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:T}){let h=Xr(),[b,y]=react.useState([]),[w,D]=react.useState(null),N=react.useCallback(L=>{D(L);},[]),E=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=E*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),S=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-S);let K=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-K.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=react.useCallback(L=>{let U=Math.round(L/(k*n)),S=new Date(o);return S.setDate(S.getDate()+U),S},[o,k,n]),H=react.useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let S=L.currentTarget.ownerSVGElement;if(!S)return;let K=S.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let J=K.matrixTransform(S.getScreenCTM()?.inverse()),ie=W(J.x),ue=new Date(ie);ue.setDate(ue.getDate()+1),f?.(U,ie,ue);},[W,f]),v=react.useMemo(()=>{let L=J=>J.map(ie=>{if(ie.subtasks&&ie.subtasks.length>0){let ue=L(ie.subtasks),ye=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(ye.length>0){let Oe=ye.map(rt=>rt.startDate.getTime()),ee=ye.map(rt=>rt.endDate.getTime()),Je=new Date(Math.min(...Oe)),Me=new Date(Math.max(...ee));return {...ie,subtasks:ue,startDate:Je,endDate:Me}}return {...ie,subtasks:ue}}return ie}),U=(J,ie=[])=>{for(let ue of J)ie.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,ie);return ie},S=L(e);return U(S)},[e]),te=react.useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),S=L.endDate.getTime(),K=o.getTime(),J=(U-K)/(1e3*60*60*24),ie=(S-U)/(1e3*60*60*24),ue=J*k*n,ye=Math.max(k*n,40),Oe=Math.max(ie*k*n,ye);return {x:ue,width:Oe}},[o,k,n]),oe=react.useMemo(()=>v.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:S}=te(L),J=v.findIndex(ie=>ie.id===L.id)*a+14;return {id:L.id,x:U,y:J,width:S,height:24}}),[v,te]),ne=react.useCallback((L,U,S)=>{if(!S||U===0){y([]);return}let K=xe.calculateCascadePreview(e,L,U,v,o,k*n,a,48);y(K);},[e,v,o,k,n,a,48]),A=react.useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let J=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:J}),U.setDate(U.getDate()+1);else if(r==="week"){let ie=I(U);L.push({date:new Date(U),label:`${h.labels.week} ${ie}`,x:J}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:J}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,h.labels.week]),ke=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ie=Math.max(v.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),A.map((L,U)=>jsxRuntime.jsxs("g",{children:[U>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-${U}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("circle",{cx:ke,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(R,1e3),height:Ie,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(R,1e3),height:Ie,fill:t.bgPrimary}),A.map((L,U)=>{let S=A[U+1]?.x||R,K=C(L.date);return jsxRuntime.jsxs("g",{children:[K&&jsxRuntime.jsx("rect",{x:L.x,y:0,width:S-L.x,height:v.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsxRuntime.jsx("line",{x1:L.x,y1:0,x2:L.x,y2:v.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),v.map((L,U)=>{let S=L.startDate&&L.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>H(K,L),onMouseEnter:K=>{K.currentTarget.setAttribute("fill",t.accentLight),K.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:K=>{K.currentTarget.setAttribute("fill","transparent"),K.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsxRuntime.jsx("text",{x:ke>0?ke:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:h.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),v.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:S,width:K}=te(L),J=U*a+14,ie=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsxRuntime.jsx(Cs,{task:L,x:S+K/2,y:J+12,theme:t,onClick:c},L.id):ie?jsxRuntime.jsxs("g",{onClick:()=>c?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),g?.(L,ue);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:S,y:J,width:K,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S+K,y2:J,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J,x2:S,y2:J+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S+K,y1:J,x2:S+K,y2:J+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:S,y1:J+24,x2:S+K,y2:J+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),K>60&&jsxRuntime.jsx("text",{x:S+12,y:J+12,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsxRuntime.jsx(vs,{task:L,x:S,y:J,width:K,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:d,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:oe,onDragMove:ne,onHoverChange:N},L.id)}),v.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(S=>{let K=v.find(Me=>Me.id===S);if(!K||!K.startDate||!K.endDate)return null;let J=v.findIndex(Me=>Me.id===S),ie=te(K),ue=te(L),ye=ie.x+ie.width,Oe=J*a+26,ee=ue.x,Je=U*a+26;return jsxRuntime.jsx(ks,{x1:ye,y1:Oe,x2:ee,y2:Je,theme:t,lineStyle:i,onDelete:()=>T?.(L.id,S)},`dep-${S}-${L.id}`)})),b.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}`)),ke>=0&&ke<=R&&jsxRuntime.jsx("line",{x1:ke,y1:0,x2:ke,y2:Ie,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),w&&jsxRuntime.jsx(Om,{tooltipData:w,theme:t,locale:l==="es"?"es":"en"})]})]})}var by=['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"'],Hm=()=>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"})]}),hy=()=>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"})}),yy=()=>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"})}),vy=()=>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"})}),xy=()=>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 Ds({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:m}){let[i,c]=react.useState(false),[d,g]=react.useState(false),[f,x]=react.useState([]),[T,p]=react.useState(""),[h,b]=react.useState(false),[y,w]=react.useState(true),D=react.useRef(null),N=react.useRef(null),E=react.useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=by,maxHistory:H=50,persistHistory:v}=a,te=v?.storageKey||"gantt-ai-history",oe=v?.maxMessages??5;react.useEffect(()=>{if(v?.enabled)try{let U=localStorage.getItem(te);if(U){let K=JSON.parse(U).map(J=>({...J,timestamp:new Date(J.timestamp)}));x(K.slice(-oe));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[v?.enabled,te,oe]),react.useEffect(()=>{if(v?.enabled&&f.length>0)try{let U=f.filter(S=>!S.isLoading).slice(-oe);localStorage.setItem(te,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,v?.enabled,te,oe]),react.useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ne=react.useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,m]),A=react.useCallback(async U=>{if(!U.trim()||h)return;let S={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};x(J=>[...J.slice(-(H-1)),S]),p(""),w(false),b(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};x(J=>[...J,K]);try{if(C){let J=await C(U,e);x(ie=>{let ue=ie.filter(Oe=>!Oe.isLoading),ye={id:`assistant-${Date.now()}`,role:"assistant",content:J.message,timestamp:new Date,command:J};return [...ue,ye]}),ne(J);}else x(J=>[...J.filter(ue=>!ue.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(J){x(ie=>[...ie.filter(ye=>!ye.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${J instanceof Error?J.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[h,H,C,e,ne]),ke=U=>{U.preventDefault(),A(T);},Ie=U=>{p(U),D.current?.focus();};if(react.useEffect(()=>{let U=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),c(K=>!K),i||g(false)),S.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),react.useEffect(()=>{if(!i)return;let U=K=>{let J=K.target;E.current&&!E.current.contains(J)&&c(false);},S=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(S),document.removeEventListener("mousedown",U);}},[i]),!k)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(yt,{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[I]} 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:()=>c(true),children:[jsxRuntime.jsx(Hm,{}),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:E,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[I]} 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(Hm,{}),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(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(vy,{})}),jsxRuntime.jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(yy,{})})]})]}),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:[f.length===0&&y&&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:W.slice(0,4).map((U,S)=>jsxRuntime.jsx("button",{onClick:()=>Ie(U),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:U.length>30?U.slice(0,30)+"...":U},S))})]}),f.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsxRuntime.jsx(xy,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:N})]}),jsxRuntime.jsxs("form",{onSubmit:ke,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:D,type:"text",value:T,onChange:U=>p(U.target.value),placeholder:R,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!T.trim()||h,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(hy,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Wm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((i,c=true)=>{r(d=>{let g=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:g};if(!c)return {...d,present:g};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),n=react.useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=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:c,future:[i.present,...i.future]}});},[]),l=react.useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),m=react.useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Gm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=l?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&m&&n.key==="y"){n.preventDefault(),t();return}if(l&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ty={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Vm(e){return {...Ty,...e}}var Ay=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Km=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:g=true,persistExpandedState:f,persistFilter:x,aiAssistant:T,locale:p="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:y,onCreateTask:w,taskFilter:D,onTaskFilterChange:N,onThemeChange:E,onTaskClick:k,onTaskDblClick:R,onTaskContextMenu:I,onTaskUpdate:C,onProgressChange:W,onTaskEdit:H,onTaskAddSubtask:v,onTaskMarkIncomplete:te,onTaskSetInProgress:oe,onDependencyCreate:ne,onDependencyDelete:A,onBeforeTaskAdd:ke,onAfterTaskAdd:Ie,onBeforeTaskUpdate:L,onAfterTaskUpdate:U,onBeforeTaskDelete:S,onAfterTaskDelete:K}=a,ie=react.useContext(ds)?.theme,[ue,ye]=react.useState(ie||s||"dark"),[Oe,ee]=react.useState(n),[Je,Me]=react.useState(l),[rt,ut]=react.useState(1),It=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Xe,pt]=react.useState(()=>{if(!x)return "all";try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(_.taskFilter)return _.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ce=D??Xe,Ge=N??pt,[Be,B]=react.useState(()=>{if(!x)return false;try{let M=typeof x=="string"?x:"gantt-filter-state",F=localStorage.getItem(M);if(F){let _=JSON.parse(F);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});react.useEffect(()=>{let M=It();if(M)try{let F={taskFilter:ce,hideCompleted:Be};localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ce,Be,It]);let[X,ge]=react.useState(0),[Ae,Ue]=react.useState(false),[nt,Pt]=react.useState(null),[ze,O]=react.useState({isOpen:false,x:0,y:0,task:null}),[ae,Le]=react.useState(null),[je,qe]=react.useState(null);react.useEffect(()=>{ie&&ie!==ue&&ye(ie);},[ie]),react.useEffect(()=>{s&&s!==ue&&ye(s);},[s]);let j=react.useCallback(M=>{ye(M),E?.(M);},[E]),{state:$,setState:De,undo:ht,redo:le,canUndo:He,canRedo:Se,clearHistory:Re}=Wm(t,50),de=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),Ve=react.useRef(new Map),G=react.useRef(false);if(!G.current&&f){G.current=true;let M=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(M);if(F){let _=JSON.parse(F);Array.isArray(_)&&(Ve.current=new Map(_));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let q=react.useCallback(()=>{let M=de();if(M)try{let F=Array.from(Ve.current.entries());localStorage.setItem(M,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[de]);react.useEffect(()=>{let M=_=>{let Q=new Map;for(let pe of _){let we=pe.id;Q.get(we)||Q.set(we,pe);}return Array.from(Q.values())},F=_=>_.map(Q=>{let pe=Ve.current.get(Q.id),we=pe!==void 0?{...Q,isExpanded:pe}:Q;if(we.subtasks?.length){let Dt=M(we.subtasks);return {...we,subtasks:F(Dt)}}return we});if(Ve.current.size>0)De(F(t));else {let _=Q=>Q.map(pe=>pe.subtasks?.length?{...pe,subtasks:M(_(pe.subtasks))}:pe);De(_(t));}},[t,De]);let Ee=react.useRef(t),Ye=react.useRef(true);react.useEffect(()=>{if(Ye.current){Ye.current=false,Ee.current=$;return}if(!r)return;let M=JSON.stringify(Ee.current),F=JSON.stringify($);M!==F&&(Ee.current=$,r($));},[$,r]);let $e=react.useMemo(()=>ol(p,h),[p,h]),V=react.useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[me,_e]=react.useState(()=>V($e));react.useEffect(()=>{_e(M=>M.map(F=>({...F,label:$e.columns[F.id==="name"?"taskName":F.id]||F.label})));},[$e]);let Tt=react.useMemo(()=>me.filter(F=>F.visible).reduce((F,_)=>F+_.width,0),[me]),gt=react.useRef(me.filter(M=>M.visible).map(M=>M.id).join(","));react.useEffect(()=>{let M=me.filter(Q=>Q.visible),F=M.map(Q=>Q.id).join(","),_=gt.current;if(F!==_){let Q=M.some(we=>we.id!=="name"),pe=_.includes(",");Q?!pe&&Q&&Pt(null):Pt(null),gt.current=F;}},[me]);let Sr=60,br=.6,Ba=react.useMemo(()=>{let F=Tt+Sr,_=typeof window<"u"?window.innerWidth*br:800,Q=Math.max(F,_);return nt!==null?Math.max(200,Math.min(nt,Q)):Math.max(200,F)},[nt,Tt]),Ra=react.useRef(null),fe=react.useRef(null),Nt=react.useRef(null),ot=react.useMemo(()=>pm(ue),[ue]),Or=react.useMemo(()=>({theme:ot,themeName:ue}),[ot,ue]),oo=react.useMemo(()=>Vm(d),[d]),hr=react.useMemo(()=>{if(!g)return $;let M=xe.calculateCriticalPath($),F=_=>_.map(Q=>({...Q,isCriticalPath:M.includes(Q.id),subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F($)},[$,g]),P=react.useMemo(()=>{if(ce==="all"&&!Be)return hr;let M=F=>{let _=[];for(let Q of F){let pe=Q.subtasks?.length?M(Q.subtasks):void 0,we=false;if(Be)we=Q.progress<100;else switch(ce){case "all":we=true;break;case "incomplete":we=Q.progress<100;break;case "in_progress":we=Q.progress>0&&Q.progress<100;break;case "completed":we=Q.progress===100;break}(we||pe&&pe.length>0)&&_.push({...Q,subtasks:pe});}return _};return M(hr)},[hr,ce,Be]),re=Ay(Je);Gm({undo:ht,redo:le,canUndo:He,canRedo:Se,enabled:true}),react.useImperativeHandle(o,()=>({getTask:M=>xe.findTaskById($,M),addTask:(M,F)=>{De(_=>{if(!F)return [..._,{...M,level:0}];let Q=pe=>pe.map(we=>we.id===F?{...we,subtasks:[...we.subtasks||[],{...M,parentId:F,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(_)});},updateTask:(M,F)=>{De(_=>{let Q=pe=>pe.map(we=>we.id===M?{...we,...F}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(_)});},deleteTask:M=>{De(F=>{let _=Q=>Q.filter(pe=>pe.id===M?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(F)});},deleteTasks:M=>{De(F=>fl(F,M));},duplicateTask:M=>{De(F=>gs(F,[M]));},splitTask:(M,F,_=3)=>{De(Q=>xe.splitTask(Q,M,F,_));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(M,F)=>!xe.validateDependencies($,M,F),getAllTasks:()=>xe.flattenTasks($),getTasksByStatus:M=>xe.flattenTasks($).filter(F=>F.status===M),getTasksByParent:M=>M?xe.findTaskById($,M)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>xe.flattenTasks($).filter(M=>M.isCriticalPath),indentTask:M=>{De(F=>ul(F,[M]));},outdentTask:M=>{De(F=>pl(F,[M]));},moveTask:(M,F)=>{De(_=>gl(_,[M],F));},createSubtask:async M=>{let{tasks:F,newTask:_}=yl($,M);if(ke){let Q=ke({..._,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}De(F),Ie&&Ie({..._,parentId:M});},scrollToTask:M=>{let _=xe.flattenTasks($).findIndex(Q=>Q.id===M);if(_!==-1&&Ra.current){let Q=_*re;Ra.current.scrollTo({top:Q,behavior:"smooth"}),fe.current&&fe.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,F=2e3)=>{},expandTask:M=>{De(F=>{let _=Q=>Q.map(pe=>pe.id===M?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},collapseTask:M=>{De(F=>{let _=Q=>Q.map(pe=>pe.id===M?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(F)});},expandAll:()=>{De(M=>{let F=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F(M)});},collapseAll:()=>{De(M=>{let F=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?F(Q.subtasks):void 0}));return F(M)});},undo:ht,redo:le,canUndo:()=>He,canRedo:()=>Se,clearHistory:Re,exportToPNG:async()=>{if(!Nt.current||!Ra.current||!fe.current)throw new Error("Gantt container not found");let M=Nt.current,F=Ra.current.querySelector(".gantt-grid-scroll"),_=fe.current,Q=F?.scrollTop||0,pe=_.scrollTop,we=M.style.overflow,Dt=M.style.height;try{let ft=F?.querySelector(".gantt-taskgrid-content"),jt=_.querySelector("svg"),Na=ft?.scrollHeight||F?.scrollHeight||600,Ea=jt?.getBoundingClientRect().height||_.scrollHeight,so=(M.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Na,Ea)+20;F&&(F.scrollTop=0),_.scrollTop=0,M.style.overflow="visible",M.style.height=`${so}px`,await new Promise(zr=>setTimeout(zr,100));let yr=await jm__default.default(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:zr=>{let Po=window.getComputedStyle(zr),io=parseInt(Po.zIndex,10);return !isNaN(io)&&io>=50||Po.position==="fixed"}});return new Promise((zr,Po)=>{yr.toBlob(io=>{io?zr(io):Po(new Error("Failed to create blob from canvas"));},"image/png");})}finally{M.style.overflow=we,M.style.height=Dt,F&&(F.scrollTop=Q),_.scrollTop=pe;}},exportToPDF:async M=>{await xe.exportToPDF($,M);},exportToExcel:async M=>{await xe.exportToExcel($,M);},exportToJSON:()=>xe.exportToJSON($),exportToCSV:()=>xe.exportToCSV($),importFromJSON:M=>{let F=xe.importFromJSON(M);De(F);},getTasks:()=>$,refresh:()=>{De(M=>[...M]);},clearAll:()=>{De([]);}}),[$,ht,le,He,Se,Re,ot,re]);let ve=react.useCallback(M=>{_e(F=>F.map(_=>_.id===M?{..._,visible:!_.visible}:_));},[]),Ze=react.useCallback((M,F)=>{_e(_=>_.map(Q=>{if(Q.id!==M)return Q;let pe=Q.minWidth??100,we=Q.maxWidth??800,Dt=Math.max(pe,Math.min(we,F));return {...Q,width:Dt}}));},[]),ra=react.useCallback(M=>{De(F=>{let _=hl(F,M),Q=pe=>{for(let we of pe){if(we.id===M){Ve.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&Q(we.subtasks);}};return Q(_),q(),_}),a.onTaskToggleExpand?.(M);},[a,q]),la=react.useCallback((M,F)=>{if(L&&L(M,F)===false)return;let Q=xe.findTaskById($,M)?.progress,pe=Dt=>Dt.map(ft=>ft.id===M?{...ft,...F}:ft.subtasks?{...ft,subtasks:pe(ft.subtasks)}:ft);De(pe($));let we=xe.findTaskById(pe($),M);we&&(C?.(we),U?.(we),F.progress!==void 0&&Q!==void 0&&F.progress!==Q&&W?.(M,Q,F.progress));},[$,C,L,U,W]),oa=react.useCallback(M=>{M.length!==0&&(De(F=>ul(F,M)),a.onTaskIndent?.(M[0]));},[a]),or=react.useCallback(M=>{M.length!==0&&(De(F=>pl(F,M)),a.onTaskOutdent?.(M[0]));},[a]),Ta=react.useCallback((M,F,_)=>{De(Q=>Pm(Q,M,F,_)),a.onTaskReparent?.(M,F,_);},[a]),Sa=react.useCallback((M,F)=>{M.length!==0&&(De(_=>gl(_,M,F)),a.onTaskMove?.(M[0],F));},[a]),no=react.useCallback(async M=>{let F=[];for(let _ of M)S&&await Promise.resolve(S(_))===false||F.push(_);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(De(_=>fl(_,F)),F.forEach(_=>a.onTaskDelete?.(_))),K&&F.forEach(_=>K(_)));},[a,S,K]),ug=react.useCallback(M=>{De(F=>gs(F,M)),M.forEach(F=>a.onTaskDuplicate?.(F));},[a]),pg=react.useCallback((M,F)=>{De(_=>{let{tasks:Q,newTask:pe}=Em(_,M,F);return ke&&ke(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),Ie?.(pe),Q)});},[a,ke,Ie]),gg=react.useCallback((M,F)=>{De(_=>bl(_,M,F)),a.onTaskRename?.(M,F);},[a]),Js=react.useCallback(M=>{De(F=>{let{tasks:_}=yl(F,M);return a.onTaskCreate?.(M,0),_});},[a]),fg=react.useCallback((M,F,_)=>{let Q=M.startDate?Math.round((F.getTime()-M.startDate.getTime())/864e5):0,pe=ft=>ft.map(jt=>jt.id===M.id?{...jt,startDate:F,endDate:_,...M.segments&&{segments:M.segments}}:jt.subtasks?{...jt,subtasks:pe(jt.subtasks)}:jt),we=pe($);we=xe.autoScheduleDependents(we,M.id,Q),De(we);let Dt={...M,startDate:F,endDate:_};C?.(Dt);},[$,C]),bg=react.useCallback((M,F)=>{I?.(M,F),O({isOpen:true,x:F.clientX,y:F.clientY,task:M});},[I]),hg=react.useCallback((M,F)=>{let _=xe.splitTask($,M.id,F);De(_),O({isOpen:false,x:0,y:0,task:null});},[$]),Nd=react.useCallback(M=>{let F=xe.findTaskById($,M.id)||M;R?.(F),H||Le(F);},[$,R,H]),Dd=react.useCallback((M,F,_)=>{let Q=new Map,pe=Na=>{Na.forEach(Ea=>{Ea.dependencies&&Q.set(Ea.id,Ea.dependencies),Ea.subtasks&&pe(Ea.subtasks);});};pe(_);let we=Q.get(F)||[];Q.set(F,[...we,M]);let Dt=new Set,ft=new Set,jt=Na=>{if(!Dt.has(Na)){Dt.add(Na),ft.add(Na);let Ea=Q.get(Na)||[];for(let $r of Ea){if(!Dt.has($r)&&jt($r))return true;if(ft.has($r))return true}}return ft.delete(Na),false};return jt(F)},[]),Sd=react.useCallback((M,F)=>{if(Dd(M.id,F,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
357
357
 
358
358
  Task dependencies must flow in one direction only.`);return}let _=Q=>Q.map(pe=>{if(pe.id===F){let we=pe.dependencies||[];if(!we.includes(M.id))return {...pe,dependencies:[...we,M.id]}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});De(_($)),ne?.(M.id,F);},[$,ne,Dd]),Ed=react.useCallback((M,F)=>{let _=Q=>Q.map(pe=>{if(pe.id===M&&pe.dependencies){let we=pe.dependencies.filter(Dt=>Dt!==F);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});De(_($)),A?.(M,F);},[$,A]),{startDate:In,endDate:yg}=react.useMemo(()=>{let M=$.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,Dt=new Date(we);Dt.setDate(Dt.getDate()-30);let ft=new Date(we);return ft.setDate(ft.getDate()+60),{startDate:Dt,endDate:ft}}let F=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),_=new Date(Math.min(...F.map(we=>we.getTime()))),Q=new Date(Math.max(...F.map(we=>we.getTime()))),pe=Oe==="day"?7:Oe==="week"?14:30;return _.setDate(_.getDate()-pe),Q.setDate(Q.getDate()+pe),{startDate:_,endDate:Q}},[$,Oe]),vg=react.useCallback(async()=>{if(!Nt.current||!Ra.current||!fe.current)return;await new Promise(so=>setTimeout(so,200));let M=Nt.current,F=Ra.current.querySelector(".gantt-grid-scroll"),_=fe.current,Q=F?.scrollTop||0,pe=F?.scrollLeft||0,we=_.scrollTop,Dt=_.scrollLeft,ft=M.style.overflow,jt=M.style.height,Na=F?.style.overflow||"",Ea=_.style.overflow,$r=M.style.width,Bn=_.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),yr=_.querySelector("svg"),zr=yr?.getAttribute("height")?parseInt(yr.getAttribute("height"),10):yr?.getBoundingClientRect().height||0,Po=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(zr,_.scrollHeight),Fd=yr?.getAttribute("width")?parseInt(yr.getAttribute("width"),10):yr?.getBoundingClientRect().width||_.scrollWidth,Sg=M.querySelector('[class*="h-12"]')?.offsetHeight||48,Qs=Math.max(Po,io,zr),ei=Sg+Qs+50,ti=(F?.offsetWidth||300)+Fd+10;F&&(F.scrollTop=0,F.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,M.style.overflow="visible",M.style.height=`${ei}px`,M.style.width=`${ti}px`,F&&(F.style.overflow="visible",F.style.height=`${Qs+50}px`),_.style.overflow="visible",_.style.height=`${Qs+50}px`,_.style.width=`${Fd+10}px`,await new Promise(ri=>setTimeout(ri,150));let Eg=await jm__default.default(M,{backgroundColor:ot.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:ti,height:ei,windowWidth:ti+100,windowHeight:ei+100,scrollX:0,scrollY:0,ignoreElements:ri=>{let Ad=window.getComputedStyle(ri),Ld=parseInt(Ad.zIndex,10);return !isNaN(Ld)&&Ld>=50||Ad.position==="fixed"}}),ai=document.createElement("a");ai.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ai.href=Eg.toDataURL("image/png"),ai.click();}finally{M.style.overflow=ft,M.style.height=jt,M.style.width=$r,F&&(F.style.overflow=Na,F.style.height="",F.scrollTop=Q,F.scrollLeft=pe),_.style.overflow=Ea,_.style.height="",_.style.width=Bn,_.scrollTop=we,_.scrollLeft=Dt;}},[ot]),xg=react.useCallback(async()=>{await xe.exportToPDF($);},[$]),kg=react.useCallback(async()=>{await xe.exportToExcel($);},[$]),wg=react.useCallback(()=>{let M=xe.exportToCSV($),F=new Blob([M],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[$]),Cg=react.useCallback(()=>{let M=xe.exportToJSON($),F=new Blob([M],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(F),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[$]),Tg=react.useCallback(()=>{xe.exportToMSProject($,"Gantt Project","project.xml");},[$]),Ng=M=>{M.preventDefault(),Ue(true);},Eo=react.useRef(false),[Zs,Pd]=react.useState(false),Zo=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let M=fe.current,F=Ra.current?.querySelector(".gantt-grid-scroll");if(!M||!F)return;let _=()=>{if(Eo.current)return;Eo.current=true;let ft=M.scrollTop;ge(ft),F.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},Q=()=>{if(Eo.current)return;Eo.current=true;let ft=F.scrollTop;ge(ft),M.scrollTop=ft,requestAnimationFrame(()=>{Eo.current=false;});},pe=ft=>{if(Ae&&F){let Na=F.parentElement?.getBoundingClientRect()?.left||0,Ea=ft.clientX-Na,$r=200,Bn=Tt+Sr,so=window.innerWidth*br,yr=Math.max(Bn,so);Ea>=$r&&Ea<=yr&&Pt(Ea);}if(Zs&&M){let jt=ft.clientX-Zo.current.x,Na=ft.clientY-Zo.current.y;M.scrollLeft=Zo.current.scrollLeft-jt,M.scrollTop=Zo.current.scrollTop-Na;}},we=()=>{Ue(false),Pd(false);},Dt=ft=>{if(ft.button!==0)return;let jt=ft.target;jt.closest("[data-task-bar]")||jt.closest("[data-dependency-line]")||jt.closest("button")||jt.closest('[role="button"]')||jt.tagName==="rect"&&jt.getAttribute("data-clickable")==="true"||(Pd(true),Zo.current={x:ft.clientX,y:ft.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},ft.preventDefault());};return M.addEventListener("scroll",_),F.addEventListener("scroll",Q),M.addEventListener("mousedown",Dt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",_),F.removeEventListener("scroll",Q),M.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[Ae,Zs,Tt]);let Md=react.useRef(false),Dg=react.useRef(null);return react.useLayoutEffect(()=>{if(Md.current||$.length===0||!fe.current)return;Md.current=true,Dg.current=In;let M=fe.current,F=new Date,_=Oe==="day"?60:Oe==="week"?20:8,Q=(F.getTime()-In.getTime())/(1e3*60*60*24),pe=M.clientWidth,Dt=Q*_*rt-pe/2;Q>=0&&pe>0&&(M.scrollLeft=Math.max(0,Dt));},[$.length,In,Oe,rt]),jsxRuntime.jsx(Wo.Provider,{value:$e,children:jsxRuntime.jsx(li.Provider,{value:Or,children:jsxRuntime.jsxs("div",{ref:Nt,className:"flex flex-col h-full w-full",style:{backgroundColor:ot.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(us,{theme:ot,timeScale:Oe,onTimeScaleChange:ee,zoom:rt,onZoomChange:ut,currentTheme:ue,onThemeChange:j,rowDensity:Je,onRowDensityChange:Me,showThemeSelector:m,showCreateTaskButton:b,createTaskLabel:y,onCreateTask:w,taskFilter:ce,onTaskFilterChange:Ge,hideCompleted:Be,onHideCompletedChange:B,onExportPNG:i?vg:void 0,onExportPDF:i?xg:void 0,onExportExcel:i?kg:void 0,onExportCSV:i?wg:void 0,onExportJSON:i?Cg:void 0,onExportMSProject:i?Tg:void 0}),jsxRuntime.jsxs("div",{ref:Ra,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:Ba,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(hs,{tasks:P,theme:ot,rowHeight:re,availableUsers:c,templates:oo,onTaskClick:k,onTaskDblClick:Nd,onTaskContextMenu:I,onTaskToggle:ra,scrollTop:X,columns:me,onToggleColumn:ve,onColumnResize:Ze,onTaskUpdate:la,onTaskIndent:oa,onTaskOutdent:or,onTaskMove:Sa,onMultiTaskDelete:no,onTaskDuplicate:ug,onTaskCreate:pg,onTaskRename:gg,onCreateSubtask:Js,onOpenTaskModal:k?M=>k(M):void 0,onDeleteRequest:(M,F)=>qe({taskId:M,taskName:F}),onTaskReparent:Ta})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:ot.border,zIndex:15},onMouseDown:Ng}),jsxRuntime.jsx("div",{ref:fe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Zs?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ns,{tasks:P,theme:ot,rowHeight:re,timeScale:Oe,startDate:In,endDate:yg,zoom:rt,locale:p,templates:oo,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:k,onTaskDblClick:Nd,onTaskContextMenu:bg,onTaskDateChange:fg,onDependencyCreate:Sd,onDependencyDelete:Ed})})]}),ze.task&&jsxRuntime.jsx(Go,{isOpen:ze.isOpen,x:ze.x,y:ze.y,theme:ot,onClose:()=>O({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=ze.task;if(!M)return [];let F=xe.findTaskById($,M.id)||M;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:$e.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?v(F):Js(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:$e.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:$e.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{H?H(F):Le(F);}},{id:"addSubtask",label:$e.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{v?v(F):Js(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:$e.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{te?te(F):la(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:$e.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{oe?oe(F):la(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:$e.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{la(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"duplicate",label:$e.contextMenu?.duplicateTask||"Duplicate Task",icon:Rt.Duplicate,onClick:()=>{De(Q=>gs(Q,[F.id])),O({isOpen:false,x:0,y:0,task:null});}},{id:"split",label:$e.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let Q=F.startDate.getTime(),pe=F.endDate.getTime(),we=Q+(pe-Q)/2,Dt=new Date(we);hg(F,Dt);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:$e.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{qe({taskId:F.id,taskName:F.name});}}]})()}),jsxRuntime.jsx(Mr,{task:ae,isOpen:!!ae,onClose:()=>Le(null),onTaskUpdate:M=>{ae&&(la(ae.id,M),Le(null));},theme:ue==="light"?"light":"dark",locale:p==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:je&&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:()=>qe(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ot.bgSecondary,border:`1px solid ${ot.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ot.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:ot.textPrimary,fontFamily:"Inter, sans-serif"},children:[$e.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:p==="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:ot.textSecondary,fontFamily:"Inter, sans-serif"},children:[p==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ot.textPrimary},children:['"',je.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ot.bgPrimary,borderTop:`1px solid ${ot.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>qe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ot.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=ot.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:p==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{no([je.taskId]),qe(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),p==="es"?"Eliminar":"Delete"]})]})]})})}),T?.enabled&&jsxRuntime.jsx(Ds,{tasks:$,theme:ot,config:T,onTasksUpdate:De,onTaskUpdate:la,onTaskCreate:M=>{De(F=>[...F,M]);},onTaskDelete:M=>{no([M]);},onDependencyCreate:(M,F)=>{let _=xe.findTaskById($,M);_&&Sd(_,F);},onDependencyDelete:Ed})]})})})});function Gy(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Vy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),m=parseInt(a[2],10);return l*60+m}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10):null}var Cl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Tl=[{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 Jm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:x}){let T=[...Cl,...i.filter(B=>!Cl.some(X=>X.id===B.id))],p=et[m]||et.dark,[h,b]=react.useState(false),[y,w]=react.useState(false),[D,N]=react.useState(false),[E,k]=react.useState(false),[R,I]=react.useState({top:0,left:0}),[C,W]=react.useState(null),[H,v]=react.useState(new Date),[te,oe]=react.useState({top:0,left:0}),[ne,A]=react.useState(false),[ke,Ie]=react.useState([]),[L,U]=react.useState(false),[S,K]=react.useState(""),J=react.useRef(null),ie=react.useRef(null),ue=react.useRef(null),ye=react.useRef(null),Oe=react.useRef(null),[ee,Je]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Me,rt]=react.useState({});react.useEffect(()=>{a?(Je({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)&&A(true)):(Je({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),A(false),Ie([]));},[a,e]),react.useEffect(()=>{let B=X=>{J.current&&!J.current.contains(X.target)&&b(false),ie.current&&!ie.current.contains(X.target)&&w(false),ue.current&&!ue.current.contains(X.target)&&N(false),ye.current&&!ye.current.contains(X.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ut=()=>{let B={};return ee.name.trim()||(B.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),rt(B),Object.keys(B).length===0},It=async B=>{if(B.preventDefault(),!!ut())try{let X=l==="create"&&ke.length>0?{...ee,pendingFiles:ke}:ee;await s(X),Ie([]),t();}catch(X){console.error("Error submitting task:",X);}},Xe=(B,X)=>{Je(ge=>{let Ae={...ge,[B]:X};if(B==="status"){let Ue=X;Ue==="todo"?Ae.progress=0:Ue==="in-progress"?(ge.progress===0||ge.progress===100)&&(Ae.progress=50):Ue==="completed"||Ue==="closed"?Ae.progress=100:(Ue==="in-review"||Ue==="review")&&(Ae.progress=75);}if(B==="progress"){let Ue=typeof X=="number"?X:parseInt(X,10);Ue===100&&ge.status!=="completed"?Ae.status="completed":Ue>0&&Ue<100&&ge.status==="todo"?Ae.status="in-progress":Ue===0&&ge.status!=="todo"&&(Ae.status="todo");}return Ae}),Me[B]&&rt(ge=>{let Ae={...ge};return delete Ae[B],Ae});},pt=T.find(B=>B.id===ee.status)??Cl[0],ce=Tl.find(B=>B.id===ee.priority)??Tl[1],Ge=go.find(B=>B.value===ee.color)??go[0],Be={backgroundColor:p.bgSecondary,border:`1px solid ${p.borderLight}`,color:p.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${p.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pt.color||p.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:p.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:p.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=p.hoverBg,B.currentTarget.style.color=p.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=p.textTertiary;},disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:It,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:ee.name,onChange:B=>Xe("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:p.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:ee.description||"",onChange:B=>Xe("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:p.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${p.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:J,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&b(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Be,borderColor:pt.color,backgroundColor:`${pt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:pt.color}}),jsxRuntime.jsx("span",{style:{color:pt.color},children:pt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:pt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&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:p.bgPrimary,border:`1px solid ${p.border}`},children:T.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("status",B.id),b(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,ee.status===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},B.id))})})]}),jsxRuntime.jsxs("div",{ref:ie,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ce.color}}),jsxRuntime.jsx("span",{children:ce.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:p.bgPrimary,border:`1px solid ${p.border}`},children:Tl.map(B=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:p.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("priority",B.id),w(false);},children:[jsxRuntime.jsx("span",{children:B.icon}),B.label,ee.priority===B.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:p.accent}})]},B.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:ue,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((B,X)=>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:B.color||p.accent,borderColor:p.bgSecondary},children:B.initials},X))}),ee.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:p.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:p.textTertiary}}),jsxRuntime.jsx("span",{style:{color:p.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&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:p.bgPrimary,border:`1px solid ${p.border}`},children:o.map(B=>{let X=ee.assignees?.some(ge=>ge.name===B.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:p.textPrimary},onMouseEnter:ge=>ge.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ge=X?(ee.assignees||[]).filter(Ae=>Ae.name!==B.name):[...ee.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(Ae=>Ae[0]).join("").toUpperCase().slice(0,2),color:p.accent}];Xe("assignees",ge);},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:p.accent},children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:p.accent}})})]},B.id)})})})]}),jsxRuntime.jsxs("div",{ref:ye,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(E)k(false);else {if(ye.current){let B=ye.current.getBoundingClientRect(),X=window.innerHeight,ge=120,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;I({top:Ue,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Be,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsxRuntime.jsx("span",{children:Ge.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:p.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let X=ee.color===B.value;return jsxRuntime.jsx("button",{type:"button",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),Xe("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:X?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),c.length>0||d?jsxRuntime.jsx(Gr,{selectedTags:ee.tags||[],availableTags:c,onChange:B=>Xe("tags",B),onCreateTag:d,theme:p,disabled:n}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:p.textTertiary}}),jsxRuntime.jsxs("div",{ref:Oe,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(C==="start")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("start"),v(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:p.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(C==="end")W(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),X=window.innerHeight,ge=320,Ue=X-B.bottom<ge?B.top-ge-8:B.bottom+8;oe({top:Ue,left:B.left});}W("end"),v(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Be,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(yt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${te.top}px`,left:`${te.left}px`,zIndex:99999,backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},onClick:B=>B.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${p.border}`},children:[(()=>{let B=new Date,X=new Date(B);X.setDate(B.getDate()+1);let ge=new Date(B);ge.setDate(B.getDate()+7);let Ae=new Date(B);return Ae.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:ge},{label:"2 semanas",date:Ae}].map((nt,Pt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:p.textPrimary},onMouseEnter:ze=>ze.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:ze=>ze.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(Xe("startDate",nt.date),(!ee.endDate||nt.date>ee.endDate)&&Xe("endDate",nt.date),W("end")):(Xe("endDate",nt.date),(!ee.startDate||nt.date<ee.startDate)&&Xe("startDate",nt.date),W(null));},children:nt.label},Pt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${p.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:B=>B.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{Xe("startDate",void 0),Xe("endDate",void 0),W(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:()=>v(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:p.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:p.textPrimary},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:p.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,X)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:p.textTertiary},children:B},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=H.getFullYear(),X=H.getMonth(),ge=new Date(B,X,1).getDay(),Ae=new Date(B,X+1,0).getDate(),Ue=new Date,nt=[];for(let ze=ge-1;ze>=0;ze--)nt.push({day:new Date(B,X,-ze).getDate(),date:new Date(B,X-1,new Date(B,X,-ze).getDate()),isCurrentMonth:false});for(let ze=1;ze<=Ae;ze++)nt.push({day:ze,date:new Date(B,X,ze),isCurrentMonth:true});let Pt=42-nt.length;for(let ze=1;ze<=Pt;ze++)nt.push({day:ze,date:new Date(B,X+1,ze),isCurrentMonth:false});return nt.map((ze,O)=>{let ae=ze.date.toDateString()===Ue.toDateString(),Le=ee.startDate?.toDateString()===ze.date.toDateString(),je=ee.endDate?.toDateString()===ze.date.toDateString(),qe=ee.startDate&&ee.endDate&&ze.date>=ee.startDate&&ze.date<=ee.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:ze.isCurrentMonth?Le||je?"#FFF":p.textPrimary:p.textTertiary,backgroundColor:Le?"#3B82F6":je?"#7C3AED":qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ae&&!Le&&!je?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(Xe("startDate",ze.date),ee.endDate&&ze.date>ee.endDate&&Xe("endDate",ze.date),W("end")):(Xe("endDate",ze.date),ee.startDate&&ze.date<ee.startDate&&Xe("startDate",ze.date),W(null));},children:ze.day},O)})})()})]})]})]})})]}),Me.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:p.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:ee.progress,onChange:B=>Xe("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:p.bgSecondary,accentColor:ee.progress<30?"#EF4444":ee.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:`${ee.progress<30?"#EF4444":ee.progress<70?"#F59E0B":"#10B981"}20`,color:ee.progress<30?"#EF4444":ee.progress<70?"#F59E0B":"#10B981"},children:[ee.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>A(!ne),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:p.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ne&&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:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:p.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:p.textTertiary},children:"Duraci\xF3n estimada"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"ej: 2h 30m, 4h, 1d",value:ee.effortMinutes?Gy(ee.effortMinutes):"",onChange:B=>{let X=Vy(B.target.value);Xe("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:p.bgSecondary,color:p.textPrimary,border:`1px solid ${p.borderLight}`}}),jsxRuntime.jsx("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:'Formatos: "2h 30m", "4h", "1d" (1 d\xEDa = 8h)'})]}),(f||g.length>0||l==="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:p.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:p.textTertiary},children:["Adjuntos ",l==="create"?ke.length>0&&`(${ke.length})`:g.length>0&&`(${g.length})`]})]}),l==="create"?jsxRuntime.jsx(Cr,{cardId:"pending",attachments:ke.map((B,X)=>({id:`pending-${X}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Ie(X=>[...X,...B]),onDelete:B=>{let X=parseInt(B.replace("pending-",""),10);Ie(ge=>ge.filter((Ae,Ue)=>Ue!==X));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Cr,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?B=>f(a.id,B):void 0,onDelete:x,maxSizeMB:10,maxFiles:20}),l==="create"&&ke.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:p.textTertiary},children:[ke.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:ee.isMilestone,onChange:B=>Xe("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:p.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:p.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:p.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(B=>{let X=r.find(ge=>ge.id===B);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${p.accent}20`,color:p.accent},children:[X?.name||B.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ge=(ee.dependencies||[]).filter(Ae=>Ae!==B);Xe("dependencies",ge);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},B)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{U(!L),K("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:p.bgSecondary,color:p.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),K("");}}),jsxRuntime.jsxs(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 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:p.bgPrimary,border:`1px solid ${p.border}`},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${p.border}`},children:jsxRuntime.jsx("input",{type:"text",value:S,onChange:B=>K(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:p.bgSecondary,color:p.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>S===""||B.name.toLowerCase().includes(S.toLowerCase())).map(B=>{let X=ee.dependencies?.includes(B.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ge=ee.dependencies||[],Ae;X?Ae=ge.filter(Ue=>Ue!==B.id):Ae=[...ge,B.id],Xe("dependencies",Ae);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${p.accent}10`:"transparent"},onMouseEnter:ge=>{X||(ge.currentTarget.style.backgroundColor=p.hoverBg);},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=X?`${p.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?p.accent:"transparent",borderColor:X?p.accent:p.borderLight},children:X&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:p.textPrimary},children:B.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:p.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:p.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${p.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:p.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=p.hoverBg,onMouseLeave:B=>B.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:p.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Zm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
359
359