@libxai/board 0.13.10 → 0.13.11

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
@@ -42,7 +42,7 @@
42
42
  1.
43
43
 
44
44
  **Action items:**
45
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Io({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ce.useRef(null);Ce.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 Ao({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=Ce.useState("export"),[c,i]=Ce.useState("json"),[u,d]=Ce.useState(null),m=Ce.useRef(null);if(!t)return null;let p=async()=>{let b=n?.current||void 0,h=await zs(e,c,b);Us(h,c);},x=async b=>{let h=b.target.files?.[0];if(h){try{let g=await Gs(h),v=h.name.endsWith(".json")?"json":"csv",f=$s(g,v);d(f),f.success&&a&&a(f,g);}catch(g){d({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:[s==="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(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:ae("p-4 rounded-lg border-2 transition-all text-center",c===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:p,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"})]}),s==="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:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:ae("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:ae("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},h))})]})]})]})]})]})}var nm=["URGENT","HIGH","MEDIUM","LOW"],om=[{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"}],sm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Lo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:m=false,groupBy:p="none",onGroupByChange:x}){let[b,h]=Ce.useState(true),g=Ce.useCallback(y=>{r({search:y.target.value});},[r]),v=Ce.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Ce.useCallback(y=>{a({by:y.target.value});},[a]),w=Ce.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:b?"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"}),k&&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)"]})]}),!b&&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:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,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:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:y=>{let T=y.target.value;r({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),nm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let T=y.target.value;r({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let T=y.target.value;r({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:om.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.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:p,onChange:y=>x(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:sm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Fo({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=Ce.useState(false),d=Ce.useRef(null);Ce.useEffect(()=>{let p=x=>{d.current&&!d.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let m=p=>{p(),u(false);};return jsxRuntime.jsxs("div",{className:ae("relative",a),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.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:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(async()=>await o?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(()=>c?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 Bo={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"}},Oo={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"}},zo={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"}},$r={dark:Bo,light:Oo,neutral:zo},yn="dark";var xn=Ce.createContext(void 0),hm="asakaa-theme";function dl({children:e,defaultTheme:t=yn,storageKey:r=hm}){let[a,n]=Ce.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=Ce.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);Ce.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=$r[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${vm(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let m=c.colors[u];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:$r};return jsxRuntime.jsx(xn.Provider,{value:s,children:e})}function na(){let e=Ce.useContext(xn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function vm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Uo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=na();return e?jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",r),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($r).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ae("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var be={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function ul(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return be[e]||be.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",be[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",be[e].bgSecondary),bgGrid:a("--theme-bg-card",be[e].bgGrid),bgWeekend:a("--theme-bg-hover",be[e].bgWeekend),border:a("--theme-border-primary",be[e].border),borderLight:a("--theme-border-subtle",be[e].borderLight),textPrimary:a("--theme-text-primary",be[e].textPrimary),textSecondary:a("--theme-text-secondary",be[e].textSecondary),textTertiary:a("--theme-text-tertiary",be[e].textTertiary),accent:a("--theme-accent-primary",be[e].accent),accentHover:a("--theme-accent-hover",be[e].accentHover),accentLight:a("--theme-accent-primary",be[e].accentLight),taskBarPrimary:a("--theme-accent-primary",be[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",be[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",be[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",be[e].dependency),dependencyHover:a("--theme-border-secondary",be[e].dependencyHover),criticalPath:a("--theme-error",be[e].criticalPath),criticalPathLight:a("--theme-error",be[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",be[e].today):e==="neutral"?a("--theme-text-primary",be[e].today):a("--theme-error",be[e].today),todayLight:e==="light"?a("--theme-accent-primary",be[e].todayLight):e==="neutral"?a("--theme-text-primary",be[e].todayLight):a("--theme-error",be[e].todayLight),milestone:a("--theme-warning",be[e].milestone),milestoneLight:a("--theme-warning",be[e].milestoneLight),statusTodo:a("--theme-text-tertiary",be[e].statusTodo),statusInProgress:a("--theme-accent-primary",be[e].statusInProgress),statusCompleted:a("--theme-success",be[e].statusCompleted),hoverBg:a("--theme-bg-hover",be[e].hoverBg),focusRing:a("--theme-accent-primary",be[e].focusRing)}}function Mm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[l,c]=Ce.useState(false),[i,u]=Ce.useState(null),d=Ce.useRef(null);if(Ce.useEffect(()=>{let b=h=>{d.current&&!d.current.contains(h.target)&&c(false);};return l&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||r||a||n||o||s))return null;let p=[{id:"png",label:"Image",description:"PNG screenshot",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document format",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet format",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data format",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"Project XML format",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(b=>b.handler),x=async(b,h)=>{if(h){u(b);try{await h();}catch(g){console.error(`Export ${b} failed:`,g);}finally{u(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!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:"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:p.map((b,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(b.id,b.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<p.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===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function Go({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.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:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function kn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}){let h=u||d||m||p||x||b,g=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],v=[{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"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Go,{options:g,value:t,onChange:w=>r(w),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Go,{options:f,value:l,onChange:w=>c(w),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mm,{theme:e,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Go,{options:v,value:o,onChange:w=>s(w),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({x:0,y:0}),l=Ce.useRef(null),c=Ce.useRef(null);Ce.useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ze,{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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function sa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Ce.useRef(null);return Ce.useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var Et={Edit:jsxRuntime.jsx(lucideReact.Edit3,{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"}),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"})};function yl({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:m=true}){let p=Ce.useRef(false),x=Ce.useCallback(f=>{p.current=f;},[]),b=Ce.useCallback(f=>{let w=[],k=y=>{for(let T of y)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&k(T.subtasks);};return k(f),w},[]),h=Ce.useCallback(()=>{let f=b(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,b]),g=Ce.useCallback((f,w)=>{let k=b(e);if(k.length===0)return;let y=h();if(!y){r(k[0].id,false);return}let T=k.findIndex(R=>R.id===y.id);if(T===-1)return;let C=f==="up"?T-1:T+1;if(C<0||C>=k.length)return;let D=k[C];r(D.id,w);},[e,h,b,r]),v=Ce.useCallback(f=>{if(!m)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){f.key==="Escape"&&(w.blur(),p.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),D=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(D&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!D.isExpanded||f.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),s(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),l(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Enter"&&!f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&T){D&&(f.preventDefault(),d(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),i(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&T){C.length>0&&(f.preventDefault(),n(C));return}if(f.key==="d"&&T&&!f.shiftKey){C.length>0&&(f.preventDefault(),o(C));return}},[m,t,h,g,a,n,o,s,l,c,i,u,d]);return Ce.useEffect(()=>{if(m)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[m,v]),{setIsEditing:x}}function kl(){let[e,t]=Ce.useState(new Set),[r,a]=Ce.useState(null),n=Ce.useCallback(d=>{t(new Set([d])),a(d);},[]),o=Ce.useCallback(d=>{t(m=>{let p=new Set(m);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=Ce.useCallback((d,m)=>{if(!r){n(d);return}let p=m.indexOf(r),x=m.indexOf(d);if(p===-1||x===-1){n(d);return}let b=Math.min(p,x),h=Math.max(p,x),g=m.slice(b,h+1);t(new Set(g)),a(d);},[r,n]),l=Ce.useCallback((d,m,p,x)=>{x?s(d,m):p?o(d):n(d);},[n,o,s]),c=Ce.useCallback((d,m)=>{m?t(p=>{let x=new Set(p);return x.add(d),x}):n(d);},[n]),i=Ce.useCallback(()=>{t(new Set),a(null);},[]),u=Ce.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function ia(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function _o(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=_o(r.subtasks,t);if(a)return a}return null}function Vo(e,t){if(t.length===0)return e;let r=ia(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,m)=>{let p=[];return {tasks:d.filter(b=>{if(m.has(b.id))return p.push(b),false;if(b.subtasks){let h=s(b.subtasks,m);b.subtasks=h.tasks,p.push(...h.removed);}return true}),removed:p}},l=(d,m,p)=>d.map(x=>x.id===m?{...x,subtasks:[...x.subtasks||[],...p],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,m,p)}:x),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function Ko(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=_o(r,a);if(!n)continue;let o=_o(r,n.id),s=(i,u,d)=>{for(let m=0;m<i.length;m++){let p=i[m];if(p.id===u&&p.subtasks){let x=p.subtasks.findIndex(b=>b.id===d);if(x!==-1){let[b]=p.subtasks.splice(x,1);return b}}if(p.subtasks){let x=s(p.subtasks,u,d);if(x)return x}}return null},l=(i,u,d)=>{let m=i.findIndex(p=>p.id===u);if(m!==-1)return i.splice(m+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function jo(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function Yo(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function qo(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function wl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,s),true};return l(a),{tasks:a,newTask:s}}function Xo(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:Xo(a.subtasks,t,r)}:a)}function Jo(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:Jo(r.subtasks,t)}:r)}function Zo(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=c=>{for(let i of c){if(i.id===t)return i;if(i.subtasks){let u=n(i.subtasks);if(u)return u}}return null},o=n(e),s={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},l=c=>c.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:l(i.subtasks)}:i});return {tasks:l(e),newTask:s}}var Sl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Dl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Nl({status:e="todo",onChange:t,className:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({top:0,left:0}),l=Ce.useRef(null),c=Ce.useRef(null);Ce.useEffect(()=>{if(a&&c.current){let m=c.current.getBoundingClientRect();s({top:m.bottom+window.scrollY+8,left:m.left+window.scrollX});}},[a]),Ce.useEffect(()=>{let m=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),Ce.useEffect(()=>{let m=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let i=m=>{t(m),n(false);},u=Sl[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(Dl,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Ze,{children:jsxRuntime.jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(Sl).map(([m,p])=>jsxRuntime.jsxs("button",{onClick:()=>i(m),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:p.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Dl,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===m&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m))})]})})]})}function Cn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:m,onTaskUpdate:p,onTaskIndent:x,onTaskOutdent:b,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let[T,C]=Ce.useState(null),[D,R]=Ce.useState(false),[B,$]=Ce.useState(null),[I,z]=Ce.useState(""),E=Ce.useRef(null),F=Ce.useRef(null),[U,O]=Ce.useState(null),[X,ne]=Ce.useState(0),[J,Pe]=Ce.useState(0),[P,ke]=Ce.useState({isOpen:false,x:0,y:0,type:"header"});Ce.useEffect(()=>{function _(W){E.current&&!E.current.contains(W.target)&&R(false);}if(D)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[D]),Ce.useEffect(()=>{B&&F.current&&(F.current.focus(),F.current.select());},[B]),Ce.useEffect(()=>{if(!U)return;let _=he=>{let ye=he.clientX-X,Ie=J+ye;m?.(U,Ie);},W=()=>{O(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect="";}},[U,X,J,m]);let{selectedTaskIds:re,handleTaskClick:mt,isTaskSelected:Xe}=kl(),{setIsEditing:Ct}=yl({tasks:e,selectedTaskIds:re,onTaskSelect:(_,W)=>{let ye=ia(e).map(Ie=>Ie.id);mt(_,ye,W||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:_=>{let W=ia(e).find(he=>he.id===_);W&&At(W);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:_=>{let W=ia(e).find(he=>he.id===_);W&&y&&y(W);},enableKeyboard:true}),we=(_,W=0)=>{let he=[];for(let ye of _)he.push({task:ye,level:W}),ye.subtasks&&ye.subtasks.length>0&&ye.isExpanded&&he.push(...we(ye.subtasks,W+1));return he},te=we(e),se=48,Mt=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,At=_=>{$(_.id),z(_.name),Ct(true);},lr=_=>{I.trim()&&I!==e.find(W=>W.id===_)?.name&&w?.(_,I.trim()),$(null),z(""),Ct(false);},ft=()=>{$(null),z(""),Ct(false);},rt=(_,W)=>{W.stopPropagation(),k?.(_.id);},Wt=(_,W,he)=>{switch(_.id){case "name":let ye=B===W.id,Ie=T===W.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${he*20}px`},children:[W.subtasks&&W.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),c?.(W.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:W.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:W.color||"#6366F1",opacity:W.parentId?.6:1,borderColor:W.isMilestone?t.accent:"transparent",borderWidth:W.isMilestone?"2px":"0px"},title:W.isMilestone?"Milestone":W.parentId?"Subtask":"Task"}),ye?jsxRuntime.jsx("input",{ref:F,type:"text",value:I,onChange:ie=>z(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?lr(W.id):ie.key==="Escape"&&ft();},onBlur:()=>lr(W.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:ie=>ie.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he===0?"14px":he===1?"13px":"12px",fontWeight:W.isMilestone?600:W.subtasks&&W.subtasks.length>0?500:400,opacity:he===0?1:he===1?.95:.88},title:W.name,children:W.name}),Ie&&!ye&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>rt(W,ie),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:ie=>{ie.stopPropagation(),At(W);},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":let de=W.startDate?typeof W.startDate=="string"?W.startDate:W.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:ie=>{p?.(W.id,{startDate:ie.target.value?new Date(ie.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let me=W.endDate?typeof W.endDate=="string"?W.endDate:W.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:me||"",onChange:ie=>{p?.(W.id,{endDate:ie.target.value?new Date(ie.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:Mt(W)})});case "assignees":let Lt=a.filter(ie=>W.assignees?.some(ve=>ve.name===ie.name||ve.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(zr,{assignedUsers:Lt,availableUsers:a,onChange:ie=>{let ve=ie.map(K=>({id:K.id,name:K.name,initials:K.initials,color:K.color}));p?.(W.id,{assignees:ve.length>0?ve:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(Nl,{status:W.status||"todo",onChange:ie=>{p?.(W.id,{status:ie,progress:ie==="completed"?100:W.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:`${W.progress}%`,backgroundColor:W.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:[W.progress,"%"]})]});default:return null}},Qt=_=>[{id:"hide",label:"Hide Column",icon:Et.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Et.SortDesc,onClick:()=>{}}],Pr=_=>[{id:"edit",label:"Edit Task",icon:Et.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:Et.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:Et.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:_.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Et.Progress,onClick:()=>{let W=_.status==="completed"?"in-progress":"completed",he=_.status==="completed"?_.progress:100;p?.(_.id,{status:W,progress:he});}},{id:"setInProgress",label:"Set In Progress",icon:Et.Progress,onClick:()=>{p?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Et.Delete,onClick:()=>{window.confirm(`Delete task "${_.name}"?`)&&g?.([_.id]);}}],$t=u.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-auto",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${se}px`,marginLeft:"3px"},children:[$t.map(_=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${_.id==="name"?"justify-start":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.width}px`,maxWidth:`${_.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:W=>{W.preventDefault(),ke({isOpen:true,x:W.clientX,y:W.clientY,type:"header",columnId:_.id});},onMouseEnter:W=>{W.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:W=>{W.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:U===_.id?t.accent:"transparent"},onMouseDown:W=>{W.preventDefault(),W.stopPropagation(),O(_.id),ne(W.clientX),Pe(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},_.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>R(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),D&&jsxRuntime.jsxs("div",{ref:E,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>R(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"})]})]})]})]})]})]})]})]}),te.map(({task:_,level:W},he)=>{let ye=Xe(_.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ye?t.accent:t.borderLight}`,borderRight:`1px solid ${ye?t.accent:t.borderLight}`,borderBottom:`1px solid ${ye?t.accent:t.borderLight}`,borderLeft:ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ye?t.accentLight:he%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(_.id),onMouseLeave:()=>C(null),onClick:Ie=>{let me=ia(e).map(ve=>ve.id),ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;mt(_.id,me,ie,Ie.shiftKey),o?.(_);},onDoubleClick:Ie=>{Ie.stopPropagation(),s?.(_);},onContextMenu:Ie=>{Ie.preventDefault(),ke({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:_}),l?.(_,Ie);},whileHover:{backgroundColor:ye?t.accentLight:t.hoverBg},children:$t.map(Ie=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ie.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.width}px`,maxWidth:`${Ie.width}px`,borderColor:T===_.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Wt(Ie,_,Ie.id==="name"?W:0)},`${_.id}-${Ie.id}`))},_.id)}),jsxRuntime.jsx(sa,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Qt(P.columnId):P.type==="task"&&P.task?Pr(P.task):[],onClose:()=>ke({...P,isOpen:false}),theme:t})]})}function Rl(e,t){let[r,a]=Ce.useState("none"),[n,o]=Ce.useState(0),[s,l]=Ce.useState(e),[c,i]=Ce.useState(t),[u,d]=Ce.useState(null),[m,p]=Ce.useState(null),[x,b]=Ce.useState(null),[h,g]=Ce.useState(null),[v,f]=Ce.useState(0),[w,k]=Ce.useState(0),[y,T]=Ce.useState(null),[C,D]=Ce.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:p,activeZone:x,setActiveZone:b,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(z,E)=>{a("none"),d(null),p(null),l(z),i(E),k(0),g(null),f(0);}}}function Tn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:m,allTaskPositions:p=[],onDragMove:x}){let b=Rl(t,a),h=Ce.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:T,setGhostWidth:C,connectionLine:D,setConnectionLine:R,hoveredTaskId:B,setHoveredTaskId:$,activeZone:I,setActiveZone:z,draggedSegmentIndex:E,setDraggedSegmentIndex:F,draggedSegmentStartX:U,setDraggedSegmentStartX:O,segmentDragOffsetX:X,setSegmentDragOffsetX:ne,hoveredSegmentIndex:J,setHoveredSegmentIndex:Pe,isHovered:P,setIsHovered:ke,isDragging:re,isResizing:mt,isConnecting:Xe,resetDragState:Ct}=b,we=32,te=8,se=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,At=n.name==="neutral"||n.today==="#1C1917",ft=(K=>K>=80?20:K>=60?15:K>=50?12:10)(a),rt=a<50,Wt=a<40,Qt=K=>K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Pr=()=>{let K=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${K} day${K!==1?"s":""}`},$t=K=>Math.round(K/o)*o,_=K=>{let xe=Math.round(K/o),S=new Date(s);return S.setDate(S.getDate()+xe),S},W=(K,xe)=>{for(let S of p){if(S.id===e.id)continue;let G=5;if(K>=S.x-G&&K<=S.x+S.width+G&&xe>=S.y-G&&xe<=S.y+S.height+G)return S.id}return null},he=Ce.useCallback((K,xe,S)=>{K.preventDefault(),K.stopPropagation();let G=h.current?.ownerSVGElement;if(!G)return;let ce=G.createSVGPoint();ce.x=K.clientX,ce.y=K.clientY;let Ee=ce.matrixTransform(G.getScreenCTM()?.inverse()),Fe=S!==void 0?S:t,$e=xe;if(!$e){let Rt=Ee.x-Fe;K.shiftKey?($e="connect",R({x:t+a,y:r+we/2})):K.ctrlKey||K.metaKey?$e="move":K.altKey?$e=Rt<a/2?"resize-start":"resize-end":Wt?Rt<a/2?$e="move":$e="resize-end":rt?Rt<=ft/2?$e="resize-start":Rt>=a-ft/2?$e="resize-end":$e="move":Rt<=ft?$e="resize-start":Rt>=a-ft?$e="resize-end":$e="move";}v($e),ke(false),z(null),$e==="move"?w(Ee.x-Fe):$e==="connect"?R({x:t+a,y:r+we/2}):w(0),y(Fe),C(a);},[t,a,r,we]),ye=Ce.useCallback(K=>{if(g==="none")return;let xe=h.current?.ownerSVGElement;if(!xe)return;let S=xe.createSVGPoint();S.x=K.clientX,S.y=K.clientY;let G=S.matrixTransform(xe.getScreenCTM()?.inverse());if(g==="connect"){R({x:G.x,y:G.y});let ce=W(G.x,G.y);$(ce);}else if(g==="move"){let ce=G.x-f,Ee=$t(ce);y(Ee),C(a);let Fe=Math.round((Ee-t)/o);if(x?.(e.id,Fe,true),e.segments&&e.segments.length>0&&E!==null){let $e=Ee-U;ne($e);}}else if(g==="resize-start"){let ce=G.x,Ee=$t(ce),Fe=t+a-Ee;Fe>=o&&(y(Ee),C(Fe));}else if(g==="resize-end"){let ce=G.x,Fe=$t(ce)-t;Fe>=o&&C(Fe);}},[g,t,a,o,f,e,$t,E,U,W,$,R,y,C,ne,x]),Ie=Ce.useCallback(()=>{if(g!=="none"){if(g==="connect")B&&m&&m(e,B),R(null),$(null);else {let K=e.endDate.getTime()-e.startDate.getTime(),xe,S,G=true;if(g==="move"){if(xe=_(k),S=new Date(xe.getTime()+K),e.segments&&e.segments.length>0&&E!==null){let ce=Math.round(X/o),Ee=e.segments.map((Ft,Gn)=>{if(Gn===E){let ua=new Date(Ft.startDate),pa=new Date(Ft.endDate);return ua.setDate(ua.getDate()+ce),pa.setDate(pa.getDate()+ce),{startDate:ua,endDate:pa}}return Ft}),Fe=Ee.flatMap(Ft=>[Ft.startDate,Ft.endDate]),$e=new Date(Math.min(...Fe.map(Ft=>Ft.getTime()))),Rt=new Date(Math.max(...Fe.map(Ft=>Ft.getTime())));d?.({...e,segments:Ee},$e,Rt),Ct(t,a);return}}else g==="resize-start"?(xe=_(k),S=e.endDate,xe>=S&&(console.warn("Invalid date range: start date must be before end date"),G=false)):g==="resize-end"?(xe=e.startDate,S=_(k+T),S<=xe&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&xe&&S&&(S.getTime()-xe.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,xe,S));}x?.(e.id,0,false),Ct(t,a);}},[g,k,T,e,d,B,m,t,a,o,_,X,E,Ct,x]);Ce.useEffect(()=>{if(g==="none")return;let K=S=>{ye(S);},xe=()=>{Ie();};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",xe),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",xe);}},[g,ye,Ie]);let de=re&&!Xe?k:t,me=re&&!Xe?T:a,Lt=l.taskTooltip(e),ie=typeof Lt=="string"?Lt:"",ve=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!re&&ke(true),onMouseLeave:()=>{re||(ke(false),z(null));},onClick:()=>!re&&c?.(e),onDoubleClick:K=>{re||(K.stopPropagation(),i?.(e));},onContextMenu:K=>{K.preventDefault(),u?.(e,K);},children:[ie&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:ie}}),P&&!re&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ft,height:we,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-start"),onMouseDown:K=>he(K,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ft,y:r,width:a-ft*2,height:we,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:K=>he(K,"move")}),jsxRuntime.jsx("rect",{x:t+a-ft,y:r,width:ft,height:we,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:K=>he(K,"resize-end")})]}),P&&!re&&Wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:we,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:K=>he(K,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:we,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:K=>he(K,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+we-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),re&&!Xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:T,height:we,rx:te,fill:n.accent,opacity:.5,stroke:n.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:de,y:r,width:me,height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":ve,initial:{opacity:0,scale:.95},animate:{opacity:re&&!Xe?.15:e.parentId?.6:P?.9:.8,scale:P&&!re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:K=>he(K),style:{cursor:re?Xe?"crosshair":mt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:de,y:r,width:me*(e.progress/100),height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((K,xe)=>{let S=(K.startDate.getTime()-s.getTime())/864e5*o,ce=(K.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,Ee=re&&g==="move"&&E===xe,Fe=J===xe,$e=Ee?S+X:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!re&&Pe(xe),onMouseLeave:()=>!re&&Pe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:r,width:ce,height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ee||e.parentId?.6:Fe?.9:.8,scale:Fe&&!re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Rt=>{Rt.stopPropagation(),F(xe),O(S),he(Rt,void 0,S);},style:{cursor:re?Xe?"crosshair":mt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:r,width:ce*(e.progress/100),height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${xe}`)}),At&&(se||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!se&&jsxRuntime.jsx("rect",{x:de,y:r,width:me,height:we,rx:te,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsxRuntime.jsx("rect",{x:de,y:r,width:me,height:we,rx:te,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),me>60&&!e.segments&&(()=>{let K=l.taskLabel(e),xe=typeof K=="string"?K:e.name,S=xe.length>Math.floor(me/8)?`${xe.substring(0,Math.floor(me/8))}...`:xe;return jsxRuntime.jsx("text",{x:de+12,y:r+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),me>100&&e.progress>0&&e.progress<100&&!re&&!e.segments&&jsxRuntime.jsxs("text",{x:de+me-12,y:r+we/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&&me>80&&!re&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:de+me-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:de+me-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||mt)&&!Xe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?de-15:de-10,y:r-5,width:rt?25:20,height:we+10,fill:"transparent",onMouseDown:K=>he(K,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?de-8:de-3,y:r+6,width:rt?8:6,height:rt?we-12:we-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:de+me-10,y:r-5,width:rt?25:20,height:we+10,fill:"transparent",onMouseDown:K=>he(K,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?de+me:de+me-3,y:r+6,width:rt?8:6,height:rt?we-12:we-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!re&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+we/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:K=>{K.stopPropagation(),he(K,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+we/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Xe&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+we/2,x2:D.x,y2:D.y,stroke:B?n.statusCompleted:n.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:B?8:6,fill:B?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(P||re)&&!Xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:de-2,y:r-2,width:me+4,height:we+4,rx:te+2,fill:"none",stroke:re?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:re?.6:.4,initial:{opacity:0},animate:{opacity:re?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),mt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+T,y1:0,x2:k+T,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!re&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:de+me/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${de+me/2-6} ${r-13} L ${de+me/2} ${r-3} L ${de+me/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:de+me/2,y:r-73,textAnchor:"middle",fill:n.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:de+me/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:de+me/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.startDate)}),jsxRuntime.jsx("text",{x:de+me/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:de+me/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.endDate)}),jsxRuntime.jsx("text",{x:de+me/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:de+me/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Pr()}),jsxRuntime.jsx("text",{x:de+me/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:de+me/2+65,y:r-40,fill:n.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:de+me/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:de+me/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(K=>K.name).join(", ").substring(0,30),e.assignees.map(K=>K.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:de+me/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Wt?"Left: move \u2022 Right: resize":rt?"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 Dn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=Ce.useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,m=6,p=Math.atan2(i,c),x=r-m*Math.cos(p-Math.PI/6),b=a-m*Math.sin(p-Math.PI/6),h=r-m*Math.cos(p+Math.PI/6),g=a-m*Math.sin(p+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${x} ${b} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function En({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Ce.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var V={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=V.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=V.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=V.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=V.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Io({templates:e,onSelectTemplate:t,className:r}){let[a,n]=Ce.useState(false),o=Ce.useRef(null),s=Ce.useRef(null);Ce.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:ae("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),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:ae("w-4 h-4 transition-transform",a&&"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"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,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(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.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 Ao({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=Ce.useState("export"),[c,i]=Ce.useState("json"),[u,d]=Ce.useState(null),m=Ce.useRef(null);if(!t)return null;let p=async()=>{let b=n?.current||void 0,h=await zs(e,c,b);Us(h,c);},x=async b=>{let h=b.target.files?.[0];if(h){try{let g=await Gs(h),v=h.name.endsWith(".json")?"json":"csv",f=$s(g,v);d(f),f.success&&a&&a(f,g);}catch(g){d({success:false,errors:[`Failed to read file: ${g instanceof Error?g.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),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:r,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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:ae("flex-1 px-6 py-4 font-semibold transition-colors",s==="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:[s==="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(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b),className:ae("p-4 rounded-lg border-2 transition-all text-center",c===b?"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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:p,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"})]}),s==="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:m,type:"file",accept:".json,.csv",onChange:x,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>m.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:ae("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:ae("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((b,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},h))})]})]})]})]})]})}var nm=["URGENT","HIGH","MEDIUM","LOW"],om=[{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"}],sm=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Lo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:m=false,groupBy:p="none",onGroupByChange:x}){let[b,h]=Ce.useState(true),g=Ce.useCallback(y=>{r({search:y.target.value});},[r]),v=Ce.useCallback(y=>{r({dateFilter:y.target.value});},[r]),f=Ce.useCallback(y=>{a({by:y.target.value});},[a]),w=Ce.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:y=>{y.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:b?"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"}),k&&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)"]})]}),!b&&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:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,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:g,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,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:y=>{let T=y.target.value;r({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),nm.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:y=>{let T=y.target.value;r({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(y=>jsxRuntime.jsx("option",{value:y.id,children:y.name},y.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:y=>{let T=y.target.value;r({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]})}),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:f,className:"filter-bar__select filter-bar__select--sm",children:om.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.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:p,onChange:y=>x(y.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:sm.map(y=>jsxRuntime.jsx("option",{value:y.value,children:y.label},y.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Fo({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=Ce.useState(false),d=Ce.useRef(null);Ce.useEffect(()=>{let p=x=>{d.current&&!d.current.contains(x.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let m=p=>{p(),u(false);};return jsxRuntime.jsxs("div",{className:ae("relative",a),ref:d,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.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:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(async()=>await o?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(()=>c?.()),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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:()=>m(r),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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.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 Bo={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"}},Oo={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"}},zo={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"}},$r={dark:Bo,light:Oo,neutral:zo},yn="dark";var xn=Ce.createContext(void 0),hm="asakaa-theme";function dl({children:e,defaultTheme:t=yn,storageKey:r=hm}){let[a,n]=Ce.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=Ce.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);Ce.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=$r[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${vm(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let m=c.colors[u];m&&l.style.setProperty(d,m);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:$r};return jsxRuntime.jsx(xn.Provider,{value:s,children:e})}function na(){let e=Ce.useContext(xn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function vm(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Uo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=na();return e?jsxRuntime.jsxs("div",{className:ae("fixed inset-0 z-[9999] flex items-center justify-center",r),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($r).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ae("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&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"})})]},o))})]})]}):null}var be={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function ul(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return be[e]||be.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",be[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",be[e].bgSecondary),bgGrid:a("--theme-bg-card",be[e].bgGrid),bgWeekend:a("--theme-bg-hover",be[e].bgWeekend),border:a("--theme-border-primary",be[e].border),borderLight:a("--theme-border-subtle",be[e].borderLight),textPrimary:a("--theme-text-primary",be[e].textPrimary),textSecondary:a("--theme-text-secondary",be[e].textSecondary),textTertiary:a("--theme-text-tertiary",be[e].textTertiary),accent:a("--theme-accent-primary",be[e].accent),accentHover:a("--theme-accent-hover",be[e].accentHover),accentLight:a("--theme-accent-primary",be[e].accentLight),taskBarPrimary:a("--theme-accent-primary",be[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",be[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",be[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",be[e].dependency),dependencyHover:a("--theme-border-secondary",be[e].dependencyHover),criticalPath:a("--theme-error",be[e].criticalPath),criticalPathLight:a("--theme-error",be[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",be[e].today):e==="neutral"?a("--theme-text-primary",be[e].today):a("--theme-error",be[e].today),todayLight:e==="light"?a("--theme-accent-primary",be[e].todayLight):e==="neutral"?a("--theme-text-primary",be[e].todayLight):a("--theme-error",be[e].todayLight),milestone:a("--theme-warning",be[e].milestone),milestoneLight:a("--theme-warning",be[e].milestoneLight),statusTodo:a("--theme-text-tertiary",be[e].statusTodo),statusInProgress:a("--theme-accent-primary",be[e].statusInProgress),statusCompleted:a("--theme-success",be[e].statusCompleted),hoverBg:a("--theme-bg-hover",be[e].hoverBg),focusRing:a("--theme-accent-primary",be[e].focusRing)}}function Mm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:o,onExportMSProject:s}){let[l,c]=Ce.useState(false),[i,u]=Ce.useState(null),d=Ce.useRef(null);if(Ce.useEffect(()=>{let b=h=>{d.current&&!d.current.contains(h.target)&&c(false);};return l&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||r||a||n||o||s))return null;let p=[{id:"png",label:"Image",description:"PNG screenshot",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document format",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet format",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data format",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:o},{id:"msproject",label:"MS Project",description:"Project XML format",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(b=>b.handler),x=async(b,h)=>{if(h){u(b);try{await h();}catch(g){console.error(`Export ${b} failed:`,g);}finally{u(null),c(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>c(!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:"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:p.map((b,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>x(b.id,b.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<p.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===b.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"})}):b.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:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function Go({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.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:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function kn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}){let h=u||d||m||p||x||b,g=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],v=[{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"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Go,{options:g,value:t,onChange:w=>r(w),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Go,{options:f,value:l,onChange:w=>c(w),theme:e})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Mm,{theme:e,onExportPNG:u,onExportPDF:d,onExportExcel:m,onExportCSV:p,onExportJSON:x,onExportMSProject:b}),i&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsxRuntime.jsx(Go,{options:v,value:o,onChange:w=>s(w),theme:e})]})]})}function wn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({x:0,y:0}),l=Ce.useRef(null),c=Ce.useRef(null);Ce.useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Ze,{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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function sa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=Ce.useRef(null);return Ce.useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var Et={Edit:jsxRuntime.jsx(lucideReact.Edit3,{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"}),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"})};function yl({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:m=true}){let p=Ce.useRef(false),x=Ce.useCallback(f=>{p.current=f;},[]),b=Ce.useCallback(f=>{let w=[],k=y=>{for(let T of y)w.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&k(T.subtasks);};return k(f),w},[]),h=Ce.useCallback(()=>{let f=b(e);for(let w of f)if(t.has(w.id))return w;return null},[e,t,b]),g=Ce.useCallback((f,w)=>{let k=b(e);if(k.length===0)return;let y=h();if(!y){r(k[0].id,false);return}let T=k.findIndex(R=>R.id===y.id);if(T===-1)return;let C=f==="up"?T-1:T+1;if(C<0||C>=k.length)return;let D=k[C];r(D.id,w);},[e,h,b,r]),v=Ce.useCallback(f=>{if(!m)return;let w=f.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){f.key==="Escape"&&(w.blur(),p.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,C=Array.from(t),D=h();if(f.key==="ArrowUp"){f.preventDefault(),g("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),g("down",f.shiftKey);return}if(D&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!D.isExpanded||f.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){C.length>0&&(f.preventDefault(),s(C,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){C.length>0&&(f.preventDefault(),l(C));return}if(f.key==="Tab"&&f.shiftKey){C.length>0&&(f.preventDefault(),c(C));return}if(f.key==="Enter"&&!f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!T){D&&(f.preventDefault(),a(D.id,"above"));return}if(f.key==="Enter"&&T){D&&(f.preventDefault(),d(D.id));return}if(f.key==="F2"){D&&(f.preventDefault(),i(D.id));return}if(f.key==="Delete"||f.key==="Backspace"&&T){C.length>0&&(f.preventDefault(),n(C));return}if(f.key==="d"&&T&&!f.shiftKey){C.length>0&&(f.preventDefault(),o(C));return}},[m,t,h,g,a,n,o,s,l,c,i,u,d]);return Ce.useEffect(()=>{if(m)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[m,v]),{setIsEditing:x}}function kl(){let[e,t]=Ce.useState(new Set),[r,a]=Ce.useState(null),n=Ce.useCallback(d=>{t(new Set([d])),a(d);},[]),o=Ce.useCallback(d=>{t(m=>{let p=new Set(m);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=Ce.useCallback((d,m)=>{if(!r){n(d);return}let p=m.indexOf(r),x=m.indexOf(d);if(p===-1||x===-1){n(d);return}let b=Math.min(p,x),h=Math.max(p,x),g=m.slice(b,h+1);t(new Set(g)),a(d);},[r,n]),l=Ce.useCallback((d,m,p,x)=>{x?s(d,m):p?o(d):n(d);},[n,o,s]),c=Ce.useCallback((d,m)=>{m?t(p=>{let x=new Set(p);return x.add(d),x}):n(d);},[n]),i=Ce.useCallback(()=>{t(new Set),a(null);},[]),u=Ce.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function ia(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function _o(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=_o(r.subtasks,t);if(a)return a}return null}function Vo(e,t){if(t.length===0)return e;let r=ia(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,m)=>{let p=[];return {tasks:d.filter(b=>{if(m.has(b.id))return p.push(b),false;if(b.subtasks){let h=s(b.subtasks,m);b.subtasks=h.tasks,p.push(...h.removed);}return true}),removed:p}},l=(d,m,p)=>d.map(x=>x.id===m?{...x,subtasks:[...x.subtasks||[],...p],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,m,p)}:x),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function Ko(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=_o(r,a);if(!n)continue;let o=_o(r,n.id),s=(i,u,d)=>{for(let m=0;m<i.length;m++){let p=i[m];if(p.id===u&&p.subtasks){let x=p.subtasks.findIndex(b=>b.id===d);if(x!==-1){let[b]=p.subtasks.splice(x,1);return b}}if(p.subtasks){let x=s(p.subtasks,u,d);if(x)return x}}return null},l=(i,u,d)=>{let m=i.findIndex(p=>p.id===u);if(m!==-1)return i.splice(m+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function jo(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function Yo(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function qo(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function wl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,s),true};return l(a),{tasks:a,newTask:s}}function Xo(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:Xo(a.subtasks,t,r)}:a)}function Jo(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:Jo(r.subtasks,t)}:r)}function Zo(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=c=>{for(let i of c){if(i.id===t)return i;if(i.subtasks){let u=n(i.subtasks);if(u)return u}}return null},o=n(e),s={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},l=c=>c.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:l(i.subtasks)}:i});return {tasks:l(e),newTask:s}}var Sl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Dl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Nl({status:e="todo",onChange:t,className:r}){let[a,n]=Ce.useState(false),[o,s]=Ce.useState({top:0,left:0}),l=Ce.useRef(null),c=Ce.useRef(null);Ce.useEffect(()=>{if(a&&c.current){let m=c.current.getBoundingClientRect();s({top:m.bottom+window.scrollY+8,left:m.left+window.scrollX});}},[a]),Ce.useEffect(()=>{let m=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),Ce.useEffect(()=>{let m=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let i=m=>{t(m),n(false);},u=Sl[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(Dl,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Ze,{children:jsxRuntime.jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(Sl).map(([m,p])=>jsxRuntime.jsxs("button",{onClick:()=>i(m),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:p.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Dl,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===m&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m))})]})})]})}function Cn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onColumnResize:m,onTaskUpdate:p,onTaskIndent:x,onTaskOutdent:b,onTaskMove:h,onMultiTaskDelete:g,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:w,onCreateSubtask:k,onOpenTaskModal:y}){let[T,C]=Ce.useState(null),[D,R]=Ce.useState(false),[B,$]=Ce.useState(null),[I,z]=Ce.useState(""),E=Ce.useRef(null),F=Ce.useRef(null),[U,O]=Ce.useState(null),[X,ne]=Ce.useState(0),[J,Pe]=Ce.useState(0),[P,ke]=Ce.useState({isOpen:false,x:0,y:0,type:"header"});Ce.useEffect(()=>{function _(W){E.current&&!E.current.contains(W.target)&&R(false);}if(D)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[D]),Ce.useEffect(()=>{B&&F.current&&(F.current.focus(),F.current.select());},[B]),Ce.useEffect(()=>{if(!U)return;let _=he=>{let ye=he.clientX-X,Ie=J+ye;m?.(U,Ie);},W=()=>{O(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",W),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",W),document.body.style.cursor="",document.body.style.userSelect="";}},[U,X,J,m]);let{selectedTaskIds:re,handleTaskClick:mt,isTaskSelected:Xe}=kl(),{setIsEditing:Ct}=yl({tasks:e,selectedTaskIds:re,onTaskSelect:(_,W)=>{let ye=ia(e).map(Ie=>Ie.id);mt(_,ye,W||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:_=>{let W=ia(e).find(he=>he.id===_);W&&At(W);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:_=>{let W=ia(e).find(he=>he.id===_);W&&y&&y(W);},enableKeyboard:true}),we=(_,W=0)=>{let he=[];for(let ye of _)he.push({task:ye,level:W}),ye.subtasks&&ye.subtasks.length>0&&ye.isExpanded&&he.push(...we(ye.subtasks,W+1));return he},te=we(e),se=48,Mt=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,At=_=>{$(_.id),z(_.name),Ct(true);},lr=_=>{I.trim()&&I!==e.find(W=>W.id===_)?.name&&w?.(_,I.trim()),$(null),z(""),Ct(false);},ft=()=>{$(null),z(""),Ct(false);},rt=(_,W)=>{W.stopPropagation(),k?.(_.id);},Wt=(_,W,he)=>{switch(_.id){case "name":let ye=B===W.id,Ie=T===W.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${he*20}px`},children:[W.subtasks&&W.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ie=>{ie.stopPropagation(),c?.(W.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:W.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"}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:W.color||"#6366F1",opacity:W.parentId?.6:1,borderColor:W.isMilestone?t.accent:"transparent",borderWidth:W.isMilestone?"2px":"0px"},title:W.isMilestone?"Milestone":W.parentId?"Subtask":"Task"}),ye?jsxRuntime.jsx("input",{ref:F,type:"text",value:I,onChange:ie=>z(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?lr(W.id):ie.key==="Escape"&&ft();},onBlur:()=>lr(W.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:ie=>ie.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he===0?"14px":he===1?"13px":"12px",fontWeight:W.isMilestone?600:W.subtasks&&W.subtasks.length>0?500:400,opacity:he===0?1:he===1?.95:.88},title:W.name,children:W.name}),Ie&&!ye&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ie=>rt(W,ie),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:ie=>{ie.stopPropagation(),At(W);},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":let de=W.startDate?typeof W.startDate=="string"?W.startDate:W.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:de||"",onChange:ie=>{p?.(W.id,{startDate:ie.target.value?new Date(ie.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let me=W.endDate?typeof W.endDate=="string"?W.endDate:W.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:me||"",onChange:ie=>{p?.(W.id,{endDate:ie.target.value?new Date(ie.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});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:Mt(W)})});case "assignees":let Lt=a.filter(ie=>W.assignees?.some(ve=>ve.name===ie.name||ve.initials===ie.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(zr,{assignedUsers:Lt,availableUsers:a,onChange:ie=>{let ve=ie.map(K=>({id:K.id,name:K.name,initials:K.initials,color:K.color}));p?.(W.id,{assignees:ve.length>0?ve:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsxRuntime.jsx(Nl,{status:W.status||"todo",onChange:ie=>{p?.(W.id,{status:ie,progress:ie==="completed"?100:W.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:`${W.progress}%`,backgroundColor:W.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:[W.progress,"%"]})]});default:return null}},Qt=_=>[{id:"hide",label:"Hide Column",icon:Et.Hide,onClick:()=>d(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Et.SortDesc,onClick:()=>{}}],Pr=_=>[{id:"edit",label:"Edit Task",icon:Et.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:Et.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:Et.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:_.status==="completed"?"Mark Incomplete":"Mark Complete",icon:Et.Progress,onClick:()=>{let W=_.status==="completed"?"in-progress":"completed",he=_.status==="completed"?_.progress:100;p?.(_.id,{status:W,progress:he});}},{id:"setInProgress",label:"Set In Progress",icon:Et.Progress,onClick:()=>{p?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:Et.Delete,onClick:()=>{window.confirm(`Delete task "${_.name}"?`)&&g?.([_.id]);}}],$t=u.filter(_=>_.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${se}px`,marginLeft:"3px"},children:[$t.map(_=>jsxRuntime.jsxs("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${_.id==="name"?"justify-start":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.width}px`,maxWidth:`${_.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:W=>{W.preventDefault(),ke({isOpen:true,x:W.clientX,y:W.clientY,type:"header",columnId:_.id});},onMouseEnter:W=>{W.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:W=>{W.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-500 transition-colors group",style:{backgroundColor:U===_.id?t.accent:"transparent"},onMouseDown:W=>{W.preventDefault(),W.stopPropagation(),O(_.id),ne(W.clientX),Pe(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute right-0 top-2 bottom-2 w-0.5 opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:t.accent}})})]},_.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(wn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>R(!D),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),D&&jsxRuntime.jsxs("div",{ref:E,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>R(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"})]})]})]})]})]})]})]})]}),te.map(({task:_,level:W},he)=>{let ye=Xe(_.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ye?t.accent:t.borderLight}`,borderRight:`1px solid ${ye?t.accent:t.borderLight}`,borderBottom:`1px solid ${ye?t.accent:t.borderLight}`,borderLeft:ye?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ye?t.accentLight:he%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(_.id),onMouseLeave:()=>C(null),onClick:Ie=>{let me=ia(e).map(ve=>ve.id),ie=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;mt(_.id,me,ie,Ie.shiftKey),o?.(_);},onDoubleClick:Ie=>{Ie.stopPropagation(),s?.(_);},onContextMenu:Ie=>{Ie.preventDefault(),ke({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:_}),l?.(_,Ie);},whileHover:{backgroundColor:ye?t.accentLight:t.hoverBg},children:$t.map(Ie=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ie.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.width}px`,maxWidth:`${Ie.width}px`,borderColor:T===_.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:Wt(Ie,_,Ie.id==="name"?W:0)},`${_.id}-${Ie.id}`))},_.id)}),jsxRuntime.jsx(sa,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?Qt(P.columnId):P.type==="task"&&P.task?Pr(P.task):[],onClose:()=>ke({...P,isOpen:false}),theme:t})]})}function Rl(e,t){let[r,a]=Ce.useState("none"),[n,o]=Ce.useState(0),[s,l]=Ce.useState(e),[c,i]=Ce.useState(t),[u,d]=Ce.useState(null),[m,p]=Ce.useState(null),[x,b]=Ce.useState(null),[h,g]=Ce.useState(null),[v,f]=Ce.useState(0),[w,k]=Ce.useState(0),[y,T]=Ce.useState(null),[C,D]=Ce.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:m,setHoveredTaskId:p,activeZone:x,setActiveZone:b,draggedSegmentIndex:h,setDraggedSegmentIndex:g,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:y,setHoveredSegmentIndex:T,isHovered:C,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(z,E)=>{a("none"),d(null),p(null),l(z),i(E),k(0),g(null),f(0);}}}function Tn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:m,allTaskPositions:p=[],onDragMove:x}){let b=Rl(t,a),h=Ce.useRef(null),{dragMode:g,setDragMode:v,dragOffset:f,setDragOffset:w,ghostX:k,setGhostX:y,ghostWidth:T,setGhostWidth:C,connectionLine:D,setConnectionLine:R,hoveredTaskId:B,setHoveredTaskId:$,activeZone:I,setActiveZone:z,draggedSegmentIndex:E,setDraggedSegmentIndex:F,draggedSegmentStartX:U,setDraggedSegmentStartX:O,segmentDragOffsetX:X,setSegmentDragOffsetX:ne,hoveredSegmentIndex:J,setHoveredSegmentIndex:Pe,isHovered:P,setIsHovered:ke,isDragging:re,isResizing:mt,isConnecting:Xe,resetDragState:Ct}=b,we=32,te=8,se=e.endDate&&e.endDate<new Date&&e.progress<100,Mt=e.isCriticalPath,At=n.name==="neutral"||n.today==="#1C1917",ft=(K=>K>=80?20:K>=60?15:K>=50?12:10)(a),rt=a<50,Wt=a<40,Qt=K=>K.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Pr=()=>{let K=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${K} day${K!==1?"s":""}`},$t=K=>Math.round(K/o)*o,_=K=>{let xe=Math.round(K/o),S=new Date(s);return S.setDate(S.getDate()+xe),S},W=(K,xe)=>{for(let S of p){if(S.id===e.id)continue;let G=5;if(K>=S.x-G&&K<=S.x+S.width+G&&xe>=S.y-G&&xe<=S.y+S.height+G)return S.id}return null},he=Ce.useCallback((K,xe,S)=>{K.preventDefault(),K.stopPropagation();let G=h.current?.ownerSVGElement;if(!G)return;let ce=G.createSVGPoint();ce.x=K.clientX,ce.y=K.clientY;let Ee=ce.matrixTransform(G.getScreenCTM()?.inverse()),Fe=S!==void 0?S:t,$e=xe;if(!$e){let Rt=Ee.x-Fe;K.shiftKey?($e="connect",R({x:t+a,y:r+we/2})):K.ctrlKey||K.metaKey?$e="move":K.altKey?$e=Rt<a/2?"resize-start":"resize-end":Wt?Rt<a/2?$e="move":$e="resize-end":rt?Rt<=ft/2?$e="resize-start":Rt>=a-ft/2?$e="resize-end":$e="move":Rt<=ft?$e="resize-start":Rt>=a-ft?$e="resize-end":$e="move";}v($e),ke(false),z(null),$e==="move"?w(Ee.x-Fe):$e==="connect"?R({x:t+a,y:r+we/2}):w(0),y(Fe),C(a);},[t,a,r,we]),ye=Ce.useCallback(K=>{if(g==="none")return;let xe=h.current?.ownerSVGElement;if(!xe)return;let S=xe.createSVGPoint();S.x=K.clientX,S.y=K.clientY;let G=S.matrixTransform(xe.getScreenCTM()?.inverse());if(g==="connect"){R({x:G.x,y:G.y});let ce=W(G.x,G.y);$(ce);}else if(g==="move"){let ce=G.x-f,Ee=$t(ce);y(Ee),C(a);let Fe=Math.round((Ee-t)/o);if(x?.(e.id,Fe,true),e.segments&&e.segments.length>0&&E!==null){let $e=Ee-U;ne($e);}}else if(g==="resize-start"){let ce=G.x,Ee=$t(ce),Fe=t+a-Ee;Fe>=o&&(y(Ee),C(Fe));}else if(g==="resize-end"){let ce=G.x,Fe=$t(ce)-t;Fe>=o&&C(Fe);}},[g,t,a,o,f,e,$t,E,U,W,$,R,y,C,ne,x]),Ie=Ce.useCallback(()=>{if(g!=="none"){if(g==="connect")B&&m&&m(e,B),R(null),$(null);else {let K=e.endDate.getTime()-e.startDate.getTime(),xe,S,G=true;if(g==="move"){if(xe=_(k),S=new Date(xe.getTime()+K),e.segments&&e.segments.length>0&&E!==null){let ce=Math.round(X/o),Ee=e.segments.map((Ft,Gn)=>{if(Gn===E){let ua=new Date(Ft.startDate),pa=new Date(Ft.endDate);return ua.setDate(ua.getDate()+ce),pa.setDate(pa.getDate()+ce),{startDate:ua,endDate:pa}}return Ft}),Fe=Ee.flatMap(Ft=>[Ft.startDate,Ft.endDate]),$e=new Date(Math.min(...Fe.map(Ft=>Ft.getTime()))),Rt=new Date(Math.max(...Fe.map(Ft=>Ft.getTime())));d?.({...e,segments:Ee},$e,Rt),Ct(t,a);return}}else g==="resize-start"?(xe=_(k),S=e.endDate,xe>=S&&(console.warn("Invalid date range: start date must be before end date"),G=false)):g==="resize-end"?(xe=e.startDate,S=_(k+T),S<=xe&&(console.warn("Invalid date range: end date must be after start date"),G=false)):G=false;G&&xe&&S&&(S.getTime()-xe.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,xe,S));}x?.(e.id,0,false),Ct(t,a);}},[g,k,T,e,d,B,m,t,a,o,_,X,E,Ct,x]);Ce.useEffect(()=>{if(g==="none")return;let K=S=>{ye(S);},xe=()=>{Ie();};return window.addEventListener("mousemove",K),window.addEventListener("mouseup",xe),()=>{window.removeEventListener("mousemove",K),window.removeEventListener("mouseup",xe);}},[g,ye,Ie]);let de=re&&!Xe?k:t,me=re&&!Xe?T:a,Lt=l.taskTooltip(e),ie=typeof Lt=="string"?Lt:"",ve=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!re&&ke(true),onMouseLeave:()=>{re||(ke(false),z(null));},onClick:()=>!re&&c?.(e),onDoubleClick:K=>{re||(K.stopPropagation(),i?.(e));},onContextMenu:K=>{K.preventDefault(),u?.(e,K);},children:[ie&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:ie}}),P&&!re&&!rt&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:ft,height:we,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-start"),onMouseDown:K=>he(K,"resize-start")}),jsxRuntime.jsx("rect",{x:t+ft,y:r,width:a-ft*2,height:we,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:K=>he(K,"move")}),jsxRuntime.jsx("rect",{x:t+a-ft,y:r,width:ft,height:we,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:K=>he(K,"resize-end")})]}),P&&!re&&Wt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:we,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:K=>he(K,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:we,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:K=>he(K,"resize-end")}),P&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+we-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),re&&!Xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:k,y:r,width:T,height:we,rx:te,fill:n.accent,opacity:.5,stroke:n.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:de,y:r,width:me,height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":ve,initial:{opacity:0,scale:.95},animate:{opacity:re&&!Xe?.15:e.parentId?.6:P?.9:.8,scale:P&&!re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:K=>he(K),style:{cursor:re?Xe?"crosshair":mt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:de,y:r,width:me*(e.progress/100),height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((K,xe)=>{let S=(K.startDate.getTime()-s.getTime())/864e5*o,ce=(K.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-S+o,Ee=re&&g==="move"&&E===xe,Fe=J===xe,$e=Ee?S+X:S;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!re&&Pe(xe),onMouseLeave:()=>!re&&Pe(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:$e,y:r,width:ce,height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:Ee||e.parentId?.6:Fe?.9:.8,scale:Fe&&!re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Rt=>{Rt.stopPropagation(),F(xe),O(S),he(Rt,void 0,S);},style:{cursor:re?Xe?"crosshair":mt?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:$e,y:r,width:ce*(e.progress/100),height:we,rx:te,fill:e.isCriticalPath||se?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${xe}`)}),At&&(se||Mt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Mt&&!se&&jsxRuntime.jsx("rect",{x:de,y:r,width:me,height:we,rx:te,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),se&&jsxRuntime.jsx("rect",{x:de,y:r,width:me,height:we,rx:te,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),me>60&&!e.segments&&(()=>{let K=l.taskLabel(e),xe=typeof K=="string"?K:e.name,S=xe.length>Math.floor(me/8)?`${xe.substring(0,Math.floor(me/8))}...`:xe;return jsxRuntime.jsx("text",{x:de+12,y:r+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S})})(),me>100&&e.progress>0&&e.progress<100&&!re&&!e.segments&&jsxRuntime.jsxs("text",{x:de+me-12,y:r+we/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&&me>80&&!re&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:de+me-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:de+me-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(P||mt)&&!Xe&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:rt?de-15:de-10,y:r-5,width:rt?25:20,height:we+10,fill:"transparent",onMouseDown:K=>he(K,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?de-8:de-3,y:r+6,width:rt?8:6,height:rt?we-12:we-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:de+me-10,y:r-5,width:rt?25:20,height:we+10,fill:"transparent",onMouseDown:K=>he(K,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:rt?de+me:de+me-3,y:r+6,width:rt?8:6,height:rt?we-12:we-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!re&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+we/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:K=>{K.stopPropagation(),he(K,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+we/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Xe&&D&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+we/2,x2:D.x,y2:D.y,stroke:B?n.statusCompleted:n.accent,strokeWidth:B?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:B?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:D.x,cy:D.y,r:B?8:6,fill:B?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),B&&jsxRuntime.jsx(framerMotion.motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(P||re)&&!Xe&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:de-2,y:r-2,width:me+4,height:we+4,rx:te+2,fill:"none",stroke:re?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:re?.6:.4,initial:{opacity:0},animate:{opacity:re?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),mt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:k+T,y1:0,x2:k+T,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&!re&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:de+me/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${de+me/2-6} ${r-13} L ${de+me/2} ${r-3} L ${de+me/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:de+me/2,y:r-73,textAnchor:"middle",fill:n.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:de+me/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:de+me/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.startDate)}),jsxRuntime.jsx("text",{x:de+me/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:de+me/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qt(e.endDate)}),jsxRuntime.jsx("text",{x:de+me/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:de+me/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Pr()}),jsxRuntime.jsx("text",{x:de+me/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:de+me/2+65,y:r-40,fill:n.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:de+me/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:de+me/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(K=>K.name).join(", ").substring(0,30),e.assignees.map(K=>K.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:de+me/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Wt?"Left: move \u2022 Right: resize":rt?"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 Dn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=Ce.useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,m=6,p=Math.atan2(i,c),x=r-m*Math.cos(p-Math.PI/6),b=a-m*Math.sin(p-Math.PI/6),h=r-m*Math.cos(p+Math.PI/6),g=a-m*Math.sin(p+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${x} ${b} M ${r} ${a} L ${h} ${g}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:f=>{f.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function En({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=Ce.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var V={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=V.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=V.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=V.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=V.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
46
46
  `)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=V.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=V.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>V.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=V.findTaskById(e,t);return !r||!r.dependencies?[]:V.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>V.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>V.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=V.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>V.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=V.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=o.map(c=>{let i=c.startDate&&c.endDate?V.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?V.formatDate(c.startDate):"N/A",c.endDate?V.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});a(n,{head:s,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}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=V.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?V.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?V.formatDate(c.startDate):"","End Date":c.endDate?V.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(u=>u.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let l=r.utils.book_new();r.utils.book_append_sheet(l,o,"Gantt Tasks"),r.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=V.flattenTasks(e),n=new Map;a.forEach((m,p)=>{n.set(m.id,p+1);});let o=m=>m.toISOString().replace("Z",""),s=V.getEarliestStartDate(e)||new Date,l=V.getLatestEndDate(e)||new Date,c=a.map((m,p)=>{let x=n.get(m.id),b=m.startDate&&m.endDate?V.calculateDuration(m.startDate,m.endDate):0,h=(m.dependencies||[]).filter(g=>n.has(g)).map(g=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${n.get(g)}</PredecessorUID>