@libxai/board 0.17.134 → 0.17.136

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 as({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},m=e.reduce((n,p)=>{let l=p.category||"Other";return n[l]||(n[l]=[]),n[l].push(p),n},{});return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:k("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([n,p])=>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:n})}),jsxRuntime.jsx("div",{children:p.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),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 os({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[m,n]=react.useState("json"),[p,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Mi(e,m,f);Ai(y,m);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Fi(y),b=y.name.endsWith(".json")?"json":"csv",g=Li(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:k("p-4 rounded-lg border-2 transition-all text-center",m===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.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"})]})]}),p&&jsxRuntime.jsxs("div",{className:k("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:k("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var tu=["URGENT","HIGH","MEDIUM","LOW"],au=[{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"}],ru=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ns({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:n=[],availableColumns:p=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,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:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let A=h.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),tu.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let A=h.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let A=h.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:au.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ru.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ss({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[n,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&p(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:k("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await d?.()),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await 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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 is={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"}},ls={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"}},ds={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"}},lr={dark:is,light:ls,neutral:ds},Io="dark";var Lo=react.createContext(void 0),uu="asakaa-theme";function Il({children:e,defaultTheme:t=Io,storageKey:a=uu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=lr[r];Object.entries(m.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${gu(p)}`,l);}),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(([p,l])=>{let i=m.colors[p];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:lr};return jsxRuntime.jsx(Lo.Provider,{value:d,children:e})}function Pr(){let e=react.useContext(Lo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function cs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Pr();return e?jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(lr).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:k("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var Oe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",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:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function Ll(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Oe[e]||Oe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Oe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Oe[e].bgSecondary),bgGrid:r("--theme-bg-card",Oe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Oe[e].bgWeekend),border:r("--theme-border-primary",Oe[e].border),borderLight:r("--theme-border-subtle",Oe[e].borderLight),textPrimary:r("--theme-text-primary",Oe[e].textPrimary),textSecondary:r("--theme-text-secondary",Oe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Oe[e].textTertiary),accent:r("--theme-accent-primary",Oe[e].accent),accentHover:r("--theme-accent-hover",Oe[e].accentHover),accentLight:r("--theme-accent-primary",Oe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Oe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Oe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Oe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Oe[e].dependency),dependencyHover:r("--theme-border-secondary",Oe[e].dependencyHover),criticalPath:r("--theme-error",Oe[e].criticalPath),criticalPathLight:r("--theme-error",Oe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Oe[e].today):e==="neutral"?r("--theme-text-primary",Oe[e].today):r("--theme-error",Oe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Oe[e].todayLight):e==="neutral"?r("--theme-text-primary",Oe[e].todayLight):r("--theme-error",Oe[e].todayLight),milestone:r("--theme-warning",Oe[e].milestone),milestoneLight:r("--theme-warning",Oe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Oe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Oe[e].statusInProgress),statusCompleted:r("--theme-success",Oe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Oe[e].hoverBg),focusRing:r("--theme-accent-primary",Oe[e].focusRing)}}var Fo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Fl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ms={en:Fo,es:Fl};function Bl(e){return ms[e]||ms.en}function ps(e,t){let a=Bl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Ar=react.createContext(Fo);function to(){return react.useContext(Ar)}function Au({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,m]=react.useState(false),[n,p]=react.useState(null),l=react.useRef(null),i=to();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&m(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){p(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#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:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.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:n===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Iu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let d=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Lu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Fu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=to();react.useEffect(()=>{let n=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,p)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Bo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=to(),C=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Lu,{options:D,value:t,onChange:A=>a(A),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(C||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Au,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Iu,{options:h,value:s,onChange:A=>d(A),theme:e})]})]})}function Ro({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let n=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Ir({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+p+i>u&&(f=t-p,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),m({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var lt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let C=[],D=h=>{for(let A of h)C.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(g),C},[]),y=react.useCallback(()=>{let g=f(e);for(let C of g)if(t.has(C.id))return C;return null},[e,t,f]),x=react.useCallback((g,C)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===h.id);if(A===-1)return;let w=g==="up"?A-1:A+1;if(w<0||w>=D.length)return;let L=D[w];a(L.id,C);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let C=g.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||u.current){g.key==="Escape"&&(C.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,w=Array.from(t),L=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(L&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!L.isExpanded||g.key==="ArrowLeft"&&L.isExpanded)&&p(L.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){w.length>0&&(g.preventDefault(),d(w,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){w.length>0&&(g.preventDefault(),c(w));return}if(g.key==="Tab"&&g.shiftKey){w.length>0&&(g.preventDefault(),m(w));return}if(g.key==="Enter"&&!g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"above"));return}if(g.key==="Enter"&&A){L&&(g.preventDefault(),l(L.id));return}if(g.key==="F2"){L&&(g.preventDefault(),n(L.id));return}if(g.key==="Delete"||g.key==="Backspace"&&A){w.length>0&&(g.preventDefault(),o(w));return}if(g.key==="d"&&A&&!g.shiftKey){w.length>0&&(g.preventDefault(),s(w));return}},[i,t,y,x,r,o,s,d,c,m,n,p,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Xl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),m=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:p}}function Lr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Jl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Jl(a.subtasks,t);if(r)return r}}return null}function fs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=fs(a.subtasks,t);if(r)return r}return null}function bs(e,t){if(t.length===0)return e;let a=Lr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),m=new Set(t),{tasks:n,removed:p}=d(e,m);return c(n,s.id,p)}function hs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=fs(a,r);if(!o)continue;let s=fs(a,o.id),d=(n,p,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,p,l);if(v)return v}}return null},c=(n,p,l)=>{let i=n.findIndex(u=>u.id===p);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,p,l);return n},m=d(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ys(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,m)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,m))return true;return false}let p=m==="up"?n-1:n+1;return p<0||p>=d.length?false:([d[n],d[p]]=[d[p],d[n]],true)};return s(r,o,a),r}function vs(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function xs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Zl(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let n=m.findIndex(l=>l.id===t);if(n===-1){for(let l of m)if(l.subtasks&&c(l.subtasks))return true;return false}let p=a==="above"?n:n+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function ks(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ks(r.subtasks,t,a)}:r)}function ws(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ws(a.subtasks,t)}:a)}function Cs(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=p=>p.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,m],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:m}}function Ql(e,t,a,r){if(t===a)return e;let o=Jl(e,t);if(!o)return e;if(a){let c=(m,n)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===n||c(p,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(n=>{if(n.id===a){let p=n.subtasks||[],l=r!==void 0?r:p.length,i=[...p];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function $o({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:n,columns:p,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:C,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:A,onTaskReparent:w}){let L=react.useContext(Ar),[T,$]=react.useState(null),[G,z]=react.useState(false),[E,X]=react.useState(null),[fe,Ce]=react.useState(""),Le=react.useRef(null),Pe=react.useRef(null),[ce,S]=react.useState(null),[F,M]=react.useState(0),[V,P]=react.useState(0),[W,de]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ae,Ee]=react.useState(null),[le,Ve]=react.useState(null),[he,at]=react.useState(null),Et=react.useRef(0),gt=5,ft=react.useRef(false),[rt,ot]=react.useState(null);react.useEffect(()=>{function R(H){Le.current&&!Le.current.contains(H.target)&&z(false);}if(G)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[G]),react.useEffect(()=>{E&&Pe.current&&(Pe.current.focus(),Pe.current.select());},[E]),react.useEffect(()=>{if(!ce)return;let R=q=>{let se=q.clientX-F,ie=V+se;i?.(ce,ie);},H=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",R),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,F,V,i]);let{selectedTaskIds:la,handleTaskClick:wt,isTaskSelected:ct}=Xl(),{setIsEditing:Lt}=Yl({tasks:e,selectedTaskIds:la,onTaskSelect:(R,H)=>{let se=Lr(e).map(ie=>ie.id);wt(R,se,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:R=>{let H=Lr(e).find(q=>q.id===R);H&&Ue(H);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:R=>{let H=Lr(e).find(q=>q.id===R);H&&h&&h(H);},enableKeyboard:true}),jt=(R,H=0)=>{let q=[];for(let se of R)q.push({task:se,level:H}),se.subtasks&&se.subtasks.length>0&&se.isExpanded&&q.push(...jt(se.subtasks,H+1));return q},we=jt(e),O=48,De=R=>!R.startDate||!R.endDate?"-":`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))}d`,Ue=R=>{X(R.id),Ce(R.name),Lt(true);},$e=R=>{fe.trim()&&fe!==e.find(H=>H.id===R)?.name&&C?.(R,fe.trim()),X(null),Ce(""),Lt(false);},bt=()=>{X(null),Ce(""),Lt(false);},J=(R,H)=>{H.stopPropagation(),D?.(R.id);},Q=(R,H)=>{H.preventDefault(),Et.current=H.clientY,Ee(R),ft.current=false;},xe=R=>{if(!ae||(Math.abs(R.clientY-Et.current)>gt&&(ft.current=true),!ft.current))return;let q=document.querySelectorAll("[data-task-row]"),se=null,ie=null;q.forEach(B=>{let K=B.getBoundingClientRect(),Ne=B.getAttribute("data-task-row");if(Ne&&Ne!==ae&&R.clientY>=K.top&&R.clientY<=K.bottom){se=Ne;let je=R.clientY-K.top,Pt=K.height;je<Pt*.25?ie="above":je>Pt*.75?ie="below":ie="child";}}),Ve(se),at(ie);},ge=()=>{if(ft.current&&ae&&le&&he){if(he==="child")w?.(ae,le);else if(he==="above"||he==="below"){let R=(se,ie,B=null)=>{for(let K of se){if(K.id===ie)return B;if(K.subtasks){let Ne=R(K.subtasks,ie,K.id);if(Ne!==void 0)return Ne}}},H=R(e,le,null),q=(se,ie)=>{let B=se.findIndex(K=>K.id===ie);return he==="below"?B+1:B};if(H===null){let se=q(e,le);w?.(ae,null,se);}else {let se=we.find(ie=>ie.task.id===H)?.task;if(se?.subtasks){let ie=q(se.subtasks,le);w?.(ae,H,ie);}}}}Ee(null),Ve(null),at(null),ft.current=false;};react.useEffect(()=>{if(ae)return document.addEventListener("mousemove",xe),document.addEventListener("mouseup",ge),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[ae,le,he]);let ee=(R,H,q)=>{switch(R.id){case "name":let se=E===H.id,ie=T===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${q*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ie?1:.3},onMouseDown:me=>Q(H.id,me),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),m?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),se?jsxRuntime.jsx("input",{ref:Pe,type:"text",value:fe,onChange:me=>Ce(me.target.value),onKeyDown:me=>{me.key==="Enter"?$e(H.id):me.key==="Escape"&&bt();},onBlur:()=>$e(H.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:me=>me.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),ie&&!se&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:me=>J(H,me),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:me=>{me.stopPropagation(),Ue(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let K=R.id==="startDate"?"startDate":"endDate",Ne=H[K],je=rt?.taskId===H.id&&rt?.field===K,Pt=me=>me?(typeof me=="string"?new Date(me):me).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:me=>{if(je)ot(null);else {let mt=me.currentTarget.getBoundingClientRect();ot({taskId:H.id,field:K,month:Ne?typeof Ne=="string"?new Date(Ne):Ne:new Date,position:{top:mt.bottom+4,left:mt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Pt(Ne)})]}),je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ot(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:rt?.position.top,left:rt?.position.left},onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let me=new Date,mt=new Date(me);mt.setDate(me.getDate()+1);let Ht=new Date(me);Ht.setDate(me.getDate()+7);let Ga=new Date(me);return Ga.setDate(me.getDate()+14),[{label:"Hoy",date:me},{label:"Ma\xF1ana",date:mt},{label:"Pr\xF3xima semana",date:Ht},{label:"2 semanas",date:Ga}].map((vr,Ma)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Aa=>Aa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Aa=>Aa.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:vr.date}),ot(null);},children:vr.label},Ma))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:me=>me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:void 0}),ot(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ot(me=>me?{...me,month:new Date(me.month.getFullYear(),me.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:rt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ot(me=>me?{...me,month:new Date(me.month.getFullYear(),me.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((me,mt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:me},mt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let me=rt?.month||new Date,mt=me.getFullYear(),Ht=me.getMonth(),Ga=new Date(mt,Ht,1).getDay(),bo=new Date(mt,Ht+1,0).getDate(),vr=new Date,Ma=[];for(let Ct=Ga-1;Ct>=0;Ct--)Ma.push({day:new Date(mt,Ht,-Ct).getDate(),date:new Date(mt,Ht-1,new Date(mt,Ht,-Ct).getDate()),isCurrentMonth:false});for(let Ct=1;Ct<=bo;Ct++)Ma.push({day:Ct,date:new Date(mt,Ht,Ct),isCurrentMonth:true});let Aa=42-Ma.length;for(let Ct=1;Ct<=Aa;Ct++)Ma.push({day:Ct,date:new Date(mt,Ht+1,Ct),isCurrentMonth:false});return Ma.map((Ct,vn)=>{let xn=Ct.date.toDateString()===vr.toDateString(),xr=(Ne?typeof Ne=="string"?new Date(Ne):Ne:null)?.toDateString()===Ct.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ct.isCurrentMonth?xr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:xr?"#3B82F6":"transparent",boxShadow:xn&&!xr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(H.id,{[K]:Ct.date}),ot(null);},children:Ct.day},vn)})})()})]})]})]})]});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:De(H)})});case "assignees":let Wr=r.filter(me=>H.assignees?.some(mt=>mt.name===me.name||mt.initials===me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(or,{assignedUsers:Wr,availableUsers:r,onChange:me=>{let mt=me.map(Ht=>({id:Ht.id,name:Ht.name,initials:Ht.initials,color:Ht.color}));u?.(H.id,{assignees:mt.length>0?mt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(Qi,{status:H.status||"todo",onChange:me=>{u?.(H.id,{status:me,progress:me==="completed"?100:H.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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});case "priority":let Gr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Wa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},yn=Gr[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(ar,{priority:yn,onChange:me=>{me&&u?.(H.id,{priority:Wa[me]||"medium"});}})});default:return null}},Te=R=>[{id:"hide",label:"Hide Column",icon:lt.Hide,onClick:()=>l(R),disabled:R==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:lt.SortDesc,onClick:()=>{}}],be=R=>R.subtasks&&R.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{D?.(R.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{A?A(R.id,R.name):x?.([R.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{d?.(R);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{D?.(R.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{u?.(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{u?.(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{u?.(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{A?A(R.id,R.name):x?.([R.id]);}}],ke=p.filter(R=>R.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((R,H)=>{let q=H===ke.length-1,se=R.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${se?"":"justify-center"}`,style:{width:`${R.width}px`,minWidth:`${R.minWidth??(se?200:60)}px`,maxWidth:`${R.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:q?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ie=>{ie.preventDefault(),de({isOpen:true,x:ie.clientX,y:ie.clientY,type:"header",columnId:R.id});},onMouseEnter:ie=>{ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:se?"70px":"0"},title:R.label,children:R.label}),se&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Ro,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>z(!G),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"})})]}),R.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ce===R.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation(),S(R.id),M(ie.clientX),P(R.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},R.id)}),G&&jsxRuntime.jsxs("div",{ref:Le,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:R=>R.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:()=>z(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:we.map(({task:R,level:H},q)=>{let se=ct(R.id),ie=le===R.id,B={};return ie&&he&&(he==="above"?(B.borderTopWidth="2px",B.borderTopStyle="solid",B.borderTopColor=t.accent):he==="below"?(B.borderBottomWidth="2px",B.borderBottomStyle="solid",B.borderBottomColor=t.accent):he==="child"&&(B.backgroundColor=t.accentLight,B.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":R.id,className:`flex items-center cursor-pointer group ${ae===R.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:se?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:se||ie&&he==="child"?t.accentLight:q%2===0?t.bgPrimary:t.bgGrid,...B},onMouseEnter:()=>$(R.id),onMouseLeave:()=>$(null),onClick:K=>{let je=Lr(e).map(Gr=>Gr.id),Wr=navigator.platform.toUpperCase().indexOf("MAC")>=0?K.metaKey:K.ctrlKey;wt(R.id,je,Wr,K.shiftKey),s?.(R);},onDoubleClick:K=>{K.stopPropagation(),d?.(R);},onContextMenu:K=>{K.preventDefault(),de({isOpen:true,x:K.clientX,y:K.clientY,type:"task",task:R}),c?.(R,K);},whileHover:{backgroundColor:se?t.accentLight:t.hoverBg},children:ke.map((K,Ne)=>{let je=Ne===ke.length-1,Pt=K.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Pt?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.minWidth??(Pt?200:60)}px`,maxWidth:`${K.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:je?"none":`1px solid ${T===R.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ee(K,R,Pt?H:0)},`${R.id}-${K.id}`)})},R.id)})}),jsxRuntime.jsx(Ir,{isOpen:W.isOpen,x:W.x,y:W.y,items:W.type==="header"&&W.columnId?Te(W.columnId):W.type==="task"&&W.task?be(W.task):[],onClose:()=>de({...W,isOpen:false}),theme:t})]})}function rd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[m,n]=react.useState(t),[p,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[C,D]=react.useState(0),[h,A]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:n,connectionLine:p,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:C,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:A,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,X)=>{r("none"),l(null),u(null),c(E),n(X),D(0),x(null),g(0);}}}function Uo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=rd(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:C,setDragOffset:D,ghostX:h,setGhostX:A,ghostWidth:w,setGhostWidth:L,connectionLine:T,setConnectionLine:$,hoveredTaskId:G,setHoveredTaskId:z,activeZone:E,setActiveZone:X,draggedSegmentIndex:fe,setDraggedSegmentIndex:Ce,draggedSegmentStartX:Le,setDraggedSegmentStartX:Pe,segmentDragOffsetX:ce,setSegmentDragOffsetX:S,hoveredSegmentIndex:F,setHoveredSegmentIndex:M,isHovered:V,setIsHovered:P,isDragging:W,isResizing:de,isConnecting:ae,resetDragState:Ee}=y,le=32,Ve=8,he=e.endDate&&e.endDate<new Date&&e.progress<100,at=e.isCriticalPath,Et=o.name==="neutral"||o.today==="#1C1917",gt=e.status==="completed"||e.progress===100,ft={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ot=e.isCriticalPath||he?"#DC2626":e.color?e.color:e.priority&&ft[e.priority]?ft[e.priority]:o.taskBarPrimary,wt=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),ct=r<50,Lt=r<40;react.useEffect(()=>{if(f)if(V&&!W&&!e.segments){let ee=a<100;f({task:e,x:t,y:a,width:r,height:le,showBelow:ee});}else f(null);},[V,W,e,t,a,r,le,f]);let jt=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),we=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},O=ee=>Math.round(ee/s)*s,De=ee=>{let Te=Math.round(ee/s),be=new Date(d);return be.setDate(be.getDate()+Te),be},Ue=(ee,Te)=>{for(let be of u){if(be.id===e.id)continue;let ke=5;if(ee>=be.x-ke&&ee<=be.x+be.width+ke&&Te>=be.y-ke&&Te<=be.y+be.height+ke)return be.id}return null},$e=react.useCallback((ee,Te,be)=>{ee.preventDefault(),ee.stopPropagation();let ke=x.current?.ownerSVGElement;if(!ke)return;let R=ke.createSVGPoint();R.x=ee.clientX,R.y=ee.clientY;let H=R.matrixTransform(ke.getScreenCTM()?.inverse()),q=be!==void 0?be:t,se=Te;if(!se){let ie=H.x-q;ee.shiftKey?(se="connect",$({x:t+r,y:a+le/2})):ee.ctrlKey||ee.metaKey?se="move":ee.altKey?se=ie<r/2?"resize-start":"resize-end":Lt?ie<r/2?se="move":se="resize-end":ct?ie<=wt/2?se="resize-start":ie>=r-wt/2?se="resize-end":se="move":ie<=wt?se="resize-start":ie>=r-wt?se="resize-end":se="move";}g(se),P(false),X(null),se==="move"?D(H.x-q):se==="connect"?$({x:t+r,y:a+le/2}):D(0),A(q),L(r);},[t,r,a,le]),bt=react.useCallback(ee=>{if(b==="none")return;let Te=x.current?.ownerSVGElement;if(!Te)return;let be=Te.createSVGPoint();be.x=ee.clientX,be.y=ee.clientY;let ke=be.matrixTransform(Te.getScreenCTM()?.inverse());if(b==="connect"){$({x:ke.x,y:ke.y});let R=Ue(ke.x,ke.y);z(R);}else if(b==="move"){let R=ke.x-C,H=O(R);A(H),L(r);let q=Math.round((H-t)/s);if(v?.(e.id,q,true),e.segments&&e.segments.length>0&&fe!==null){let se=H-Le;S(se);}}else if(b==="resize-start"){let R=ke.x,H=O(R),q=t+r-H;q>=s&&(A(H),L(q));}else if(b==="resize-end"){let R=ke.x,q=O(R)-t;q>=s&&L(q);}},[b,t,r,s,C,e,O,fe,Le,Ue,z,$,A,L,S,v]),J=react.useCallback(()=>{if(b!=="none"){if(b==="connect")G&&i&&i(e,G),$(null),z(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),Te,be,ke=true;if(b==="move"){if(Te=De(h),be=new Date(Te.getTime()+ee),e.segments&&e.segments.length>0&&fe!==null){let R=Math.round(ce/s),H=e.segments.map((B,K)=>{if(K===fe){let Ne=new Date(B.startDate),je=new Date(B.endDate);return Ne.setDate(Ne.getDate()+R),je.setDate(je.getDate()+R),{startDate:Ne,endDate:je}}return B}),q=H.flatMap(B=>[B.startDate,B.endDate]),se=new Date(Math.min(...q.map(B=>B.getTime()))),ie=new Date(Math.max(...q.map(B=>B.getTime())));l?.({...e,segments:H},se,ie),Ee(t,r);return}}else b==="resize-start"?(Te=De(h),be=e.endDate,Te>=be&&(console.warn("Invalid date range: start date must be before end date"),ke=false)):b==="resize-end"?(Te=e.startDate,be=De(h+w),be<=Te&&(console.warn("Invalid date range: end date must be after start date"),ke=false)):ke=false;ke&&Te&&be&&(be.getTime()-Te.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Te,be));}v?.(e.id,0,false),Ee(t,r);}},[b,h,w,e,l,G,i,t,r,s,De,ce,fe,Ee,v]);react.useEffect(()=>{if(b==="none")return;let ee=be=>{bt(be);},Te=()=>{J();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Te),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Te);}},[b,bt,J]);let Q=W&&!ae?h:t,xe=W&&!ae?w:r,ge=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!W&&P(true),onMouseLeave:()=>{W||(P(false),X(null));},onClick:()=>!W&&m?.(e),onDoubleClick:ee=>{W||(ee.stopPropagation(),n?.(e));},onContextMenu:ee=>{ee.preventDefault(),p?.(e,ee);},children:[V&&!W&&!ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:wt,height:le,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-start"),onMouseDown:ee=>$e(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+wt,y:a,width:r-wt*2,height:le,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:ee=>$e(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-wt,y:a,width:wt,height:le,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:ee=>$e(ee,"resize-end")})]}),V&&!W&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:le,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:ee=>$e(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:le,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:ee=>$e(ee,"resize-end")}),V&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+le-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),W&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:le,rx:Ve,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q,y:a,width:xe,height:le,rx:Ve,fill:ot,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:W&&!ae?.15:e.parentId?.6:V?.9:.8,scale:V&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>$e(ee),style:{cursor:W?ae?"crosshair":de?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe*(e.progress/100),height:le,rx:Ve,fill:ot,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,Te)=>{let be=(ee.startDate.getTime()-d.getTime())/864e5*s,R=(ee.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-be+s,H=W&&b==="move"&&fe===Te,q=F===Te,se=H?be+ce:be;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!W&&M(Te),onMouseLeave:()=>!W&&M(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:se,y:a,width:R,height:le,rx:Ve,fill:ot,initial:{opacity:0,scale:.95},animate:{opacity:H||e.parentId?.6:q?.9:.8,scale:q&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ie=>{ie.stopPropagation(),Ce(Te),Pe(be),$e(ie,void 0,be);},style:{cursor:W?ae?"crosshair":de?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:se,y:a,width:R*(e.progress/100),height:le,rx:Ve,fill:ot,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Te}`)}),Et&&(he||at)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[at&&!he&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:le,rx:Ve,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),he&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:le,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let ee=c.taskLabel(e),Te=typeof ee=="string"?ee:e.name,be=Te.length>Math.floor(xe/8)?`${Te.substring(0,Math.floor(xe/8))}...`:Te;return jsxRuntime.jsx("text",{x:Q+12,y:a+le/2,dominantBaseline:"middle",fill:gt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:gt?"line-through":"none"},children:be})})(),xe>100&&e.progress>0&&e.progress<100&&!W&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+xe-12,y:a+le/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&&xe>80&&!W&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(V||de)&&!ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ct?Q-15:Q-10,y:a-5,width:ct?25:20,height:le+10,fill:"transparent",onMouseDown:ee=>$e(ee,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ct?Q-8:Q-3,y:a+6,width:ct?8:6,height:ct?le-12:le-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="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:Q+xe-10,y:a-5,width:ct?25:20,height:le+10,fill:"transparent",onMouseDown:ee=>$e(ee,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ct?Q+xe:Q+xe-3,y:a+6,width:ct?8:6,height:ct?le-12:le-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!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+r+8,cy:a+le/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ee=>{ee.stopPropagation(),$e(ee,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+le/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ae&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+le/2,x2:T.x,y2:T.y,stroke:G?o.statusCompleted:o.accent,strokeWidth:G?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:G?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:G?8:6,fill:G?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),G&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(V||W)&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:xe+4,height:le+4,rx:Ve+2,fill:"none",stroke:W?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:W?.6:.4,initial:{opacity:0},animate:{opacity:W?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),de&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&!f&&(()=>{let be=a<100,ke=be?a+le+13:a-82-13,R=be?`M ${Q+xe/2-6} ${a+le+3} L ${Q+xe/2} ${a+le+13} L ${Q+xe/2+6} ${a+le+3}`:`M ${Q+xe/2-6} ${a-13} L ${Q+xe/2} ${a-3} L ${Q+xe/2+6} ${a-13}`,H=ke+22,q=ke+40,se=ke+55,ie=ke+70,B=be?ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:R,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+xe/2-120,y:ke,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Q+xe/2,y:H,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:jt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:jt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+xe/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:we()}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+xe/2+65,y:se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Q+xe/2-110,y:ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+xe/2-50,y:ie,fill:o.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?"...":""]})]}),!be&&jsxRuntime.jsx("text",{x:Q+xe/2,y:B,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ct?"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 sd({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,m=82,n=13,p=c?o+d+n:o-m-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=p+22,u=p+40,v=p+55,f=p+70,y=c?p+m-5:o-18,x=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},g=s<50,C=s<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?x(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?x(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:C?"Left: move \u2022 Right: resize":g?"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 Ho({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,m]=react.useState(false),n=a-e,p=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(p,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:C=>{C.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Vo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var oe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,m=n=>{if(!d.has(n)){d.add(n),c.add(n);let p=r.get(n)||[];for(let l of p){if(!d.has(l)&&m(l))return true;if(c.has(l))return true}}return c.delete(n),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=oe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=oe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=oe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=oe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
45
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function as({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{function n(p){s.current&&!s.current.contains(p.target)&&d.current&&!d.current.contains(p.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},m=e.reduce((n,p)=>{let l=p.category||"Other";return n[l]||(n[l]=[]),n[l].push(p),n},{});return jsxRuntime.jsxs("div",{className:k("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.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:k("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxRuntime.jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([n,p])=>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:n})}),jsxRuntime.jsx("div",{children:p.map(l=>jsxRuntime.jsxs("button",{onClick:()=>c(l),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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.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:l.name}),l.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),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 os({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=react.useState("export"),[m,n]=react.useState("json"),[p,l]=react.useState(null),i=react.useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Mi(e,m,f);Ai(y,m);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Fi(y),b=y.name.endsWith(".json")?"json":"csv",g=Li(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>c("export"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>c("import"),className:k("flex-1 px-6 py-4 font-semibold transition-colors",d==="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:[d==="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(f=>jsxRuntime.jsxs("button",{onClick:()=>n(f),className:k("p-4 rounded-lg border-2 transition-all text-center",m===f?"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:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),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:u,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"})]}),d==="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:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>i.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"})]})]}),p&&jsxRuntime.jsxs("div",{className:k("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:k("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:p.errors.map((f,y)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var tu=["URGENT","HIGH","MEDIUM","LOW"],au=[{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"}],ru=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ns({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:m=[],availableLabels:n=[],availableColumns:p=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=react.useState(true),x=react.useCallback(h=>{a({search:h.target.value});},[a]),b=react.useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=react.useCallback(h=>{r({by:h.target.value});},[r]),C=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.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:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),D&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[l&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsxRuntime.jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsxRuntime.jsx("button",{onClick:c,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:x,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let A=h.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),tu.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let A=h.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(h=>jsxRuntime.jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let A=h.target.value;a({labels:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]})}),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:g,className:"filter-bar__select filter-bar__select--sm",children:au.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ru.map(h=>jsxRuntime.jsx("option",{value:h.value,children:h.label},h.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ss({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:m}){let[n,p]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&p(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),p(false);};return jsxRuntime.jsxs("div",{className:k("relative",r),ref:l,children:[jsxRuntime.jsxs("button",{onClick:()=>p(!n),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,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"})]}),n&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await d?.()),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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(async()=>await 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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(()=>m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(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:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.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 is={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"}},ls={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"}},ds={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"}},lr={dark:is,light:ls,neutral:ds},Io="dark";var Lo=react.createContext(void 0),uu="asakaa-theme";function Il({children:e,defaultTheme:t=Io,storageKey:a=uu}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=react.useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,m=lr[r];Object.entries(m.colors).forEach(([p,l])=>{l&&c.style.setProperty(`--theme-${gu(p)}`,l);}),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(([p,l])=>{let i=m.colors[p];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:lr};return jsxRuntime.jsx(Lo.Provider,{value:d,children:e})}function Pr(){let e=react.useContext(Lo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function cs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Pr();return e?jsxRuntime.jsxs("div",{className:k("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(lr).map(([s,d])=>jsxRuntime.jsxs("button",{onClick:()=>{o(s),t();},className:k("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:d.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var Oe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",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:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function Ll(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Oe[e]||Oe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",Oe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Oe[e].bgSecondary),bgGrid:r("--theme-bg-card",Oe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Oe[e].bgWeekend),border:r("--theme-border-primary",Oe[e].border),borderLight:r("--theme-border-subtle",Oe[e].borderLight),textPrimary:r("--theme-text-primary",Oe[e].textPrimary),textSecondary:r("--theme-text-secondary",Oe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Oe[e].textTertiary),accent:r("--theme-accent-primary",Oe[e].accent),accentHover:r("--theme-accent-hover",Oe[e].accentHover),accentLight:r("--theme-accent-primary",Oe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Oe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Oe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Oe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Oe[e].dependency),dependencyHover:r("--theme-border-secondary",Oe[e].dependencyHover),criticalPath:r("--theme-error",Oe[e].criticalPath),criticalPathLight:r("--theme-error",Oe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Oe[e].today):e==="neutral"?r("--theme-text-primary",Oe[e].today):r("--theme-error",Oe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Oe[e].todayLight):e==="neutral"?r("--theme-text-primary",Oe[e].todayLight):r("--theme-error",Oe[e].todayLight),milestone:r("--theme-warning",Oe[e].milestone),milestoneLight:r("--theme-warning",Oe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Oe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Oe[e].statusInProgress),statusCompleted:r("--theme-success",Oe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Oe[e].hoverBg),focusRing:r("--theme-accent-primary",Oe[e].focusRing)}}var Fo={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Fl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ms={en:Fo,es:Fl};function Bl(e){return ms[e]||ms.en}function ps(e,t){let a=Bl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Ar=react.createContext(Fo);function to(){return react.useContext(Ar)}function Au({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,m]=react.useState(false),[n,p]=react.useState(null),l=react.useRef(null),i=to();if(react.useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&m(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){p(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{p(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#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:i.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:c&&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:v.map((y,x)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.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:n===y.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"})}):y.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:y.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Iu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let d=t===s.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Lu({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),s&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Fu({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),s=react.useRef(null),d=to();react.useEffect(()=>{let n=p=>{s.current&&!s.current.contains(p.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],m=c.find(n=>n.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((n,p)=>{let l=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:p<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Bo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:p=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=to(),C=u||v||f||y||x||b,D=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Lu,{options:D,value:t,onChange:A=>a(A),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Fu,{theme:e,value:c,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[p&&i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:l||g.toolbar.createTask})]}),(C||n)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Au,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsxRuntime.jsx(Iu,{options:h,value:s,onChange:A=>d(A),theme:e})]})]})}function Ro({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[s,d]=react.useState({x:0,y:0}),c=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let p=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]);let n=e.filter(p=>p.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let p=m.current.getBoundingClientRect();d({x:p.left,y:p.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(Ye,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(p=>jsxRuntime.jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:p.label}),p.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function Ir({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=react.useRef(null),[c,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let p=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+p+i>u&&(f=t-p,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),m({x:f,y});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let p=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(p=>jsxRuntime.jsxs("div",{children:[p.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),o());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:l=>{p.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsxRuntime.jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var lt={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Pencil:jsxRuntime.jsx(lucideReact.Pencil,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),AddSubtask:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),SetInProgress:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"})};function Yl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:p,onOpenTaskModal:l,enableKeyboard:i=true}){let u=react.useRef(false),v=react.useCallback(g=>{u.current=g;},[]),f=react.useCallback(g=>{let C=[],D=h=>{for(let A of h)C.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&D(A.subtasks);};return D(g),C},[]),y=react.useCallback(()=>{let g=f(e);for(let C of g)if(t.has(C.id))return C;return null},[e,t,f]),x=react.useCallback((g,C)=>{let D=f(e);if(D.length===0)return;let h=y();if(!h){a(D[0].id,false);return}let A=D.findIndex(T=>T.id===h.id);if(A===-1)return;let w=g==="up"?A-1:A+1;if(w<0||w>=D.length)return;let L=D[w];a(L.id,C);},[e,y,f,a]),b=react.useCallback(g=>{if(!i)return;let C=g.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||u.current){g.key==="Escape"&&(C.blur(),u.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,w=Array.from(t),L=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(L&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!L.isExpanded||g.key==="ArrowLeft"&&L.isExpanded)&&p(L.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){w.length>0&&(g.preventDefault(),d(w,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){w.length>0&&(g.preventDefault(),c(w));return}if(g.key==="Tab"&&g.shiftKey){w.length>0&&(g.preventDefault(),m(w));return}if(g.key==="Enter"&&!g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!A){L&&(g.preventDefault(),r(L.id,"above"));return}if(g.key==="Enter"&&A){L&&(g.preventDefault(),l(L.id));return}if(g.key==="F2"){L&&(g.preventDefault(),n(L.id));return}if(g.key==="Delete"||g.key==="Backspace"&&A){w.length>0&&(g.preventDefault(),o(w));return}if(g.key==="d"&&A&&!g.shiftKey){w.length>0&&(g.preventDefault(),s(w));return}},[i,t,y,x,r,o,s,d,c,m,n,p,l]);return react.useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Xl(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(l=>{t(new Set([l])),r(l);},[]),s=react.useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=react.useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=react.useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),m=react.useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=react.useCallback(()=>{t(new Set),r(null);},[]),p=react.useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:p}}function Lr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Jl(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Jl(a.subtasks,t);if(r)return r}}return null}function fs(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=fs(a.subtasks,t);if(r)return r}return null}function bs(e,t){if(t.length===0)return e;let a=Lr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),m=new Set(t),{tasks:n,removed:p}=d(e,m);return c(n,s.id,p)}function hs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=fs(a,r);if(!o)continue;let s=fs(a,o.id),d=(n,p,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===p&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,p,l);if(v)return v}}return null},c=(n,p,l)=>{let i=n.findIndex(u=>u.id===p);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,p,l);return n},m=d(a,o.id,r);m&&(s&&s.subtasks?c(s.subtasks,o.id,m):c(a,o.id,m));}return a}function ys(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,m)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,m))return true;return false}let p=m==="up"?n-1:n+1;return p<0||p>=d.length?false:([d[n],d[p]]=[d[p],d[n]],true)};return s(r,o,a),r}function vs(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function xs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(p=>p.id===r);if(c===-1){for(let p of d)if(p.subtasks&&o(p.subtasks))return true;return false}let m=d[c],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function Zl(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=m=>{let n=m.findIndex(l=>l.id===t);if(n===-1){for(let l of m)if(l.subtasks&&c(l.subtasks))return true;return false}let p=a==="above"?n:n+1;return m.splice(p,0,d),true};return c(r),{tasks:r,newTask:d}}function ks(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ks(r.subtasks,t,a)}:r)}function ws(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ws(a.subtasks,t)}:a)}function Cs(e,t){let a=p=>{for(let l of p){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=p=>p.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,m],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:m}}function Ql(e,t,a,r){if(t===a)return e;let o=Jl(e,t);if(!o)return e;if(a){let c=(m,n)=>{if(!m.subtasks)return false;for(let p of m.subtasks)if(p.id===n||c(p,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=m=>m.map(n=>{if(n.id===a){let p=n.subtasks||[],l=r!==void 0?r:p.length,i=[...p];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function $o({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:m,scrollTop:n,columns:p,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:C,onCreateSubtask:D,onOpenTaskModal:h,onDeleteRequest:A,onTaskReparent:w}){let L=react.useContext(Ar),[T,$]=react.useState(null),[G,z]=react.useState(false),[E,X]=react.useState(null),[fe,Ce]=react.useState(""),Le=react.useRef(null),Pe=react.useRef(null),[ce,S]=react.useState(null),[F,M]=react.useState(0),[V,P]=react.useState(0),[W,de]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ae,Ee]=react.useState(null),[le,Ve]=react.useState(null),[he,at]=react.useState(null),Et=react.useRef(0),gt=5,ft=react.useRef(false),[rt,ot]=react.useState(null);react.useEffect(()=>{function R(H){Le.current&&!Le.current.contains(H.target)&&z(false);}if(G)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[G]),react.useEffect(()=>{E&&Pe.current&&(Pe.current.focus(),Pe.current.select());},[E]),react.useEffect(()=>{if(!ce)return;let R=q=>{let se=q.clientX-F,ie=V+se;i?.(ce,ie);},H=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",R),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,F,V,i]);let{selectedTaskIds:la,handleTaskClick:wt,isTaskSelected:ct}=Xl(),{setIsEditing:Lt}=Yl({tasks:e,selectedTaskIds:la,onTaskSelect:(R,H)=>{let se=Lr(e).map(ie=>ie.id);wt(R,se,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:R=>{let H=Lr(e).find(q=>q.id===R);H&&Ue(H);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:R=>{let H=Lr(e).find(q=>q.id===R);H&&h&&h(H);},enableKeyboard:true}),jt=(R,H=0)=>{let q=[];for(let se of R)q.push({task:se,level:H}),se.subtasks&&se.subtasks.length>0&&se.isExpanded&&q.push(...jt(se.subtasks,H+1));return q},we=jt(e),O=48,De=R=>!R.startDate||!R.endDate?"-":`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))}d`,Ue=R=>{X(R.id),Ce(R.name),Lt(true);},$e=R=>{fe.trim()&&fe!==e.find(H=>H.id===R)?.name&&C?.(R,fe.trim()),X(null),Ce(""),Lt(false);},bt=()=>{X(null),Ce(""),Lt(false);},J=(R,H)=>{H.stopPropagation(),D?.(R.id);},Q=(R,H)=>{H.preventDefault(),Et.current=H.clientY,Ee(R),ft.current=false;},xe=R=>{if(!ae||(Math.abs(R.clientY-Et.current)>gt&&(ft.current=true),!ft.current))return;let q=document.querySelectorAll("[data-task-row]"),se=null,ie=null;q.forEach(B=>{let K=B.getBoundingClientRect(),Ne=B.getAttribute("data-task-row");if(Ne&&Ne!==ae&&R.clientY>=K.top&&R.clientY<=K.bottom){se=Ne;let je=R.clientY-K.top,Pt=K.height;je<Pt*.25?ie="above":je>Pt*.75?ie="below":ie="child";}}),Ve(se),at(ie);},ge=()=>{if(ft.current&&ae&&le&&he){if(he==="child")w?.(ae,le);else if(he==="above"||he==="below"){let R=(se,ie,B=null)=>{for(let K of se){if(K.id===ie)return B;if(K.subtasks){let Ne=R(K.subtasks,ie,K.id);if(Ne!==void 0)return Ne}}},H=R(e,le,null),q=(se,ie)=>{let B=se.findIndex(K=>K.id===ie);return he==="below"?B+1:B};if(H===null){let se=q(e,le);w?.(ae,null,se);}else {let se=we.find(ie=>ie.task.id===H)?.task;if(se?.subtasks){let ie=q(se.subtasks,le);w?.(ae,H,ie);}}}}Ee(null),Ve(null),at(null),ft.current=false;};react.useEffect(()=>{if(ae)return document.addEventListener("mousemove",xe),document.addEventListener("mouseup",ge),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",ge),document.body.style.cursor="",document.body.style.userSelect="";}},[ae,le,he]);let ee=(R,H,q)=>{switch(R.id){case "name":let se=E===H.id,ie=T===H.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${q*20}px`},children:[w&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ie?1:.3},onMouseDown:me=>Q(H.id,me),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsxRuntime.jsx("button",{onClick:me=>{me.stopPropagation(),m?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.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"}),!(H.subtasks&&H.subtasks.length>0)&&jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),se?jsxRuntime.jsx("input",{ref:Pe,type:"text",value:fe,onChange:me=>Ce(me.target.value),onKeyDown:me=>{me.key==="Enter"?$e(H.id):me.key==="Escape"&&bt();},onBlur:()=>$e(H.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:me=>me.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),ie&&!se&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:me=>J(H,me),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:me=>{me.stopPropagation(),Ue(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let K=R.id==="startDate"?"startDate":"endDate",Ne=H[K],je=rt?.taskId===H.id&&rt?.field===K,Pt=me=>me?(typeof me=="string"?new Date(me):me).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxRuntime.jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:me=>{if(je)ot(null);else {let mt=me.currentTarget.getBoundingClientRect();ot({taskId:H.id,field:K,month:Ne?typeof Ne=="string"?new Date(Ne):Ne:new Date,position:{top:mt.bottom+4,left:mt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:Pt(Ne)})]}),je&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ot(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:rt?.position.top,left:rt?.position.left},onClick:me=>me.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let me=new Date,mt=new Date(me);mt.setDate(me.getDate()+1);let Ht=new Date(me);Ht.setDate(me.getDate()+7);let Ga=new Date(me);return Ga.setDate(me.getDate()+14),[{label:"Hoy",date:me},{label:"Ma\xF1ana",date:mt},{label:"Pr\xF3xima semana",date:Ht},{label:"2 semanas",date:Ga}].map((vr,Ma)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Aa=>Aa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Aa=>Aa.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:vr.date}),ot(null);},children:vr.label},Ma))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:me=>me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(H.id,{[K]:void 0}),ot(null);},children:"Borrar"})]}),jsxRuntime.jsxs("div",{className:"p-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>ot(me=>me?{...me,month:new Date(me.month.getFullYear(),me.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:rt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ot(me=>me?{...me,month:new Date(me.month.getFullYear(),me.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((me,mt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:me},mt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let me=rt?.month||new Date,mt=me.getFullYear(),Ht=me.getMonth(),Ga=new Date(mt,Ht,1).getDay(),bo=new Date(mt,Ht+1,0).getDate(),vr=new Date,Ma=[];for(let Ct=Ga-1;Ct>=0;Ct--)Ma.push({day:new Date(mt,Ht,-Ct).getDate(),date:new Date(mt,Ht-1,new Date(mt,Ht,-Ct).getDate()),isCurrentMonth:false});for(let Ct=1;Ct<=bo;Ct++)Ma.push({day:Ct,date:new Date(mt,Ht,Ct),isCurrentMonth:true});let Aa=42-Ma.length;for(let Ct=1;Ct<=Aa;Ct++)Ma.push({day:Ct,date:new Date(mt,Ht+1,Ct),isCurrentMonth:false});return Ma.map((Ct,vn)=>{let xn=Ct.date.toDateString()===vr.toDateString(),xr=(Ne?typeof Ne=="string"?new Date(Ne):Ne:null)?.toDateString()===Ct.date.toDateString();return jsxRuntime.jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Ct.isCurrentMonth?xr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:xr?"#3B82F6":"transparent",boxShadow:xn&&!xr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(H.id,{[K]:Ct.date}),ot(null);},children:Ct.day},vn)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:De(H)})});case "assignees":let Wr=r.filter(me=>H.assignees?.some(mt=>mt.name===me.name||mt.initials===me.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(or,{assignedUsers:Wr,availableUsers:r,onChange:me=>{let mt=me.map(Ht=>({id:Ht.id,name:Ht.name,initials:Ht.initials,color:Ht.color}));u?.(H.id,{assignees:mt.length>0?mt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(Qi,{status:H.status||"todo",onChange:me=>{u?.(H.id,{status:me,progress:me==="completed"?100:H.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:`${H.progress}%`,backgroundColor:H.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:[H.progress,"%"]})]});case "priority":let Gr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Wa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},yn=Gr[H.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:me=>me.stopPropagation(),children:jsxRuntime.jsx(ar,{priority:yn,onChange:me=>{me&&u?.(H.id,{priority:Wa[me]||"medium"});}})});default:return null}},Te=R=>[{id:"hide",label:"Hide Column",icon:lt.Hide,onClick:()=>l(R),disabled:R==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:lt.SortDesc,onClick:()=>{}}],be=R=>R.subtasks&&R.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{D?.(R.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{A?A(R.id,R.name):x?.([R.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{d?.(R);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{D?.(R.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{u?.(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{u?.(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{u?.(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{A?A(R.id,R.name):x?.([R.id]);}}],ke=p.filter(R=>R.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${O}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[ke.map((R,H)=>{let q=H===ke.length-1,se=R.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${se?"":"justify-center"}`,style:{width:`${R.width}px`,minWidth:`${R.minWidth??(se?200:60)}px`,maxWidth:`${R.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:q?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ie=>{ie.preventDefault(),de({isOpen:true,x:ie.clientX,y:ie.clientY,type:"header",columnId:R.id});},onMouseEnter:ie=>{ie.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ie=>{ie.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:se?"70px":"0"},title:R.label,children:R.label}),se&&jsxRuntime.jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsxRuntime.jsx(Ro,{columns:p,onToggleColumn:l,theme:t}),jsxRuntime.jsx("button",{onClick:()=>z(!G),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"})})]}),R.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ce===R.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation(),S(R.id),M(ie.clientX),P(R.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},R.id)}),G&&jsxRuntime.jsxs("div",{ref:Le,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:R=>R.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:()=>z(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",children:we.map(({task:R,level:H},q)=>{let se=ct(R.id),ie=le===R.id,B={};return ie&&he&&(he==="above"?(B.borderTopWidth="2px",B.borderTopStyle="solid",B.borderTopColor=t.accent):he==="below"?(B.borderBottomWidth="2px",B.borderBottomStyle="solid",B.borderBottomColor=t.accent):he==="child"&&(B.backgroundColor=t.accentLight,B.boxShadow=`inset 0 0 0 2px ${t.accent}`)),jsxRuntime.jsx(framerMotion.motion.div,{"data-task-row":R.id,className:`flex items-center cursor-pointer group ${ae===R.id?"opacity-50":""}`,style:{height:`${a}px`,borderLeft:se?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:se||ie&&he==="child"?t.accentLight:q%2===0?t.bgPrimary:t.bgGrid,...B},onMouseEnter:()=>$(R.id),onMouseLeave:()=>$(null),onClick:K=>{let je=Lr(e).map(Gr=>Gr.id),Wr=navigator.platform.toUpperCase().indexOf("MAC")>=0?K.metaKey:K.ctrlKey;wt(R.id,je,Wr,K.shiftKey),s?.(R);},onDoubleClick:K=>{K.stopPropagation(),d?.(R);},onContextMenu:K=>{K.preventDefault(),de({isOpen:true,x:K.clientX,y:K.clientY,type:"task",task:R}),c?.(R,K);},whileHover:{backgroundColor:se?t.accentLight:t.hoverBg},children:ke.map((K,Ne)=>{let je=Ne===ke.length-1,Pt=K.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Pt?"justify-start":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.minWidth??(Pt?200:60)}px`,maxWidth:`${K.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:je?"none":`1px solid ${T===R.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ee(K,R,Pt?H:0)},`${R.id}-${K.id}`)})},R.id)})}),jsxRuntime.jsx(Ir,{isOpen:W.isOpen,x:W.x,y:W.y,items:W.type==="header"&&W.columnId?Te(W.columnId):W.type==="task"&&W.task?be(W.task):[],onClose:()=>de({...W,isOpen:false}),theme:t})]})}function rd(e,t){let[a,r]=react.useState("none"),[o,s]=react.useState(0),[d,c]=react.useState(e),[m,n]=react.useState(t),[p,l]=react.useState(null),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(0),[C,D]=react.useState(0),[h,A]=react.useState(null),[w,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:m,setGhostWidth:n,connectionLine:p,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:C,setSegmentDragOffsetX:D,hoveredSegmentIndex:h,setHoveredSegmentIndex:A,isHovered:w,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(E,X)=>{r("none"),l(null),u(null),c(E),n(X),D(0),x(null),g(0);}}}function Uo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=rd(t,r),x=react.useRef(null),{dragMode:b,setDragMode:g,dragOffset:C,setDragOffset:D,ghostX:h,setGhostX:A,ghostWidth:w,setGhostWidth:L,connectionLine:T,setConnectionLine:$,hoveredTaskId:G,setHoveredTaskId:z,activeZone:E,setActiveZone:X,draggedSegmentIndex:fe,setDraggedSegmentIndex:Ce,draggedSegmentStartX:Le,setDraggedSegmentStartX:Pe,segmentDragOffsetX:ce,setSegmentDragOffsetX:S,hoveredSegmentIndex:F,setHoveredSegmentIndex:M,isHovered:V,setIsHovered:P,isDragging:W,isResizing:de,isConnecting:ae,resetDragState:Ee}=y,le=32,Ve=8,he=e.endDate&&e.endDate<new Date&&e.progress<100,at=e.isCriticalPath,Et=o.name==="neutral"||o.today==="#1C1917",gt=e.status==="completed"||e.progress===100,ft={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ot=e.isCriticalPath||he?"#DC2626":e.color?e.color:e.priority&&ft[e.priority]?ft[e.priority]:o.taskBarPrimary,wt=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),ct=r<50,Lt=r<40;react.useEffect(()=>{if(f)if(V&&!W&&!e.segments){let ee=a<100;f({task:e,x:t,y:a,width:r,height:le,showBelow:ee});}else f(null);},[V,W,e,t,a,r,le,f]);let jt=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),we=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},O=ee=>Math.round(ee/s)*s,De=ee=>{let Te=Math.round(ee/s),be=new Date(d);return be.setDate(be.getDate()+Te),be},Ue=(ee,Te)=>{for(let be of u){if(be.id===e.id)continue;let ke=5;if(ee>=be.x-ke&&ee<=be.x+be.width+ke&&Te>=be.y-ke&&Te<=be.y+be.height+ke)return be.id}return null},$e=react.useCallback((ee,Te,be)=>{ee.preventDefault(),ee.stopPropagation();let ke=x.current?.ownerSVGElement;if(!ke)return;let R=ke.createSVGPoint();R.x=ee.clientX,R.y=ee.clientY;let H=R.matrixTransform(ke.getScreenCTM()?.inverse()),q=be!==void 0?be:t,se=Te;if(!se){let ie=H.x-q;ee.shiftKey?(se="connect",$({x:t+r,y:a+le/2})):ee.ctrlKey||ee.metaKey?se="move":ee.altKey?se=ie<r/2?"resize-start":"resize-end":Lt?ie<r/2?se="move":se="resize-end":ct?ie<=wt/2?se="resize-start":ie>=r-wt/2?se="resize-end":se="move":ie<=wt?se="resize-start":ie>=r-wt?se="resize-end":se="move";}g(se),P(false),X(null),se==="move"?D(H.x-q):se==="connect"?$({x:t+r,y:a+le/2}):D(0),A(q),L(r);},[t,r,a,le]),bt=react.useCallback(ee=>{if(b==="none")return;let Te=x.current?.ownerSVGElement;if(!Te)return;let be=Te.createSVGPoint();be.x=ee.clientX,be.y=ee.clientY;let ke=be.matrixTransform(Te.getScreenCTM()?.inverse());if(b==="connect"){$({x:ke.x,y:ke.y});let R=Ue(ke.x,ke.y);z(R);}else if(b==="move"){let R=ke.x-C,H=O(R);A(H),L(r);let q=Math.round((H-t)/s);if(v?.(e.id,q,true),e.segments&&e.segments.length>0&&fe!==null){let se=H-Le;S(se);}}else if(b==="resize-start"){let R=ke.x,H=O(R),q=t+r-H;q>=s&&(A(H),L(q));}else if(b==="resize-end"){let R=ke.x,q=O(R)-t;q>=s&&L(q);}},[b,t,r,s,C,e,O,fe,Le,Ue,z,$,A,L,S,v]),J=react.useCallback(()=>{if(b!=="none"){if(b==="connect")G&&i&&i(e,G),$(null),z(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),Te,be,ke=true;if(b==="move"){if(Te=De(h),be=new Date(Te.getTime()+ee),e.segments&&e.segments.length>0&&fe!==null){let R=Math.round(ce/s),H=e.segments.map((B,K)=>{if(K===fe){let Ne=new Date(B.startDate),je=new Date(B.endDate);return Ne.setDate(Ne.getDate()+R),je.setDate(je.getDate()+R),{startDate:Ne,endDate:je}}return B}),q=H.flatMap(B=>[B.startDate,B.endDate]),se=new Date(Math.min(...q.map(B=>B.getTime()))),ie=new Date(Math.max(...q.map(B=>B.getTime())));l?.({...e,segments:H},se,ie),Ee(t,r);return}}else b==="resize-start"?(Te=De(h),be=e.endDate,Te>=be&&(console.warn("Invalid date range: start date must be before end date"),ke=false)):b==="resize-end"?(Te=e.startDate,be=De(h+w),be<=Te&&(console.warn("Invalid date range: end date must be after start date"),ke=false)):ke=false;ke&&Te&&be&&(be.getTime()-Te.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,Te,be));}v?.(e.id,0,false),Ee(t,r);}},[b,h,w,e,l,G,i,t,r,s,De,ce,fe,Ee,v]);react.useEffect(()=>{if(b==="none")return;let ee=be=>{bt(be);},Te=()=>{J();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Te),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Te);}},[b,bt,J]);let Q=W&&!ae?h:t,xe=W&&!ae?w:r,ge=c.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!W&&P(true),onMouseLeave:()=>{W||(P(false),X(null));},onClick:()=>!W&&m?.(e),onDoubleClick:ee=>{W||(ee.stopPropagation(),n?.(e));},onContextMenu:ee=>{ee.preventDefault(),p?.(e,ee);},children:[V&&!W&&!ct&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:wt,height:le,fill:E==="resize-start"?o.accent:"transparent",opacity:E==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-start"),onMouseDown:ee=>$e(ee,"resize-start")}),jsxRuntime.jsx("rect",{x:t+wt,y:a,width:r-wt*2,height:le,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:ee=>$e(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r-wt,y:a,width:wt,height:le,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:ee=>$e(ee,"resize-end")})]}),V&&!W&&Lt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:le,fill:E==="move"?o.accent:"transparent",opacity:E==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>X("move"),onMouseDown:ee=>$e(ee,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:le,fill:E==="resize-end"?o.accent:"transparent",opacity:E==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>X("resize-end"),onMouseDown:ee=>$e(ee,"resize-end")}),V&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+le-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),W&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:h,y:a,width:w,height:le,rx:Ve,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q,y:a,width:xe,height:le,rx:Ve,fill:ot,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:W&&!ae?.15:e.parentId?.6:V?.9:.8,scale:V&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>$e(ee),style:{cursor:W?ae?"crosshair":de?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe*(e.progress/100),height:le,rx:Ve,fill:ot,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ee,Te)=>{let be=(ee.startDate.getTime()-d.getTime())/864e5*s,R=(ee.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-be+s,H=W&&b==="move"&&fe===Te,q=F===Te,se=H?be+ce:be;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!W&&M(Te),onMouseLeave:()=>!W&&M(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:se,y:a,width:R,height:le,rx:Ve,fill:ot,initial:{opacity:0,scale:.95},animate:{opacity:H||e.parentId?.6:q?.9:.8,scale:q&&!W?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ie=>{ie.stopPropagation(),Ce(Te),Pe(be),$e(ie,void 0,be);},style:{cursor:W?ae?"crosshair":de?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:se,y:a,width:R*(e.progress/100),height:le,rx:Ve,fill:ot,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Te}`)}),Et&&(he||at)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[at&&!he&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:le,rx:Ve,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),he&&jsxRuntime.jsx("rect",{x:Q,y:a,width:xe,height:le,rx:Ve,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),xe>60&&!e.segments&&(()=>{let ee=c.taskLabel(e),Te=typeof ee=="string"?ee:e.name,be=Te.length>Math.floor(xe/8)?`${Te.substring(0,Math.floor(xe/8))}...`:Te;return jsxRuntime.jsx("text",{x:Q+12,y:a+le/2,dominantBaseline:"middle",fill:gt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:gt?"line-through":"none"},children:be})})(),xe>100&&e.progress>0&&e.progress<100&&!W&&!e.segments&&jsxRuntime.jsxs("text",{x:Q+xe-12,y:a+le/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&&xe>80&&!W&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Q+xe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(V||de)&&!ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:ct?Q-15:Q-10,y:a-5,width:ct?25:20,height:le+10,fill:"transparent",onMouseDown:ee=>$e(ee,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ct?Q-8:Q-3,y:a+6,width:ct?8:6,height:ct?le-12:le-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="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:Q+xe-10,y:a-5,width:ct?25:20,height:le+10,fill:"transparent",onMouseDown:ee=>$e(ee,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:ct?Q+xe:Q+xe-3,y:a+6,width:ct?8:6,height:ct?le-12:le-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!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+r+8,cy:a+le/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ee=>{ee.stopPropagation(),$e(ee,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+le/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),ae&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+le/2,x2:T.x,y2:T.y,stroke:G?o.statusCompleted:o.accent,strokeWidth:G?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:G?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:G?8:6,fill:G?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),G&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(V||W)&&!ae&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Q-2,y:a-2,width:xe+4,height:le+4,rx:Ve+2,fill:"none",stroke:W?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:W?.6:.4,initial:{opacity:0},animate:{opacity:W?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),de&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:h+w,y1:0,x2:h+w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:V&&!W&&!e.segments&&!f&&(()=>{let be=a<100,ke=be?a+le+13:a-82-13,R=be?`M ${Q+xe/2-6} ${a+le+3} L ${Q+xe/2} ${a+le+13} L ${Q+xe/2+6} ${a+le+3}`:`M ${Q+xe/2-6} ${a-13} L ${Q+xe/2} ${a-3} L ${Q+xe/2+6} ${a-13}`,H=ke+22,q=ke+40,se=ke+55,ie=ke+70,B=be?ke+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:R,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Q+xe/2-120,y:ke,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Q+xe/2,y:H,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:jt(e.startDate)}),jsxRuntime.jsx("text",{x:Q+xe/2-110,y:se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Q+xe/2-70,y:se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:jt(e.endDate)}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:q,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Q+xe/2+65,y:q,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:we()}),jsxRuntime.jsx("text",{x:Q+xe/2+10,y:se,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Q+xe/2+65,y:se,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Q+xe/2-110,y:ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Q+xe/2-50,y:ie,fill:o.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?"...":""]})]}),!be&&jsxRuntime.jsx("text",{x:Q+xe/2,y:B,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Lt?"Left: move \u2022 Right: resize":ct?"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 sd({tooltipData:e,theme:t}){if(!e)return null;let{task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,m=82,n=13,p=c?o+d+n:o-m-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=p+22,u=p+40,v=p+55,f=p+70,y=c?p+m-5:o-18,x=D=>D.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),b=()=>{if(!a.startDate||!a.endDate)return "N/A";let D=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${D} day${D!==1?"s":""}`},g=s<50,C=s<40;return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+s/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?x(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?x(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:b()}),jsxRuntime.jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(D=>D.name).join(", ").substring(0,30),a.assignees.map(D=>D.name).join(", ").length>30?"...":""]})]}),!c&&jsxRuntime.jsx("text",{x:r+s/2,y,textAnchor:"middle",fill:t.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:C?"Left: move \u2022 Right: resize":g?"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 Ho({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,m]=react.useState(false),n=a-e,p=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(p,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;return react.useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]),jsxRuntime.jsxs("g",{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.6,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.15},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.6,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.33:1},transition:{scale:{delay:.3,duration:.15}}}),c&&s&&!d&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:C=>{C.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Vo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=react.useState(false),c=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var oe={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&o(p.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,m=n=>{if(!d.has(n)){d.add(n),c.add(n);let p=r.get(n)||[];for(let l of p){if(!d.has(l)&&m(l))return true;if(c.has(l))return true}}return c.delete(n),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=oe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=oe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=oe.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=oe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
46
46
  `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=oe.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=oe.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>oe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=oe.findTaskById(e,t);return !a||!a.dependencies?[]:oe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>oe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>oe.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=oe.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>oe.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=oe.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let d=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(m=>{let n=m.startDate&&m.endDate?oe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?oe.formatDate(m.startDate):"N/A",m.endDate?oe.formatDate(m.endDate):"N/A",n>0?`${n} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:d,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=oe.flattenTasks(e).map(m=>{let n=m.startDate&&m.endDate?oe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?oe.formatDate(m.startDate):"","End Date":m.endDate?oe.formatDate(m.endDate):"","Duration (days)":n>0?n:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(p=>p.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),d=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=d;let c=a.utils.book_new();a.utils.book_append_sheet(c,s,"Gantt Tasks"),a.writeFile(c,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=oe.flattenTasks(e),o=new Map;r.forEach((i,u)=>{o.set(i.id,u+1);});let s=i=>i.toISOString().replace("Z",""),d=oe.getEarliestStartDate(e)||new Date,c=oe.getLatestEndDate(e)||new Date,m=r.map((i,u)=>{let v=o.get(i.id),f=i.startDate&&i.endDate?oe.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
47
47
  <PredecessorLink>
48
48
  <PredecessorUID>${o.get(x)}</PredecessorUID>
@@ -273,7 +273,7 @@
273
273
  </Calendars>
274
274
  <Tasks>${m}
275
275
  </Tasks>
276
- </Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=oe.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let m=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=oe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(oe.calculateCriticalPath(e).includes(t))return 0;let o=oe.getDependentTasks(e,t);if(o.length===0){let c=oe.getLatestEndDate(e);if(!c)return null;let m=oe.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let d=oe.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>oe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=oe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=oe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=oe.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=oe.calculateEndDate(m,c),p=l=>l.map(i=>i.id===d.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=oe.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let m=[],n=o.getTime(),p=1e3*60*60*24,l=oe.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=oe.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,w=A+v*s,L=Math.max(D*s,s),T=c+b*d+12;m.push({taskId:x.id,taskName:x.name,originalX:A,previewX:w,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=oe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:c,segments:m}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Ko({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,C]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{C(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=A*w*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},$=S=>{let F=S.getDay();return F===0||F===6},G=react.useCallback(S=>{let F=Math.round(S/(w*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,w,d]),z=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=G(P.x),de=new Date(W);de.setDate(de.getDate()+1),l?.(F,W,de);},[G,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let de=S(W.subtasks),ae=de.filter(Ee=>Ee.startDate&&Ee.endDate);if(ae.length>0){let Ee=ae.map(at=>at.startDate.getTime()),le=ae.map(at=>at.endDate.getTime()),Ve=new Date(Math.min(...Ee)),he=new Date(Math.max(...le));return {...W,subtasks:de,startDate:Ve,endDate:he}}return {...W,subtasks:de}}return W}),F=(P,W=[])=>{for(let de of P)W.push(de),de.subtasks&&de.subtasks.length>0&&(de.isExpanded===void 0||de.isExpanded)&&F(de.subtasks,W);return W},M=S(e);return F(M)},[e]),X=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),de=P*w*d,ae=Math.max(w*d,40),Ee=Math.max(W*w*d,ae);return {x:de,width:Ee}},[o,w,d]),fe=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=X(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,X]),Ce=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=oe.calculateCascadePreview(e,S,F,E,o,w*d,a,48);y(V);},[e,E,o,w,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*w*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,w,d]),Pe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),ce=Math.max(E.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Pe>=0&&Pe<=L&&jsxRuntime.jsx("circle",{cx:Pe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:ce,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:ce,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=$(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Pe>=0&&Pe<=L&&jsxRuntime.jsx("line",{x1:Pe,y1:0,x2:Pe,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>z(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Pe>0?Pe:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(ae=>ae.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(ae=>ae.id===M),W=X(V),de=X(S);return jsxRuntime.jsx(Ho,{x1:W.x+W.width,y1:P*a+a/2,x2:de.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=X(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Vo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:m},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>m?.(S),onContextMenu:de=>{de.preventDefault(),de.stopPropagation(),p?.(S,de);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(Uo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:fe,onDragMove:Ce,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,de=V-F,ae=S+W/2,Ee=(F+V)/2,le=`M ${S} ${F} C ${ae} ${F}, ${ae} ${V}, ${M} ${V}`,Ve=6,he=Math.atan2(de,W),at=M-Ve*Math.cos(he-Math.PI/6),Et=V-Ve*Math.sin(he-Math.PI/6),gt=M-Ve*Math.cos(he+Math.PI/6),ft=V-Ve*Math.sin(he+Math.PI/6),rt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:le,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${at} ${Et} M ${M} ${V} L ${gt} ${ft}`,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:rt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:ot=>{ot.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ae,cy:Ee,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ae-4,y1:Ee-4,x2:ae+4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ae+4,y1:Ee-4,x2:ae-4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(sd,{tooltipData:x,theme:t})]})]})}var Yo=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Es=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ps=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:n=[]}){let p=[...Es,...n.filter(P=>!Es.some(W=>W.id===P.id))],l=Oe[m]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[C,D]=react.useState(null),[h,A]=react.useState(new Date),[w,L]=react.useState(false),T=react.useRef(null),$=react.useRef(null),G=react.useRef(null),z=react.useRef(null),[E,X]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[fe,Ce]=react.useState({});react.useEffect(()=>{a?(X({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&L(true)):(X({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),$.current&&!$.current.contains(W.target)&&f(false),G.current&&!G.current.contains(W.target)&&x(false),z.current&&!z.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),Ce(P),Object.keys(P).length===0},Pe=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},ce=(P,W)=>{X(de=>{let ae={...de,[P]:W};if(P==="status"){let Ee=W;Ee==="todo"?ae.progress=0:Ee==="in-progress"?(de.progress===0||de.progress===100)&&(ae.progress=50):Ee==="completed"||Ee==="closed"?ae.progress=100:(Ee==="in-review"||Ee==="review")&&(ae.progress=75);}if(P==="progress"){let Ee=typeof W=="number"?W:parseInt(W,10);Ee===100&&de.status!=="completed"?ae.status="completed":Ee>0&&Ee<100&&de.status==="todo"?ae.status="in-progress":Ee===0&&de.status!=="todo"&&(ae.status="todo");}return ae}),fe[P]&&Ce(de=>{let ae={...de};return delete ae[P],ae});},S=p.find(P=>P.id===E.status)??Es[0],F=Ps.find(P=>P.id===E.priority)??Ps[1],M=Yo.find(P=>P.value===E.color)??Yo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:E.name,onChange:P=>ce("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),fe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),fe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>ce("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ps.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(de=>de.name===P.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{let de=W?(E.assignees||[]).filter(ae=>ae.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),color:l.accent}];ce("assignees",de);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:Yo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{ce("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let de=new Date(P);de.setDate(P.getDate()+7);let ae=new Date(P);return ae.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:ae}].map((le,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:he=>he.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(ce("startDate",le.date),(!E.endDate||le.date>E.endDate)&&ce("endDate",le.date),D("end")):(ce("endDate",le.date),(!E.startDate||le.date<E.startDate)&&ce("startDate",le.date),D(null));},children:le.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("startDate",void 0),ce("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),de=new Date(P,W,1).getDay(),ae=new Date(P,W+1,0).getDate(),Ee=new Date,le=[];for(let he=de-1;he>=0;he--)le.push({day:new Date(P,W,-he).getDate(),date:new Date(P,W-1,new Date(P,W,-he).getDate()),isCurrentMonth:false});for(let he=1;he<=ae;he++)le.push({day:he,date:new Date(P,W,he),isCurrentMonth:true});let Ve=42-le.length;for(let he=1;he<=Ve;he++)le.push({day:he,date:new Date(P,W+1,he),isCurrentMonth:false});return le.map((he,at)=>{let Et=he.date.toDateString()===Ee.toDateString(),gt=E.startDate?.toDateString()===he.date.toDateString(),ft=E.endDate?.toDateString()===he.date.toDateString(),rt=E.startDate&&E.endDate&&he.date>=E.startDate&&he.date<=E.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:he.isCurrentMonth?gt||ft?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:gt?"#3B82F6":ft?"#7C3AED":rt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Et&&!gt&&!ft?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(ce("startDate",he.date),E.endDate&&he.date>E.endDate&&ce("endDate",he.date),D("end")):(ce("endDate",he.date),E.startDate&&he.date<E.startDate&&ce("startDate",he.date),D(null));},children:he.day},at)})})()})]})]})]})})]}),fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:fe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:E.progress,onChange:P=>ce("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!w),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${w?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:E.isMilestone,onChange:P=>ce("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let de=W?(E.dependencies||[]).filter(ae=>ae!==P.id):[...E.dependencies||[],P.id];ce("dependencies",de);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var Og=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],md=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),zg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),$g=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Ug=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),Wg=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Jo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,C]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:G=Og,maxHistory:z=50,persistHistory:E}=a,X=E?.storageKey||"gantt-ai-history",fe=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(X);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-fe));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,X,fe]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-fe);localStorage.setItem(X,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,X,fe]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let Ce=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&m?.(F.taskId,F.dependencyFrom);break}},[o,s,d,c,m]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-(z-1)),M]),y(""),C(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if($){let P=await $(F,e);v(W=>{let de=W.filter(Ee=>!Ee.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...de,ae]}),Ce(P);}else v(P=>[...P.filter(de=>!de.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(P){v(W=>[...W.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,z,$,e,Ce]),Pe=F=>{F.preventDefault(),Le(f);},ce=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!w)return null;let S={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${S[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(md,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(md,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ug,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx($g,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>ce(F),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Wg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(zg,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function pd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function ud({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Vg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${oe.formatDate(e.startDate)} - ${oe.formatDate(e.endDate)}`);let a=oe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>oe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function gd(e){return {...Vg,...e}}var Zg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},hd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:C,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:w,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:G,onDependencyCreate:z,onDependencyDelete:E,onBeforeTaskAdd:X,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ce,onAfterTaskUpdate:Le,onBeforeTaskDelete:Pe,onAfterTaskDelete:ce}=a,F=react.useContext(Lo)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[de,ae]=react.useState(c),[Ee,le]=react.useState(1),[Ve,he]=react.useState(0),[at,Et]=react.useState(false),[gt,ft]=react.useState(null),[rt,ot]=react.useState({isOpen:false,x:0,y:0,task:null}),[la,wt]=react.useState(null),[ct,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let jt=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:De,redo:Ue,canUndo:$e,canRedo:bt,clearHistory:J}=pd(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),xe=react.useRef(true);react.useEffect(()=>{if(xe.current){xe.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),U=JSON.stringify(we);N!==U&&(Q.current=we,r(we));},[we,r]);let ge=react.useMemo(()=>ps(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Te,be]=react.useState(()=>ee(ge));react.useEffect(()=>{be(N=>N.map(U=>({...U,label:ge.columns[U.id==="name"?"taskName":U.id]||U.label})));},[ge]);let ke=react.useMemo(()=>{let N=Te.filter(re=>re.visible),U=N.some(re=>re.id!=="name");return N.reduce((re,ye)=>re+ye.width,0)+(U?20:0)},[Te]);react.useEffect(()=>{gt!==null&&gt>ke&&(Te.filter(Y=>Y.visible).some(Y=>Y.id!=="name")||ft(null));},[Te,ke,gt]);let R=react.useMemo(()=>gt!==null?Math.max(280,gt,ke):Math.max(280,ke),[gt,ke]),H=react.useRef(null),q=react.useRef(null),se=react.useRef(null),ie=react.useMemo(()=>Ll(M),[M]),B=react.useMemo(()=>({theme:ie,themeName:M}),[ie,M]),K=react.useMemo(()=>gd(l),[l]),Ne=react.useMemo(()=>{if(!i)return we;let N=oe.calculateCriticalPath(we),U=Y=>Y.map(re=>({...re,isCriticalPath:N.includes(re.id),subtasks:re.subtasks?U(re.subtasks):void 0}));return U(we)},[we,i]),je=Zg(de);ud({undo:De,redo:Ue,canUndo:$e,canRedo:bt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>oe.findTaskById(we,N),addTask:(N,U)=>{O(Y=>{if(!U)return [...Y,{...N,level:0}];let re=ye=>ye.map(Se=>Se.id===U?{...Se,subtasks:[...Se.subtasks||[],{...N,parentId:U,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},updateTask:(N,U)=>{O(Y=>{let re=ye=>ye.map(Se=>Se.id===N?{...Se,...U}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},deleteTask:N=>{O(U=>{let Y=re=>re.filter(ye=>ye.id===N?false:(ye.subtasks&&(ye.subtasks=Y(ye.subtasks)),true));return Y(U)});},deleteTasks:N=>{O(U=>vs(U,N));},duplicateTask:N=>{O(U=>xs(U,[N]));},splitTask:(N,U,Y=3)=>{O(re=>oe.splitTask(re,N,U,Y));},calculateEndDate:oe.calculateEndDate,calculateDuration:oe.calculateDuration,validateDependency:(N,U)=>!oe.validateDependencies(we,N,U),getAllTasks:()=>oe.flattenTasks(we),getTasksByStatus:N=>oe.flattenTasks(we).filter(U=>U.status===N),getTasksByParent:N=>N?oe.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>oe.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O(U=>bs(U,[N]));},outdentTask:N=>{O(U=>hs(U,[N]));},moveTask:(N,U)=>{O(Y=>ys(Y,[N],U));},createSubtask:async N=>{let{tasks:U,newTask:Y}=Cs(we,N);if(X){let re=X({...Y,parentId:N});if((re instanceof Promise?await re:re)===false)return}O(U),fe&&fe({...Y,parentId:N});},scrollToTask:N=>{let Y=oe.flattenTasks(we).findIndex(re=>re.id===N);if(Y!==-1&&H.current){let re=Y*je;H.current.scrollTo({top:re,behavior:"smooth"}),q.current&&q.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(N,U=2e3)=>{},expandTask:N=>{O(U=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(U)});},collapseTask:N=>{O(U=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(U)});},expandAll:()=>{O(N=>{let U=Y=>Y.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?U(re.subtasks):void 0}));return U(N)});},collapseAll:()=>{O(N=>{let U=Y=>Y.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?U(re.subtasks):void 0}));return U(N)});},undo:De,redo:Ue,canUndo:()=>$e,canRedo:()=>bt,clearHistory:J,exportToPNG:async()=>{if(!se.current)throw new Error("Gantt container not found");let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2});return new Promise((U,Y)=>{N.toBlob(re=>{re?U(re):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await oe.exportToPDF(we,N);},exportToExcel:async N=>{await oe.exportToExcel(we,N);},exportToJSON:()=>oe.exportToJSON(we),exportToCSV:()=>oe.exportToCSV(we),importFromJSON:N=>{let U=oe.importFromJSON(N);O(U);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,De,Ue,$e,bt,J,ie,je]);let Pt=react.useCallback(N=>{be(U=>U.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),Wr=react.useCallback((N,U)=>{be(Y=>Y.map(re=>{if(re.id!==N)return re;let ye=re.minWidth??100,Se=re.maxWidth??800,Ft=Math.max(ye,Math.min(Se,U));return {...re,width:Ft}}));},[]),Gr=react.useCallback(N=>{O(U=>ws(U,N)),a.onTaskToggleExpand?.(N);},[a]),Wa=react.useCallback((N,U)=>{if(Ce&&Ce(N,U)===false)return;let re=oe.findTaskById(we,N)?.progress,ye=Ft=>Ft.map(Bt=>Bt.id===N?{...Bt,...U}:Bt.subtasks?{...Bt,subtasks:ye(Bt.subtasks)}:Bt);O(ye(we));let Se=oe.findTaskById(ye(we),N);Se&&(A?.(Se),Le?.(Se),U.progress!==void 0&&re!==void 0&&U.progress!==re&&w?.(N,re,U.progress));},[we,A,Ce,Le,w]),yn=react.useCallback(N=>{N.length!==0&&(O(U=>bs(U,N)),a.onTaskIndent?.(N[0]));},[a]),me=react.useCallback(N=>{N.length!==0&&(O(U=>hs(U,N)),a.onTaskOutdent?.(N[0]));},[a]),mt=react.useCallback((N,U,Y)=>{O(re=>Ql(re,N,U,Y)),a.onTaskReparent?.(N,U,Y);},[a]),Ht=react.useCallback((N,U)=>{N.length!==0&&(O(Y=>ys(Y,N,U)),a.onTaskMove?.(N[0],U));},[a]),Ga=react.useCallback(async N=>{let U=[];for(let Y of N)Pe&&await Promise.resolve(Pe(Y))===false||U.push(Y);U.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(U):(O(Y=>vs(Y,U)),U.forEach(Y=>a.onTaskDelete?.(Y))),ce&&U.forEach(Y=>ce(Y)));},[a,Pe,ce]),bo=react.useCallback(N=>{O(U=>xs(U,N)),N.forEach(U=>a.onTaskDuplicate?.(U));},[a]),vr=react.useCallback((N,U)=>{O(Y=>{let{tasks:re,newTask:ye}=Zl(Y,N,U);return X&&X(ye)===false?Y:(a.onTaskCreate?.(ye.parentId,ye.position||0),fe?.(ye),re)});},[a,X,fe]),Ma=react.useCallback((N,U)=>{O(Y=>ks(Y,N,U)),a.onTaskRename?.(N,U);},[a]),Aa=react.useCallback(N=>{O(U=>{let{tasks:Y}=Cs(U,N);return a.onTaskCreate?.(N,0),Y});},[a]),Ct=react.useCallback((N,U,Y)=>{let re=N.startDate?Math.round((U.getTime()-N.startDate.getTime())/864e5):0,ye=Bt=>Bt.map(_t=>_t.id===N.id?{..._t,startDate:U,endDate:Y,...N.segments&&{segments:N.segments}}:_t.subtasks?{..._t,subtasks:ye(_t.subtasks)}:_t),Se=ye(we);Se=oe.autoScheduleDependents(Se,N.id,re),O(Se);let Ft={...N,startDate:U,endDate:Y};A?.(Ft);},[we,A]),vn=react.useCallback((N,U)=>{h?.(N,U),ot({isOpen:true,x:U.clientX,y:U.clientY,task:N});},[h]),xn=react.useCallback((N,U)=>{let Y=oe.splitTask(we,N.id,U);O(Y),ot({isOpen:false,x:0,y:0,task:null});},[we]),kn=react.useCallback(N=>{D?.(N),L||wt(N);},[D,L]),xr=react.useCallback((N,U,Y)=>{let re=new Map,ye=fa=>{fa.forEach(Ia=>{Ia.dependencies&&re.set(Ia.id,Ia.dependencies),Ia.subtasks&&ye(Ia.subtasks);});};ye(Y);let Se=re.get(U)||[];re.set(U,[...Se,N]);let Ft=new Set,Bt=new Set,_t=fa=>{if(!Ft.has(fa)){Ft.add(fa),Bt.add(fa);let Ia=re.get(fa)||[];for(let er of Ia){if(!Ft.has(er)&&_t(er))return true;if(Bt.has(er))return true}}return Bt.delete(fa),false};return _t(U)},[]),Ti=react.useCallback((N,U)=>{if(xr(N.id,U,we)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
276
+ </Project>`,p=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(p),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=oe.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+p;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let p=n.startDate&&n.endDate?oe.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-p;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let m=[];for(let n of a){let p=r.get(n.id),l=d.get(n.id);if(p&&l){let i=l.ls-p.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=oe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(oe.calculateCriticalPath(e).includes(t))return 0;let o=oe.getDependentTasks(e,t);if(o.length===0){let c=oe.getLatestEndDate(e);if(!c)return null;let m=oe.calculateDuration(a.endDate,c);return Math.max(0,m)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,m)=>c-m)[0];if(!s)return null;let d=oe.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>oe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=oe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=oe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=oe.calculateDuration(d.startDate,d.endDate),m;a!==void 0?(m=new Date(d.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=oe.calculateEndDate(m,c),p=l=>l.map(i=>i.id===d.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:p(i.subtasks)}:i);s=p(s),s=oe.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let m=[],n=o.getTime(),p=1e3*60*60*24,l=oe.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=oe.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),D=(x.endDate.getTime()-g)/p,A=(g-n)/p*s,w=A+v*s,L=Math.max(D*s,s),T=c+b*d+12;m.push({taskId:x.id,taskName:x.name,originalX:A,previewX:w,width:L,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=oe.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=p=>p.map(l=>l.id===o.id?{...l,endDate:c,segments:m}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function Ko({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:p,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=react.useState([]),[x,b]=react.useState(null),[g,C]=react.useState(null),D=react.useCallback(S=>{b(S);},[]),h=react.useCallback(S=>{C(S);},[]),A=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),w=r==="day"?60:r==="week"?20:8,L=A*w*d,T=S=>{let F=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),M=F.getUTCDay()||7;F.setUTCDate(F.getUTCDate()+4-M);let V=new Date(Date.UTC(F.getUTCFullYear(),0,1));return Math.ceil(((F.getTime()-V.getTime())/864e5+1)/7)},$=S=>{let F=S.getDay();return F===0||F===6},G=react.useCallback(S=>{let F=Math.round(S/(w*d)),M=new Date(o);return M.setDate(M.getDate()+F),M},[o,w,d]),z=react.useCallback((S,F)=>{if(F.startDate&&F.endDate)return;let M=S.currentTarget.ownerSVGElement;if(!M)return;let V=M.createSVGPoint();V.x=S.clientX,V.y=S.clientY;let P=V.matrixTransform(M.getScreenCTM()?.inverse()),W=G(P.x),de=new Date(W);de.setDate(de.getDate()+1),l?.(F,W,de);},[G,l]),E=react.useMemo(()=>{let S=P=>P.map(W=>{if(W.subtasks&&W.subtasks.length>0){let de=S(W.subtasks),ae=de.filter(Ee=>Ee.startDate&&Ee.endDate);if(ae.length>0){let Ee=ae.map(at=>at.startDate.getTime()),le=ae.map(at=>at.endDate.getTime()),Ve=new Date(Math.min(...Ee)),he=new Date(Math.max(...le));return {...W,subtasks:de,startDate:Ve,endDate:he}}return {...W,subtasks:de}}return W}),F=(P,W=[])=>{for(let de of P)W.push(de),de.subtasks&&de.subtasks.length>0&&(de.isExpanded===void 0||de.isExpanded)&&F(de.subtasks,W);return W},M=S(e);return F(M)},[e]),X=react.useCallback(S=>{if(!S.startDate||!S.endDate)return {x:0,width:0};let F=S.startDate.getTime(),M=S.endDate.getTime(),V=o.getTime(),P=(F-V)/(1e3*60*60*24),W=(M-F)/(1e3*60*60*24),de=P*w*d,ae=Math.max(w*d,40),Ee=Math.max(W*w*d,ae);return {x:de,width:Ee}},[o,w,d]),fe=react.useMemo(()=>E.filter(S=>S.startDate&&S.endDate).map(S=>{let{x:F,width:M}=X(S),P=E.findIndex(W=>W.id===S.id)*a+12;return {id:S.id,x:F,y:P,width:M,height:32}}),[E,X]),Ce=react.useCallback((S,F,M)=>{if(!M||F===0){y([]);return}let V=oe.calculateCascadePreview(e,S,F,E,o,w*d,a,48);y(V);},[e,E,o,w,d,a,48]),Le=react.useMemo(()=>{let S=[],F=new Date(o);for(;F<=s;){let P=(F.getTime()-o.getTime())/864e5*w*d;if(r==="day")S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:P}),F.setDate(F.getDate()+1);else if(r==="week"){let W=T(F);S.push({date:new Date(F),label:`Week ${W}`,x:P}),F.setDate(F.getDate()+7);}else S.push({date:new Date(F),label:F.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:P}),F.setMonth(F.getMonth()+1);}return S},[o,s,r,w,d]),Pe=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*w*d,[o,w,d]),ce=Math.max(E.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:48,fill:t.bgGrid}),Le.map((S,F)=>jsxRuntime.jsxs("g",{children:[F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:S.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:S.label})]},`header-${F}`)),Pe>=0&&Pe<=L&&jsxRuntime.jsx("circle",{cx:Pe,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(L,1e3),height:ce,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(L,1e3),height:ce,fill:t.bgPrimary}),Le.map((S,F)=>{let M=Le[F+1]?.x||L,V=$(S.date);return jsxRuntime.jsxs("g",{children:[V&&jsxRuntime.jsx("rect",{x:S.x,y:0,width:M-S.x,height:E.length*a,fill:t.bgWeekend,opacity:1}),F>0&&jsxRuntime.jsx("line",{x1:S.x,y1:0,x2:S.x,y2:E.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},F)}),Pe>=0&&Pe<=L&&jsxRuntime.jsx("line",{x1:Pe,y1:0,x2:Pe,y2:E.length*a,stroke:t.today,strokeWidth:2,opacity:1}),E.map((S,F)=>{let M=S.startDate&&S.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:F%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${S.id}`),!M&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:F*a,width:L,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:V=>z(V,S),onMouseEnter:V=>{V.currentTarget.setAttribute("fill",t.accentLight),V.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:V=>{V.currentTarget.setAttribute("fill","transparent"),V.currentTarget.setAttribute("opacity","1");}},`clickable-${S.id}`),jsxRuntime.jsx("text",{x:Pe>0?Pe:100,y:F*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${S.id}`)]})]},`row-group-${S.id}`)}),E.map((S,F)=>!S.dependencies||S.dependencies.length===0||!S.startDate||!S.endDate?null:S.dependencies.map(M=>{let V=E.find(ae=>ae.id===M);if(!V||!V.startDate||!V.endDate)return null;let P=E.findIndex(ae=>ae.id===M),W=X(V),de=X(S);return jsxRuntime.jsx(Ho,{x1:W.x+W.width,y1:P*a+a/2,x2:de.x,y2:F*a+a/2,theme:t,onDelete:()=>u?.(S.id,M),onHoverChange:h},`dep-${M}-${S.id}`)})),E.map((S,F)=>{if(!S.startDate||!S.endDate)return null;let{x:M,width:V}=X(S),P=F*a+12,W=S.subtasks&&S.subtasks.length>0&&!S.isMilestone;return S.isMilestone?jsxRuntime.jsx(Vo,{task:S,x:M+V/2,y:P+16,theme:t,onClick:m},S.id):W?jsxRuntime.jsxs("g",{onClick:()=>m?.(S),onContextMenu:de=>{de.preventDefault(),de.stopPropagation(),p?.(S,de);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:M,y:P,width:V,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M+V,y2:P,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P,x2:M,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M+V,y1:P,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:M,y1:P+32,x2:M+V,y2:P+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),V>60&&jsxRuntime.jsx("text",{x:M+12,y:P+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:S.name})]},S.id):jsxRuntime.jsx(Uo,{task:S,x:M,y:P,width:V,theme:t,dayWidth:w*d,startDate:o,templates:c,onClick:m,onDoubleClick:n,onContextMenu:p,onDateChange:l,onDependencyCreate:i,allTaskPositions:fe,onDragMove:Ce,onHoverChange:D},S.id)}),f.map(S=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:S.previewX,y:S.y-48,width:S.width,height:32,rx:8,fill:S.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(S.daysDelta)>0&&jsxRuntime.jsx("text",{x:S.previewX+S.width/2,y:S.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:S.daysDelta>0?`+${S.daysDelta}d`:`${S.daysDelta}d`})]},`cascade-preview-${S.taskId}`)),g&&(()=>{let{x1:S,y1:F,x2:M,y2:V,onDelete:P}=g,W=M-S,de=V-F,ae=S+W/2,Ee=(F+V)/2,le=`M ${S} ${F} C ${ae} ${F}, ${ae} ${V}, ${M} ${V}`,Ve=6,he=Math.atan2(de,W),at=M-Ve*Math.cos(he-Math.PI/6),Et=V-Ve*Math.sin(he-Math.PI/6),gt=M-Ve*Math.cos(he+Math.PI/6),ft=V-Ve*Math.sin(he+Math.PI/6),rt=t.dependency;return jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:le,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("path",{d:`M ${M} ${V} L ${at} ${Et} M ${M} ${V} L ${gt} ${ft}`,fill:"none",stroke:rt,strokeWidth:3,strokeLinecap:"round",opacity:1}),jsxRuntime.jsx("circle",{cx:M,cy:V,r:5,fill:rt}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:ot=>{ot.stopPropagation(),P();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsxRuntime.jsx("circle",{cx:ae,cy:Ee,r:10,fill:t.bgSecondary,stroke:t.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:ae-4,y1:Ee-4,x2:ae+4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ae+4,y1:Ee-4,x2:ae-4,y2:Ee+4,stroke:t.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})})(),x&&jsxRuntime.jsx(sd,{tooltipData:x,theme:t})]})]})}var Yo=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Es=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ps=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Xo({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:m="dark",customStatuses:n=[]}){let p=[...Es,...n.filter(P=>!Es.some(W=>W.id===P.id))],l=Oe[m]||Oe.dark,[i,u]=react.useState(false),[v,f]=react.useState(false),[y,x]=react.useState(false),[b,g]=react.useState(false),[C,D]=react.useState(null),[h,A]=react.useState(new Date),[w,L]=react.useState(false),T=react.useRef(null),$=react.useRef(null),G=react.useRef(null),z=react.useRef(null),[E,X]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[fe,Ce]=react.useState({});react.useEffect(()=>{a?(X({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&L(true)):(X({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),react.useEffect(()=>{let P=W=>{T.current&&!T.current.contains(W.target)&&u(false),$.current&&!$.current.contains(W.target)&&f(false),G.current&&!G.current.contains(W.target)&&x(false),z.current&&!z.current.contains(W.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let Le=()=>{let P={};return E.name.trim()||(P.name="El nombre es requerido"),E.startDate&&E.endDate&&E.startDate>E.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),Ce(P),Object.keys(P).length===0},Pe=async P=>{if(P.preventDefault(),!!Le())try{await s(E),t();}catch(W){console.error("Error submitting task:",W);}},ce=(P,W)=>{X(de=>{let ae={...de,[P]:W};if(P==="status"){let Ee=W;Ee==="todo"?ae.progress=0:Ee==="in-progress"?(de.progress===0||de.progress===100)&&(ae.progress=50):Ee==="completed"||Ee==="closed"?ae.progress=100:(Ee==="in-review"||Ee==="review")&&(ae.progress=75);}if(P==="progress"){let Ee=typeof W=="number"?W:parseInt(W,10);Ee===100&&de.status!=="completed"?ae.status="completed":Ee>0&&Ee<100&&de.status==="todo"?ae.status="in-progress":Ee===0&&de.status!=="todo"&&(ae.status="todo");}return ae}),fe[P]&&Ce(de=>{let ae={...de};return delete ae[P],ae});},S=p.find(P=>P.id===E.status)??Es[0],F=Ps.find(P=>P.id===E.priority)??Ps[1],M=Yo.find(P=>P.value===E.color)??Yo[0],V={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color||l.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:E.name,onChange:P=>ce("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),fe.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),fe.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:E.description||"",onChange:P=>ce("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:T,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...V,borderColor:S.color,backgroundColor:`${S.color}15`},disabled:d,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),jsxRuntime.jsx("span",{style:{color:S.color},children:S.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:S.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:p.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("status",P.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,E.status===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:F.color}}),jsxRuntime.jsx("span",{children:F.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Ps.map(P=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:W=>W.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:W=>W.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("priority",P.id),f(false);},children:[jsxRuntime.jsx("span",{children:P.icon}),P.label,E.priority===P.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:G,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[E.assignees&&E.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:E.assignees.slice(0,3).map((P,W)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},W))}),E.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:l.textTertiary},children:["+",E.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let W=E.assignees?.some(de=>de.name===P.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{let de=W?(E.assignees||[]).filter(ae=>ae.name!==P.name):[...E.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),color:l.accent}];ce("assignees",de);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:P.name}),W&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})]},P.id)})})})]}),jsxRuntime.jsxs("div",{ref:z,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!d&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:V,disabled:d,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:E.color}}),jsxRuntime.jsx("span",{children:M.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{style:{padding:"14px 18px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:Yo.slice(0,16).map(P=>{let W=E.color===P.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>{ce("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:W?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="start"?null:"start"),A(E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.startDate?E.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{!d&&!E.isMilestone&&(D(C==="end"?null:"end"),A(E.endDate||E.startDate||new Date));},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...V,opacity:E.isMilestone?.5:1,cursor:E.isMilestone?"not-allowed":"pointer"},disabled:d||E.isMilestone,children:E.endDate?E.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,W=new Date(P);W.setDate(P.getDate()+1);let de=new Date(P);de.setDate(P.getDate()+7);let ae=new Date(P);return ae.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:W},{label:"Pr\xF3xima semana",date:de},{label:"2 semanas",date:ae}].map((le,Ve)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:he=>he.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:he=>he.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(ce("startDate",le.date),(!E.endDate||le.date>E.endDate)&&ce("endDate",le.date),D("end")):(ce("endDate",le.date),(!E.startDate||le.date<E.startDate)&&ce("startDate",le.date),D(null));},children:le.label},Ve))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${l.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("startDate",void 0),ce("endDate",void 0),D(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:h.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>A(new Date(h.getFullYear(),h.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,W)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},W))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=h.getFullYear(),W=h.getMonth(),de=new Date(P,W,1).getDay(),ae=new Date(P,W+1,0).getDate(),Ee=new Date,le=[];for(let he=de-1;he>=0;he--)le.push({day:new Date(P,W,-he).getDate(),date:new Date(P,W-1,new Date(P,W,-he).getDate()),isCurrentMonth:false});for(let he=1;he<=ae;he++)le.push({day:he,date:new Date(P,W,he),isCurrentMonth:true});let Ve=42-le.length;for(let he=1;he<=Ve;he++)le.push({day:he,date:new Date(P,W+1,he),isCurrentMonth:false});return le.map((he,at)=>{let Et=he.date.toDateString()===Ee.toDateString(),gt=E.startDate?.toDateString()===he.date.toDateString(),ft=E.endDate?.toDateString()===he.date.toDateString(),rt=E.startDate&&E.endDate&&he.date>=E.startDate&&he.date<=E.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:he.isCurrentMonth?gt||ft?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:gt?"#3B82F6":ft?"#7C3AED":rt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Et&&!gt&&!ft?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(ce("startDate",he.date),E.endDate&&he.date>E.endDate&&ce("endDate",he.date),D("end")):(ce("endDate",he.date),E.startDate&&he.date<E.startDate&&ce("startDate",he.date),D(null));},children:he.day},at)})})()})]})]})]})})]}),fe.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:fe.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:E.progress,onChange:P=>ce("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"}20`,color:E.progress<30?"#EF4444":E.progress<70?"#F59E0B":"#10B981"},children:[E.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>L(!w),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${w?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:E.isMilestone,onChange:P=>ce("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let W=E.dependencies?.includes(P.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let de=W?(E.dependencies||[]).filter(ae=>ae!==P.id):[...E.dependencies||[],P.id];ce("dependencies",de);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:W?`${l.accent}30`:l.bgPrimary,color:W?l.accent:l.textSecondary,border:`1px solid ${W?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var zg=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],md=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),$g=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Ug=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Wg=()=>jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M5 12h14"})}),Gg=()=>jsxRuntime.jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsxRuntime.jsx(framerMotion.motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Jo({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:m}){let[n,p]=react.useState(false),[l,i]=react.useState(false),[u,v]=react.useState([]),[f,y]=react.useState(""),[x,b]=react.useState(false),[g,C]=react.useState(true),D=react.useRef(null),h=react.useRef(null),A=react.useRef(null),{enabled:w=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:G=zg,maxHistory:z=50,persistHistory:E}=a,X=E?.storageKey||"gantt-ai-history",fe=E?.maxMessages??5;react.useEffect(()=>{if(E?.enabled)try{let F=localStorage.getItem(X);if(F){let V=JSON.parse(F).map(P=>({...P,timestamp:new Date(P.timestamp)}));v(V.slice(-fe));}}catch(F){console.warn("[GanttAIAssistant] Failed to load persisted history:",F);}},[E?.enabled,X,fe]),react.useEffect(()=>{if(E?.enabled&&u.length>0)try{let F=u.filter(M=>!M.isLoading).slice(-fe);localStorage.setItem(X,JSON.stringify(F));}catch(F){console.warn("[GanttAIAssistant] Failed to persist history:",F);}},[u,E?.enabled,X,fe]),react.useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),react.useEffect(()=>{n&&!l&&D.current&&setTimeout(()=>D.current?.focus(),100);},[n,l]);let Ce=react.useCallback(F=>{if(F.success)switch(F.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":F.taskId&&F.updates&&o?.(F.taskId,F.updates);break;case "create_task":F.newTask&&s?.(F.newTask);break;case "delete_task":F.taskId&&d?.(F.taskId);break;case "link_tasks":F.dependencyFrom&&F.dependencyTo&&c?.(F.dependencyFrom,F.dependencyTo);break;case "unlink_tasks":F.taskId&&F.dependencyFrom&&m?.(F.taskId,F.dependencyFrom);break}},[o,s,d,c,m]),Le=react.useCallback(async F=>{if(!F.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:F,timestamp:new Date};v(P=>[...P.slice(-(z-1)),M]),y(""),C(false),b(true);let V={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(P=>[...P,V]);try{if($){let P=await $(F,e);v(W=>{let de=W.filter(Ee=>!Ee.isLoading),ae={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...de,ae]}),Ce(P);}else v(P=>[...P.filter(de=>!de.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(P){v(W=>[...W.filter(ae=>!ae.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${P instanceof Error?P.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,z,$,e,Ce]),Pe=F=>{F.preventDefault(),Le(f);},ce=F=>{y(F),D.current?.focus();};if(react.useEffect(()=>{let F=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),p(V=>!V),n||i(false)),M.key==="Escape"&&n&&p(false);};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n]),react.useEffect(()=>{if(!n)return;let F=V=>{let P=V.target;A.current&&!A.current.contains(P)&&p(false);},M=setTimeout(()=>{document.addEventListener("mousedown",F);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",F);}},[n]),!w)return null;let S={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!n&&jsxRuntime.jsxs(framerMotion.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${S[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>p(true),children:[jsxRuntime.jsx(md,{}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsxRuntime.jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsxRuntime.jsx(md,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>i(F=>!F),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Wg,{})}),jsxRuntime.jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(Ug,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map((F,M)=>jsxRuntime.jsx("button",{onClick:()=>ce(F),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:F.length>30?F.slice(0,30)+"...":F},M))})]}),u.map(F=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${F.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${F.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:F.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:F.role==="user"?"white":t.textPrimary},children:[F.isLoading?jsxRuntime.jsx(Gg,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:F.content}),F.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:F.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:F.command.success?"#10B981":"#EF4444"},children:[F.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:F.command.type.replace(/_/g," ")})]})]})},F.id)),jsxRuntime.jsx("div",{ref:h})]}),jsxRuntime.jsxs("form",{onSubmit:Pe,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsxRuntime.jsx("input",{ref:D,type:"text",value:f,onChange:F=>y(F.target.value),placeholder:L,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsxRuntime.jsx($g,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function pd(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((n,p=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!p)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=react.useCallback(()=>{r(n=>{if(n.past.length===0)return n;let p=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:p,future:[n.present,...n.future]}});},[]),c=react.useCallback(()=>{r(n=>{if(n.future.length===0)return n;let p=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:p,future:l}});},[]),m=react.useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function ud({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=c?d.metaKey:d.ctrlKey;if(m&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&m&&d.key==="y"){d.preventDefault(),t();return}if(c&&m&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${oe.formatDate(e.startDate)} - ${oe.formatDate(e.endDate)}`);let a=oe.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>oe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function gd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},hd=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:p=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:C,onTaskDblClick:D,onTaskContextMenu:h,onTaskUpdate:A,onProgressChange:w,onTaskEdit:L,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:G,onDependencyCreate:z,onDependencyDelete:E,onBeforeTaskAdd:X,onAfterTaskAdd:fe,onBeforeTaskUpdate:Ce,onAfterTaskUpdate:Le,onBeforeTaskDelete:Pe,onAfterTaskDelete:ce}=a,F=react.useContext(Lo)?.theme,[M,V]=react.useState(F||s||"dark"),[P,W]=react.useState(d),[de,ae]=react.useState(c),[Ee,le]=react.useState(1),[Ve,he]=react.useState(0),[at,Et]=react.useState(false),[gt,ft]=react.useState(null),[rt,ot]=react.useState({isOpen:false,x:0,y:0,task:null}),[la,wt]=react.useState(null),[ct,Lt]=react.useState(null);react.useEffect(()=>{F&&F!==M&&V(F);},[F]),react.useEffect(()=>{s&&s!==M&&V(s);},[s]);let jt=react.useCallback(N=>{V(N),g?.(N);},[g]),{state:we,setState:O,undo:De,redo:Ue,canUndo:$e,canRedo:bt,clearHistory:J}=pd(t,50);react.useEffect(()=>{O(t);},[t,O]);let Q=react.useRef(t),xe=react.useRef(true);react.useEffect(()=>{if(xe.current){xe.current=false,Q.current=we;return}if(!r)return;let N=JSON.stringify(Q.current),U=JSON.stringify(we);N!==U&&(Q.current=we,r(we));},[we,r]);let ge=react.useMemo(()=>ps(v,f),[v,f]),ee=react.useCallback(N=>[{id:"name",label:N.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:N.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:N.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:N.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:N.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:N.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:N.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:N.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[Te,be]=react.useState(()=>ee(ge));react.useEffect(()=>{be(N=>N.map(U=>({...U,label:ge.columns[U.id==="name"?"taskName":U.id]||U.label})));},[ge]);let ke=react.useMemo(()=>{let N=Te.filter(re=>re.visible),U=N.some(re=>re.id!=="name");return N.reduce((re,ye)=>re+ye.width,0)+(U?20:0)},[Te]);react.useEffect(()=>{gt!==null&&gt>ke&&(Te.filter(Y=>Y.visible).some(Y=>Y.id!=="name")||ft(null));},[Te,ke,gt]);let R=react.useMemo(()=>gt!==null?Math.max(280,gt,ke):Math.max(280,ke),[gt,ke]),H=react.useRef(null),q=react.useRef(null),se=react.useRef(null),ie=react.useMemo(()=>Ll(M),[M]),B=react.useMemo(()=>({theme:ie,themeName:M}),[ie,M]),K=react.useMemo(()=>gd(l),[l]),Ne=react.useMemo(()=>{if(!i)return we;let N=oe.calculateCriticalPath(we),U=Y=>Y.map(re=>({...re,isCriticalPath:N.includes(re.id),subtasks:re.subtasks?U(re.subtasks):void 0}));return U(we)},[we,i]),je=Qg(de);ud({undo:De,redo:Ue,canUndo:$e,canRedo:bt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>oe.findTaskById(we,N),addTask:(N,U)=>{O(Y=>{if(!U)return [...Y,{...N,level:0}];let re=ye=>ye.map(Se=>Se.id===U?{...Se,subtasks:[...Se.subtasks||[],{...N,parentId:U,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},updateTask:(N,U)=>{O(Y=>{let re=ye=>ye.map(Se=>Se.id===N?{...Se,...U}:Se.subtasks?{...Se,subtasks:re(Se.subtasks)}:Se);return re(Y)});},deleteTask:N=>{O(U=>{let Y=re=>re.filter(ye=>ye.id===N?false:(ye.subtasks&&(ye.subtasks=Y(ye.subtasks)),true));return Y(U)});},deleteTasks:N=>{O(U=>vs(U,N));},duplicateTask:N=>{O(U=>xs(U,[N]));},splitTask:(N,U,Y=3)=>{O(re=>oe.splitTask(re,N,U,Y));},calculateEndDate:oe.calculateEndDate,calculateDuration:oe.calculateDuration,validateDependency:(N,U)=>!oe.validateDependencies(we,N,U),getAllTasks:()=>oe.flattenTasks(we),getTasksByStatus:N=>oe.flattenTasks(we).filter(U=>U.status===N),getTasksByParent:N=>N?oe.findTaskById(we,N)?.subtasks||[]:we.filter(Y=>!Y.parentId),getCriticalPath:()=>oe.flattenTasks(we).filter(N=>N.isCriticalPath),indentTask:N=>{O(U=>bs(U,[N]));},outdentTask:N=>{O(U=>hs(U,[N]));},moveTask:(N,U)=>{O(Y=>ys(Y,[N],U));},createSubtask:async N=>{let{tasks:U,newTask:Y}=Cs(we,N);if(X){let re=X({...Y,parentId:N});if((re instanceof Promise?await re:re)===false)return}O(U),fe&&fe({...Y,parentId:N});},scrollToTask:N=>{let Y=oe.flattenTasks(we).findIndex(re=>re.id===N);if(Y!==-1&&H.current){let re=Y*je;H.current.scrollTo({top:re,behavior:"smooth"}),q.current&&q.current.scrollTo({top:re,behavior:"smooth"});}},highlightTask:(N,U=2e3)=>{},expandTask:N=>{O(U=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(U)});},collapseTask:N=>{O(U=>{let Y=re=>re.map(ye=>ye.id===N?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye);return Y(U)});},expandAll:()=>{O(N=>{let U=Y=>Y.map(re=>({...re,isExpanded:true,subtasks:re.subtasks?U(re.subtasks):void 0}));return U(N)});},collapseAll:()=>{O(N=>{let U=Y=>Y.map(re=>({...re,isExpanded:false,subtasks:re.subtasks?U(re.subtasks):void 0}));return U(N)});},undo:De,redo:Ue,canUndo:()=>$e,canRedo:()=>bt,clearHistory:J,exportToPNG:async()=>{if(!se.current)throw new Error("Gantt container not found");let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2});return new Promise((U,Y)=>{N.toBlob(re=>{re?U(re):Y(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async N=>{await oe.exportToPDF(we,N);},exportToExcel:async N=>{await oe.exportToExcel(we,N);},exportToJSON:()=>oe.exportToJSON(we),exportToCSV:()=>oe.exportToCSV(we),importFromJSON:N=>{let U=oe.importFromJSON(N);O(U);},getTasks:()=>we,refresh:()=>{O(N=>[...N]);},clearAll:()=>{O([]);}}),[we,De,Ue,$e,bt,J,ie,je]);let Pt=react.useCallback(N=>{be(U=>U.map(Y=>Y.id===N?{...Y,visible:!Y.visible}:Y));},[]),Wr=react.useCallback((N,U)=>{be(Y=>Y.map(re=>{if(re.id!==N)return re;let ye=re.minWidth??100,Se=re.maxWidth??800,Ft=Math.max(ye,Math.min(Se,U));return {...re,width:Ft}}));},[]),Gr=react.useCallback(N=>{O(U=>ws(U,N)),a.onTaskToggleExpand?.(N);},[a]),Wa=react.useCallback((N,U)=>{if(Ce&&Ce(N,U)===false)return;let re=oe.findTaskById(we,N)?.progress,ye=Ft=>Ft.map(Bt=>Bt.id===N?{...Bt,...U}:Bt.subtasks?{...Bt,subtasks:ye(Bt.subtasks)}:Bt);O(ye(we));let Se=oe.findTaskById(ye(we),N);Se&&(A?.(Se),Le?.(Se),U.progress!==void 0&&re!==void 0&&U.progress!==re&&w?.(N,re,U.progress));},[we,A,Ce,Le,w]),yn=react.useCallback(N=>{N.length!==0&&(O(U=>bs(U,N)),a.onTaskIndent?.(N[0]));},[a]),me=react.useCallback(N=>{N.length!==0&&(O(U=>hs(U,N)),a.onTaskOutdent?.(N[0]));},[a]),mt=react.useCallback((N,U,Y)=>{O(re=>Ql(re,N,U,Y)),a.onTaskReparent?.(N,U,Y);},[a]),Ht=react.useCallback((N,U)=>{N.length!==0&&(O(Y=>ys(Y,N,U)),a.onTaskMove?.(N[0],U));},[a]),Ga=react.useCallback(async N=>{let U=[];for(let Y of N)Pe&&await Promise.resolve(Pe(Y))===false||U.push(Y);U.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(U):(O(Y=>vs(Y,U)),U.forEach(Y=>a.onTaskDelete?.(Y))),ce&&U.forEach(Y=>ce(Y)));},[a,Pe,ce]),bo=react.useCallback(N=>{O(U=>xs(U,N)),N.forEach(U=>a.onTaskDuplicate?.(U));},[a]),vr=react.useCallback((N,U)=>{O(Y=>{let{tasks:re,newTask:ye}=Zl(Y,N,U);return X&&X(ye)===false?Y:(a.onTaskCreate?.(ye.parentId,ye.position||0),fe?.(ye),re)});},[a,X,fe]),Ma=react.useCallback((N,U)=>{O(Y=>ks(Y,N,U)),a.onTaskRename?.(N,U);},[a]),Aa=react.useCallback(N=>{O(U=>{let{tasks:Y}=Cs(U,N);return a.onTaskCreate?.(N,0),Y});},[a]),Ct=react.useCallback((N,U,Y)=>{let re=N.startDate?Math.round((U.getTime()-N.startDate.getTime())/864e5):0,ye=Bt=>Bt.map(_t=>_t.id===N.id?{..._t,startDate:U,endDate:Y,...N.segments&&{segments:N.segments}}:_t.subtasks?{..._t,subtasks:ye(_t.subtasks)}:_t),Se=ye(we);Se=oe.autoScheduleDependents(Se,N.id,re),O(Se);let Ft={...N,startDate:U,endDate:Y};A?.(Ft);},[we,A]),vn=react.useCallback((N,U)=>{h?.(N,U),ot({isOpen:true,x:U.clientX,y:U.clientY,task:N});},[h]),xn=react.useCallback((N,U)=>{let Y=oe.splitTask(we,N.id,U);O(Y),ot({isOpen:false,x:0,y:0,task:null});},[we]),kn=react.useCallback(N=>{D?.(N),L||wt(N);},[D,L]),xr=react.useCallback((N,U,Y)=>{let re=new Map,ye=fa=>{fa.forEach(Ia=>{Ia.dependencies&&re.set(Ia.id,Ia.dependencies),Ia.subtasks&&ye(Ia.subtasks);});};ye(Y);let Se=re.get(U)||[];re.set(U,[...Se,N]);let Ft=new Set,Bt=new Set,_t=fa=>{if(!Ft.has(fa)){Ft.add(fa),Bt.add(fa);let Ia=re.get(fa)||[];for(let er of Ia){if(!Ft.has(er)&&_t(er))return true;if(Bt.has(er))return true}}return Bt.delete(fa),false};return _t(U)},[]),Ti=react.useCallback((N,U)=>{if(xr(N.id,U,we)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
277
277
 
278
278
  Task dependencies must flow in one direction only.`);return}let Y=re=>re.map(ye=>{if(ye.id===U){let Se=ye.dependencies||[];if(!Se.includes(N.id))return {...ye,dependencies:[...Se,N.id]}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});O(Y(we)),z?.(N.id,U);},[we,z,xr]),Di=react.useCallback((N,U)=>{let Y=re=>re.map(ye=>{if(ye.id===N&&ye.dependencies){let Se=ye.dependencies.filter(Ft=>Ft!==U);return {...ye,dependencies:Se}}return ye.subtasks?{...ye,subtasks:Y(ye.subtasks)}:ye});O(Y(we)),E?.(N,U);},[we,E]),{startDate:Ac,endDate:Ic}=react.useMemo(()=>{let N=we.filter(Se=>Se.startDate&&Se.endDate);if(N.length===0){let Se=new Date,Ft=new Date(Se);Ft.setDate(Ft.getDate()-30);let Bt=new Date(Se);return Bt.setDate(Bt.getDate()+60),{startDate:Ft,endDate:Bt}}let U=N.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),Y=new Date(Math.min(...U.map(Se=>Se.getTime()))),re=new Date(Math.max(...U.map(Se=>Se.getTime()))),ye=P==="day"?7:P==="week"?14:30;return Y.setDate(Y.getDate()-ye),re.setDate(re.getDate()+ye),{startDate:Y,endDate:re}},[we,P]),Lc=react.useCallback(async()=>{if(!se.current)return;let N=await bd__default.default(se.current,{backgroundColor:ie.bgPrimary,scale:2}),U=document.createElement("a");U.download="gantt-chart.png",U.href=N.toDataURL("image/png"),U.click();},[ie]),Fc=react.useCallback(async()=>{await oe.exportToPDF(we);},[we]),Bc=react.useCallback(async()=>{await oe.exportToExcel(we);},[we]),Rc=react.useCallback(()=>{let N=oe.exportToCSV(we),U=new Blob([N],{type:"text/csv;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(U),Y.download="gantt-chart.csv",Y.click(),URL.revokeObjectURL(Y.href);},[we]),Oc=react.useCallback(()=>{let N=oe.exportToJSON(we),U=new Blob([N],{type:"application/json;charset=utf-8;"}),Y=document.createElement("a");Y.href=URL.createObjectURL(U),Y.download="gantt-chart.json",Y.click(),URL.revokeObjectURL(Y.href);},[we]),zc=react.useCallback(()=>{oe.exportToMSProject(we,"Gantt Project","project.xml");},[we]),$c=N=>{N.preventDefault(),Et(true);};return react.useEffect(()=>{let N=q.current,U=H.current;if(!N||!U)return;let Y=U.querySelector(".gantt-taskgrid-content"),re=()=>{let _t=N.scrollTop;he(_t),Y&&(Y.style.transform=`translateY(-${_t}px)`);},ye=_t=>{if(at&&U){let Ia=U.parentElement?.getBoundingClientRect()?.left||0,er=_t.clientX-Ia,Uc=280,Wc=Math.min(window.innerWidth-300,800);er>=Uc&&er<=Wc&&ft(er);}},Se=()=>{Et(false);},Ft=U.querySelector(".gantt-grid-scroll")||U,Bt=_t=>{let fa=_t;fa.deltaY!==0&&(N.scrollTop+=fa.deltaY,_t.preventDefault());};return N.addEventListener("scroll",re),Ft.addEventListener("wheel",Bt,{passive:false}),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Se),()=>{N.removeEventListener("scroll",re),Ft.removeEventListener("wheel",Bt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Se);}},[at]),jsxRuntime.jsx(Ar.Provider,{value:ge,children:jsxRuntime.jsx(Nn.Provider,{value:B,children:jsxRuntime.jsxs("div",{ref:se,className:"flex flex-col h-full w-full",style:{backgroundColor:ie.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(Bo,{theme:ie,timeScale:P,onTimeScaleChange:W,zoom:Ee,onZoomChange:le,currentTheme:M,onThemeChange:jt,rowDensity:de,onRowDensityChange:ae,showThemeSelector:m,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?Lc:void 0,onExportPDF:n?Fc:void 0,onExportExcel:n?Bc:void 0,onExportCSV:n?Rc:void 0,onExportJSON:n?Oc:void 0,onExportMSProject:n?zc:void 0}),jsxRuntime.jsxs("div",{ref:H,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:R,overflow:"hidden"},children:jsxRuntime.jsx($o,{tasks:Ne,theme:ie,rowHeight:je,availableUsers:p,templates:K,onTaskClick:C,onTaskDblClick:kn,onTaskContextMenu:h,onTaskToggle:Gr,scrollTop:Ve,columns:Te,onToggleColumn:Pt,onColumnResize:Wr,onTaskUpdate:Wa,onTaskIndent:yn,onTaskOutdent:me,onTaskMove:Ht,onMultiTaskDelete:Ga,onTaskDuplicate:bo,onTaskCreate:vr,onTaskRename:Ma,onCreateSubtask:Aa,onOpenTaskModal:C?N=>C(N):void 0,onDeleteRequest:(N,U)=>Lt({taskId:N,taskName:U}),onTaskReparent:mt})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:$c}),jsxRuntime.jsx("div",{ref:q,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Ko,{tasks:Ne,theme:ie,rowHeight:je,timeScale:P,startDate:Ac,endDate:Ic,zoom:Ee,templates:K,onTaskClick:C,onTaskDblClick:kn,onTaskContextMenu:vn,onTaskDateChange:Ct,onDependencyCreate:Ti,onDependencyDelete:Di})})]}),rt.task&&jsxRuntime.jsx(Ir,{isOpen:rt.isOpen,x:rt.x,y:rt.y,theme:ie,onClose:()=>ot({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=rt.task;return N?N.subtasks&&N.subtasks.length>0?[{id:"addSubtask",label:ge.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{T?T(N):Aa(N.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ge.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[{id:"edit",label:ge.contextMenu?.editTask||"Edit Task",icon:lt.Pencil,onClick:()=>{L?L(N):wt(N);}},{id:"addSubtask",label:ge.contextMenu?.addSubtask||"Add Subtask",icon:lt.Add,onClick:()=>{T?T(N):Aa(N.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:ge.contextMenu?.markIncomplete||"Mark Incomplete",icon:lt.MarkIncomplete,onClick:()=>{$?$(N):Wa(N.id,{status:"todo",progress:0});},disabled:N.status==="todo"},{id:"setInProgress",label:ge.contextMenu?.setInProgress||"Set In Progress",icon:lt.SetInProgress,onClick:()=>{G?G(N):Wa(N.id,{status:"in-progress"});},disabled:N.status==="in-progress"},{id:"markComplete",label:ge.contextMenu?.markComplete||"Mark Complete",icon:lt.MarkComplete,onClick:()=>{Wa(N.id,{status:"completed",progress:100});},disabled:N.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:ge.contextMenu?.splitTask||"Split Task",icon:lt.Split,onClick:()=>{if(!N.startDate||!N.endDate){console.warn("Cannot split task without dates");return}let Y=N.startDate.getTime(),re=N.endDate.getTime(),ye=Y+(re-Y)/2,Se=new Date(ye);xn(N,Se);},disabled:!N.startDate||!N.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:ge.contextMenu?.deleteTask||"Delete Task",icon:lt.Delete,onClick:()=>{Lt({taskId:N.id,taskName:N.name});}}]:[]})()}),la&&jsxRuntime.jsx(Xo,{isOpen:true,onClose:()=>wt(null),task:la,onSubmit:N=>{Wa(la.id,N),wt(null);},mode:"edit",theme:M}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ct&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Lt(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:N=>N.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ie.bgSecondary,border:`1px solid ${ie.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ie.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:ie.textPrimary,fontFamily:"Inter, sans-serif"},children:[ge.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:ie.textPrimary},children:['"',ct.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ie.bgPrimary,borderTop:`1px solid ${ie.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>Lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ie.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=ie.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{Ga([ct.taskId]),Lt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),u?.enabled&&jsxRuntime.jsx(Jo,{tasks:we,theme:ie,config:u,onTasksUpdate:O,onTaskUpdate:Wa,onTaskCreate:N=>{O(U=>[...U,N]);},onTaskDelete:N=>{Ga([N]);},onDependencyCreate:(N,U)=>{let Y=oe.findTaskById(we,N);Y&&Ti(Y,U);},onDependencyDelete:Di})]})})})});var yd=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
279
279
 
@@ -320,7 +320,7 @@ If ambiguous, ask for clarification in the message field.`;function vd(e){return
320
320
  ${xd(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",d=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${d}`}).join(`
321
321
  `)}
322
322
 
323
- Today's date: ${new Date().toISOString().split("T")[0]}`}function xd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function $a(e,t){let a=xd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(n=>m.includes(n))})}function Is(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=m[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let i=p[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Ls(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Fs(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function kd(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function wd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),p=r[2].trim(),l=$a(t,n),i=Is(p);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),p=o[2].trim(),l=$a(t,n),i=Ls(p);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),p=s[2].trim(),l=$a(t,n),i=Fs(p);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),p=d[2].trim(),l=$a(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),p=c[2].trim(),l=$a(t,n),i=$a(t,p);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),p=$a(t,n);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Cd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Qg(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function ef(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(i=>i.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Qo(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),n=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:Qg(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Td(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:ef(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Dd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qo(r,e,t))}var Bs={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Rs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},en={en:Bs,es:Rs};function Os(e){return en[e]||en.en}function tn(e,t){let a=Os(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Pd(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Pd(r.subtasks,t+1));return a}function pf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function Md({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:m="en",customTranslations:n,showSearch:p=true,showHierarchy:l=true}=t,i=tn(m,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[C,D]=react.useState("");react.useMemo(()=>{let T=new Set;function $(G){for(let z of G)z.subtasks?.length&&(T.add(z.id),$(z.subtasks));}$(e),f(T);},[e]);let h=react.useCallback(T=>{f($=>{let G=new Set($);return G.has(T)?G.delete(T):G.add(T),G}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{y===T?g($=>$==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),w=react.useMemo(()=>{let T=Pd(e);if(C.trim()){let G=C.toLowerCase();T=T.filter(z=>z.name.toLowerCase().includes(G));}let $=[];for(let G of T){let z=G.level===0;G.level>0&&(z=true),(z||C.trim())&&$.push(G);}return C.trim()&&$.sort((G,z)=>{let E,X;switch(y){case "name":E=G.name.toLowerCase(),X=z.name.toLowerCase();break;case "startDate":E=G.startDate?.getTime()||0,X=z.startDate?.getTime()||0;break;case "endDate":E=G.endDate?.getTime()||0,X=z.endDate?.getTime()||0;break;case "progress":E=G.progress||0,X=z.progress||0;break;case "status":E=G.status||"todo",X=z.status||"todo";break;default:return 0}return E<X?b==="asc"?-1:1:E>X?b==="asc"?1:-1:0}),$},[e,C,y,b]),L=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:k("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:C,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:k("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:k("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((T,$)=>{let G=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:k("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:z=>{z.stopPropagation(),h(T.id);},className:k("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:G?jsxRuntime.jsx(lucideReact.ChevronDown,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:z=>{z.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:k("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:k("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(T.startDate)]}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:k("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),w.length===0&&C&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:k("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:k(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var zs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},$s={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Us={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},rn={dark:zs,light:$s,neutral:Us};function Ad(e){return rn[e]||rn.dark}var Ws={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},on={en:Ws,es:Gs};function io(e){return on[e]||on.en}function nn(e,t){let a=io(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Id(e){let t=io(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Ld(e,t=0,a=true){let r=io(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Df(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function Ks(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Rd({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function zd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:m="dark",locale:n="en",customTranslations:p}=t,l=nn(n,p),i=m==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,C]=react.useState(null),[D,h]=react.useState(new Date),[A,w]=react.useState({}),L=4,T=3,[$,G]=react.useState(false),[z,E]=react.useState(false),[X,fe]=react.useState(false),[Ce,Le]=react.useState(null),[Pe,ce]=react.useState(""),[S,F]=react.useState(void 0),[M,V]=react.useState(null),[P,W]=react.useState(false),[de,ae]=react.useState(false),[Ee,le]=react.useState(null),[Ve,he]=react.useState(false),[at,Et]=react.useState(new Date),gt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),ft=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),rt=react.useCallback(()=>{v(new Date);},[]),ot=react.useMemo(()=>{let O=u.getFullYear(),De=u.getMonth(),Ue=new Date(O,De,1),$e=new Date(O,De+1,0),bt=Ue.getDay(),J=$e.getDate(),Q=Df(e),xe=new Date;xe.setHours(0,0,0,0);let ge=[],ee=bt,Te=new Date(O,De,0).getDate();for(let ke=ee-1;ke>=0;ke--){let R=new Date(O,De-1,Te-ke);ge.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(H=>Ks(R,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}for(let ke=1;ke<=J;ke++){let R=new Date(O,De,ke),H=R.getTime()===xe.getTime();ge.push({date:R,isCurrentMonth:true,isToday:H,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(q=>Ks(R,q)).map(q=>({id:q.id,title:q.name,start:q.startDate,end:q.endDate,task:q}))});}let be=42-ge.length;for(let ke=1;ke<=be;ke++){let R=new Date(O,De+1,ke);ge.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(H=>Ks(R,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}return ge},[u,e]),la=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wt=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ct=react.useCallback((O,De)=>{if(!f)return;let Ue={...f,[O]:De};y(Ue),a.onTaskUpdate?.(Ue);},[f,a]),Lt=react.useCallback(O=>{if(!f)return;let De=f.progress||0;O==="completed"?De=100:O==="todo"&&(De=0);let Ue={...f,status:O,progress:De};y(Ue),a.onTaskUpdate?.(Ue),G(false);},[f,a]),jt=react.useCallback((O,De)=>{if(!f)return;let Ue={...f,startDate:O,endDate:De};y(Ue),a.onTaskUpdate?.(Ue);},[f,a]),we=react.useCallback(()=>{G(false),E(false),C(null);},[]);return o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:k("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:wt}),jsxRuntime.jsx("button",{onClick:rt,className:k("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:gt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ft,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:la.map(O=>jsxRuntime.jsx("div",{className:k("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:k("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-white/5":"bg-gray-200"),children:ot.map((O,De)=>{let Ue=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:k("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?Ue?"bg-[#1A1D21]":O.isCurrentMonth?"bg-[#0F1117]":"bg-[#0A0C10]":Ue?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let $e=A[De]||L,bt=O.events.slice(0,$e),J=O.events.length-$e;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[bt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:k("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Rd,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),w(xe=>({...xe,[De]:$e+T}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),$e>L&&O.events.length>L&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),w(xe=>({...xe,[De]:L}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let $e=De>=28,bt=De%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),Ce===De?Le(null):(Le(De),ce(""),F(void 0),V(null),le(null),W(false),ae(false),he(false),Et(O.date));},className:k("w-5 h-5 rounded flex items-center justify-center transition-all",Ce===De?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:k("w-3.5 h-3.5 transition-transform",Ce===De&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce===De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),ce(""),F(void 0),V(null),le(null),W(false),ae(false),he(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:$e?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:$e?-5:5,scale:.95},transition:{duration:.12},className:k("absolute w-[320px] rounded-lg shadow-2xl z-50",$e?"bottom-full mb-1":"top-full mt-1",bt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),W(false),ae(false),he(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Pe,onChange:J=>ce(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:k("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Pe.trim()){let Q=t.availableUsers?.find(ge=>ge.id===M),xe=Ee||O.date;a.onTaskCreate?.({name:Pe.trim(),startDate:xe,endDate:xe,priority:S,assignees:Q?[Q]:void 0}),ce(""),F(void 0),V(null),le(null),Le(null);}J.key==="Escape"&&(Le(null),ce(""),F(void 0),V(null),le(null));}})}),jsxRuntime.jsxs("div",{className:k("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),W(!P),ae(false);},className:k("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{F(J.id),W(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),he(!Ve),W(false),ae(false),Et(Ee||O.date);},className:k("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ee?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Ee||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:k("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let xe=new Date(J);xe.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let ge=new Date(J);ge.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let ee=new Date(J);ee.setDate(J.getDate()+14);let Te=new Date(J);return Te.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ke,R)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{le(ke.date),he(false);},children:[jsxRuntime.jsx("span",{children:ke.label}),jsxRuntime.jsx("span",{className:k("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:ke.display})]},R))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:k("text-xs font-medium",i?"text-white":"text-gray-900"),children:at.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Et(new Date),className:k("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Et(new Date(at.getFullYear(),at.getMonth()-1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Et(new Date(at.getFullYear(),at.getMonth()+1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:k("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=at.getFullYear(),Q=at.getMonth(),xe=new Date(J,Q,1).getDay(),ge=new Date(J,Q+1,0).getDate(),ee=new Date(J,Q,0).getDate(),Te=new Date,be=[];for(let R=xe-1;R>=0;R--)be.push({dayNum:ee-R,isCurrentMonth:false,date:new Date(J,Q-1,ee-R)});for(let R=1;R<=ge;R++)be.push({dayNum:R,isCurrentMonth:true,date:new Date(J,Q,R)});let ke=42-be.length;for(let R=1;R<=ke;R++)be.push({dayNum:R,isCurrentMonth:false,date:new Date(J,Q+1,R)});return be.map((R,H)=>{let q=R.date.toDateString()===Te.toDateString(),se=(Ee||O.date).toDateString()===R.date.toDateString();return jsxRuntime.jsx("button",{className:k("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!R.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),R.isCurrentMonth&&(i?"text-white":"text-gray-900"),q&&"ring-1 ring-[#3B82F6]",se&&"bg-[#7C3AED] text-white",!se&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{le(R.date),he(false);},children:R.dayNum},H)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),ae(!de),W(false);},className:k("p-1 rounded transition-colors",M?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:M?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===M)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===M)?.initials||t.availableUsers?.find(J=>J.id===M)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{V(null),ae(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!M&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:k("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{V(J.id),ae(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",M===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:k("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Pe.trim()){let J=t.availableUsers?.find(xe=>xe.id===M),Q=Ee||O.date;a.onTaskCreate?.({name:Pe.trim(),startDate:Q,endDate:Q,priority:S,assignees:J?[J]:void 0}),ce(""),F(void 0),V(null),le(null),Le(null);}},disabled:!Pe.trim(),className:k("px-2.5 py-1 rounded text-xs font-medium transition-colors",Pe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:k("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},De)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:k("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:k("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:k("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:k("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:k("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>y(null),className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let O=f.progress===100?0:100,Ue={...f,progress:O,status:O===100?"completed":"todo"};y(Ue),a.onTaskUpdate?.(Ue);},className:k("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:k("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{we(),G(!$);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Lt(O.id),className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,De)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},De)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{C(g?null:"start"),h(f.startDate||new Date);},className:k("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:k("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:k("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:k("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,De=new Date(O);De.setDate(O.getDate()+1);let Ue=new Date(O);Ue.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let $e=new Date(O);$e.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let bt=new Date(O);bt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let J=new Date(O);J.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ue,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$e,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:bt,display:bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ge,ee)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Te=f.endDate&&ge.date>f.endDate?ge.date:f.endDate;jt(ge.date,Te),C("end");}else {let Te=f.startDate&&ge.date<f.startDate?ge.date:f.startDate;jt(Te,ge.date),C(null);}},children:[jsxRuntime.jsx("span",{children:ge.label}),jsxRuntime.jsx("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:ge.display})]},ee))})(),jsxRuntime.jsx("div",{className:k("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{jt(void 0,void 0),C(null);},className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:k("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>h(new Date),className:k("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:k("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=D.getFullYear(),De=D.getMonth(),Ue=new Date(O,De,1).getDay(),$e=new Date(O,De+1,0).getDate(),bt=new Date(O,De,0).getDate(),J=new Date,Q=[];for(let ge=Ue-1;ge>=0;ge--)Q.push({day:bt-ge,isCurrentMonth:false,date:new Date(O,De-1,bt-ge)});for(let ge=1;ge<=$e;ge++)Q.push({day:ge,isCurrentMonth:true,date:new Date(O,De,ge)});let xe=42-Q.length;for(let ge=1;ge<=xe;ge++)Q.push({day:ge,isCurrentMonth:false,date:new Date(O,De+1,ge)});return Q.map((ge,ee)=>{let Te=ge.date.toDateString()===J.toDateString(),be=f.startDate?.toDateString()===ge.date.toDateString(),ke=f.endDate?.toDateString()===ge.date.toDateString(),R=be||ke,H=f.startDate&&f.endDate&&ge.date>=f.startDate&&ge.date<=f.endDate;return jsxRuntime.jsx("button",{className:k("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ge.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ge.isCurrentMonth&&(i?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#3B82F6]",be&&"bg-[#3B82F6] text-white",ke&&!be&&"bg-[#7C3AED] text-white",H&&!R&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let q=new Date(ge.date);if(g==="start"){let se=f.endDate&&q>f.endDate?q:f.endDate;jt(q,se),C("end");}else {let se=f.startDate&&q<f.startDate?q:f.startDate;jt(se,q),C(null);}},children:ge.day},ee)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{we(),E(!z);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>{ct("priority",O.id),E(false);},className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let De=parseInt(O.target.value),Ue=f.status;De===100?Ue="completed":De>0?Ue="in-progress":Ue="todo";let $e={...f,progress:De,status:Ue};y($e),a.onTaskUpdate?.($e);},onBlur:()=>fe(false),className:k("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>fe(true),className:k("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:k("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:k("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:k("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:k("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:k("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:k("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:k("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:k("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:k("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:k("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:k("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y(O.task);},className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Rd,{task:O.task}),jsxRuntime.jsx("span",{className:k("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Ys={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},qs={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},Xs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},cn={dark:Ys,light:qs,neutral:Xs};function $d(e){return cn[e]||cn.dark}function Sf({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[m,n]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(x=>x.assignedUserIds||[])).size,f=p.map(x=>x.priority).filter(Boolean),y=new Set(p.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:k("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:k("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var Wd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function lo(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function co(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Gd(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Hd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let m=react.useMemo(()=>({...Wd,...d}),[d]),[n,p]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let C=g.timestamp.toISOString().split("T")[0],D=b.get(C);D?D.push(g):b.set(C,[g]);}),Array.from(b.entries()).sort((g,C)=>C[0].localeCompare(g[0])).map(([g,C])=>({date:new Date(g),events:C.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(C=>{b.add(C.userId),g.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{p(g=>{let C=new Set(g);return C.has(b)?C.delete(b):C.add(b),C});},y=b=>{let C=new Date().getTime()-b.getTime(),D=Math.floor(C/6e4),h=Math.floor(C/36e5),A=Math.floor(C/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:A<7?`${A}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:k("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:k("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[co(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,C)=>{let D=n.has(g.id),h=s===g.id,A=Gd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:k("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:co(g.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:lo(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),g.metadata&&Object.keys(g.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(g.metadata).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},w))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Vd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:m,className:n}){let p=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:k("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:k("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&co(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&lo(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:k("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:lo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:k("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:k("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Js(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Zs(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function jd(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Kd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Lf(e,t,a,r,o,s=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;d.forEach(p=>{let l=a/2,i=r/2;p.vx+=(l-p.x)*o.centerForce*n,p.vy+=(i-p.y)*o.centerForce*n,d.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,f=p.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);p.vx+=v/y*x,p.vy+=f/y*x;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),i=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Yd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:m}){let n=react.useRef(null),[p,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[C,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let z=Lf(e,t,a.width,a.height,a,150);l(z);},[e,t,a]);let h=react.useCallback((z,E)=>{a.enableDragging&&(E.stopPropagation(),u(z));},[a.enableDragging]),A=react.useCallback(z=>{if(!i||!n.current)return;let X=n.current.getBoundingClientRect(),fe=(z.clientX-X.left-C.x)/b,Ce=(z.clientY-X.top-C.y)/b;l(Le=>Le.map(Pe=>Pe.id===i?{...Pe,x:fe,y:Ce,fx:fe,fy:Ce}:Pe));},[i,b,C]),w=react.useCallback(()=>{u(null);},[]),L=react.useCallback((z,E)=>{E.stopPropagation(),c?.({type:"node-click",node:z,position:{x:E.clientX,y:E.clientY}});},[c]),T=react.useCallback((z,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:z,position:{x:E.clientX,y:E.clientY}});},[c]),$=react.useCallback(z=>{let E=p.find(X=>X.id===z);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),G=react.useCallback(z=>{if(z.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return z.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=z.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return z.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:k("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:k("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(z=>Math.min(z+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(z=>Math.max(z-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(z=>z.type))).map(z=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Js(z)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[jd(z)," ",Zs(z)]})]},z))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(z=>{let E=$(typeof z.source=="string"?z.source:z.source.id),X=$(typeof z.target=="string"?z.target:z.target.id),fe=Kd(z.type),Ce=y===z.id,Le=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-edge",Ce&&"hovered",Le&&"critical"),onMouseEnter:()=>x(z.id),onMouseLeave:()=>x(null),onClick:Pe=>T(z,Pe),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:X.x,y2:X.y,stroke:Js(z.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ce?1:.6,markerEnd:fe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ce&&jsxRuntime.jsx("text",{x:(E.x+X.x)/2,y:(E.y+X.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zs(z.type)})]},z.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(z=>{let E=v===z.id,X=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-node",E&&"hovered",X&&"critical"),transform:`translate(${z.x}, ${z.y})`,onMouseDown:fe=>h(z.id,fe),onMouseEnter:()=>f(z.id),onMouseLeave:()=>f(null),onClick:fe=>L(z,fe),children:[jsxRuntime.jsx("circle",{r:X?a.nodeSize*1.2:a.nodeSize,fill:G(z),stroke:X?"#fbbf24":"#ffffff",strokeWidth:X?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:z.card.title.length>20?z.card.title.substring(0,20)+"...":z.card.title})]},z.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Jd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,m]=react.useState(false),[n,p]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),p(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){m(true),p(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:b=>d(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qs={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Bf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Rf={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function Of(e,t,a){let r=Qs[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function mo(e){return `$${e.toFixed(4)}`}var ei=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Of(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),m=a.reduce((l,i)=>l+i.duration,0),n={},p={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:p,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},fr=new ei;function ec({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(fr.getStats()),[s,d]=react.useState(fr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(fr.getStats()),d(fr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=fr.getRecentOperations(5);return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:mo(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,n])=>{let p=r.costsByFeature[m]||0,l=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function rc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[m,n]=react.useState(""),[p,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),C=react.useRef(null),D=i||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let T=$=>{$.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},A=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{y&&(a(y),h());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((T,$)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:d,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>l(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,$)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:A,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function un({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&xo(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let C=g.cards.find(T=>T.id===y);if(!C)return g;let D=C.columnId,h={...C,columnId:x,position:b},A=g.cards.map(T=>T.id===y?h:T),w=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter($=>$!==y)};if(T.id===x){let $=A.filter(G=>G.columnId===x).sort((G,z)=>G.position-z.position);return {...T,cardIds:$.map(G=>G.id)}}return T}),L={...g,cards:A,columns:w};return o(L),L});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),C={...b,cards:g};return o(C),C});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},C=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:C};return o(D),D});},[o]),m=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),C=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(A=>A!==y)}:h),D={...x,cards:g,columns:C};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},C={...b,columns:[...b.columns,g]};return o(C),C});},[o]),p=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),C={...b,columns:g};return o(C),C});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),C={...x,cards:b,columns:g};return o(C),C});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:n,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:m,deleteColumn:l,clearBoard:v}}}function nc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=un({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,n,p={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...p});},addColumn:(m,n)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:n??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var po={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ic={by:"none",order:"asc"};function lc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...po,...e}),[s,d]=react.useState({...ic,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),m=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(po),d(ic);},[]),p=react.useCallback(()=>{a&&o({...po,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...po,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...po,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),C=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${C}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let A=h.endDate||h.dueDate;if(!A)return false;let w;if(typeof A=="string")w=A.split("T")[0]||A;else {let L=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),$=String(A.getUTCDate()).padStart(2,"0");w=`${L}-${T}-${$}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let L=new Date(D+"T00:00:00"),T=new Date(w+"T00:00:00"),$=new Date(L);return $.setDate($.getDate()+7),T>=L&&T<=$;case "custom":if(r.dateRange){let G=typeof A=="string"?new Date(A):A;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let C=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=C-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=h[x.priority||"LOW"],w=h[b.priority||"LOW"];g=A-w;break;case "dueDate":let L=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!L)return 1;if(!T)return -1;let $=typeof L=="string"?new Date(L).getTime():L.getTime(),G=typeof T=="string"?new Date(T).getTime():T.getTime();g=$-G;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let z=x.estimatedTime||0,E=b.estimatedTime||0;g=z-E;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:n,filterMyTasks:p,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var cc,mc;if(typeof window<"u")try{let e=ho("ai");cc=e.generateObject,mc=e.generateText;}catch{}function pc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(cc&&mc&&e.apiKey),d=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function ai(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function uc(e){let{cards:t}=e,[a,r]=ai(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(w=>w.columnId===f.columnId).sort((w,L)=>w.position-L.position),b=x.findIndex(w=>w.id===a.lastSelectedCardId),g=x.findIndex(w=>w.id===l),[C,D]=b<g?[b,g]:[g,b],h=x.slice(C,D+1).map(w=>w.id),A=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:A,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),p=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:n,getSelectedCards:p}}var gc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...gc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,C]);},[o.minCardsPerStack,s]),m=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),p=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(C=>C!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(D=>{D.priority&&(C.has(D.priority)||C.set(D.priority,[]),C.get(D.priority).push(D));}),C.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let A=(await r.findSimilar(D,y)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let w=[D.id,...A.map(T=>T.card.id)],L=A.reduce((T,$)=>T+$.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:L});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:n,addToStack:p,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var bc=react.createContext(null);function hc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:n}=ho("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=ho("@libxai/core");d.set(m.id,new n(m));});let c=null;if(t?.board){let{Board:m}=ho("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(bc.Provider,{value:{store:o},children:e})}function gn(){let e=react.useContext(bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function go(){let e=gn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,C)=>{e.moveCard(b,g,C);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:n,deleteColumn:p,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function vc(e){let{cards:t}=go();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function xc(e="position",t="asc"){let{cards:a}=go();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=m-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var fn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ei.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},eb=new fn;function wc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:m}){let n=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=p.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=m?m(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Cc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Dc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:n=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=m?m(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function Nc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function Sc(e,t=10){return e>t}var si={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ii={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},li={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},di={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ci={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},mi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ui={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},gi={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},fi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bi={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},hi={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},bn={spacing:si,borderRadius:ii,fontSize:li,fontWeight:di,lineHeight:ci,zIndex:mi,duration:pi,easing:ui,shadows:gi,opacity:fi,kanban:bi,gantt:hi};function Ec(e,t,a){return e[t]??a}function yi(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?yi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function rb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vi(e="asakaa"){let t=yi(bn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=rb(o);a.push(` ${s}: ${d};`);}return `:root {
323
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function xd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function $a(e,t){let a=xd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let m=c.name.toLowerCase();return d.every(n=>m.includes(n))})}function Is(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=m[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let i=p[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Ls(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Fs(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function kd(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function wd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),p=r[2].trim(),l=$a(t,n),i=Is(p);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),p=o[2].trim(),l=$a(t,n),i=Ls(p);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),p=s[2].trim(),l=$a(t,n),i=Fs(p);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),p=d[2].trim(),l=$a(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:p},message:`Renamed "${l.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),p=c[2].trim(),l=$a(t,n),i=$a(t,p);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),p=$a(t,n);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Cd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function ef(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function tf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qo(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let l=a.find(i=>i.id===p);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(p=>p!==null),o=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Qo(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let d=p=>{if(p)return typeof p=="string"?new Date(p):p},c=d(e.startDate),m=d(e.endDate),n=e.metadata?.isMilestone===true||c&&m&&Math.abs(m.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:m,progress:e.progress||0,status:ef(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Td(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:tf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Dd(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qo(r,e,t))}var Bs={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Rs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},en={en:Bs,es:Rs};function Os(e){return en[e]||en.en}function tn(e,t){let a=Os(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Pd(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Pd(r.subtasks,t+1));return a}function uf({status:e,progress:t}){return t===100||e==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-5 h-5 text-gray-400"})}function Md({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:m="en",customTranslations:n,showSearch:p=true,showHierarchy:l=true}=t,i=tn(m,n),u=c==="dark",[v,f]=react.useState(new Set),[y,x]=react.useState("startDate"),[b,g]=react.useState("asc"),[C,D]=react.useState("");react.useMemo(()=>{let T=new Set;function $(G){for(let z of G)z.subtasks?.length&&(T.add(z.id),$(z.subtasks));}$(e),f(T);},[e]);let h=react.useCallback(T=>{f($=>{let G=new Set($);return G.has(T)?G.delete(T):G.add(T),G}),a.onTaskToggleExpand?.(T);},[a]),A=react.useCallback(T=>{y===T?g($=>$==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),w=react.useMemo(()=>{let T=Pd(e);if(C.trim()){let G=C.toLowerCase();T=T.filter(z=>z.name.toLowerCase().includes(G));}let $=[];for(let G of T){let z=G.level===0;G.level>0&&(z=true),(z||C.trim())&&$.push(G);}return C.trim()&&$.sort((G,z)=>{let E,X;switch(y){case "name":E=G.name.toLowerCase(),X=z.name.toLowerCase();break;case "startDate":E=G.startDate?.getTime()||0,X=z.startDate?.getTime()||0;break;case "endDate":E=G.endDate?.getTime()||0,X=z.endDate?.getTime()||0;break;case "progress":E=G.progress||0,X=z.progress||0;break;case "status":E=G.status||"todo",X=z.status||"todo";break;default:return 0}return E<X?b==="asc"?-1:1:E>X?b==="asc"?1:-1:0}),$},[e,C,y,b]),L=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsxRuntime.jsx("p",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[p&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:k("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:C,onChange:T=>D(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:k("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxRuntime.jsxs("div",{className:k("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[w.length," ",i.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:k("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsxRuntime.jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxRuntime.jsxs("button",{onClick:()=>A("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxRuntime.jsxs("button",{onClick:()=>A("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-auto",children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:w.map((T,$)=>{let G=v.has(T.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:k("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsxRuntime.jsx("button",{onClick:z=>{z.stopPropagation(),h(T.id);},className:k("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:G?jsxRuntime.jsx(lucideReact.ChevronDown,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:z=>{z.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(uf,{status:T.status,progress:T.progress})}),jsxRuntime.jsx("span",{className:k("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:k("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(T.startDate)]}),jsxRuntime.jsxs("div",{className:k("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(T.endDate)]}),jsxRuntime.jsx("div",{className:"col-span-1 flex items-center",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:k("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),w.length===0&&C&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:k("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:k(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var zs={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},$s={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Us={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},rn={dark:zs,light:$s,neutral:Us};function Ad(e){return rn[e]||rn.dark}var Ws={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},on={en:Ws,es:Gs};function io(e){return on[e]||on.en}function nn(e,t){let a=io(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Id(e){let t=io(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Ld(e,t=0,a=true){let r=io(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Nf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function Ks(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Rd({task:e}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function zd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:m="dark",locale:n="en",customTranslations:p}=t,l=nn(n,p),i=m==="dark",[u,v]=react.useState(r||new Date),[f,y]=react.useState(null),[x,b]=react.useState(null),[g,C]=react.useState(null),[D,h]=react.useState(new Date),[A,w]=react.useState({}),L=4,T=3,[$,G]=react.useState(false),[z,E]=react.useState(false),[X,fe]=react.useState(false),[Ce,Le]=react.useState(null),[Pe,ce]=react.useState(""),[S,F]=react.useState(void 0),[M,V]=react.useState(null),[P,W]=react.useState(false),[de,ae]=react.useState(false),[Ee,le]=react.useState(null),[Ve,he]=react.useState(false),[at,Et]=react.useState(new Date),gt=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),ft=react.useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),rt=react.useCallback(()=>{v(new Date);},[]),ot=react.useMemo(()=>{let O=u.getFullYear(),De=u.getMonth(),Ue=new Date(O,De,1),$e=new Date(O,De+1,0),bt=Ue.getDay(),J=$e.getDate(),Q=Nf(e),xe=new Date;xe.setHours(0,0,0,0);let ge=[],ee=bt,Te=new Date(O,De,0).getDate();for(let ke=ee-1;ke>=0;ke--){let R=new Date(O,De-1,Te-ke);ge.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(H=>Ks(R,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}for(let ke=1;ke<=J;ke++){let R=new Date(O,De,ke),H=R.getTime()===xe.getTime();ge.push({date:R,isCurrentMonth:true,isToday:H,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(q=>Ks(R,q)).map(q=>({id:q.id,title:q.name,start:q.startDate,end:q.endDate,task:q}))});}let be=42-ge.length;for(let ke=1;ke<=be;ke++){let R=new Date(O,De+1,ke);ge.push({date:R,isCurrentMonth:false,isToday:false,isWeekend:R.getDay()===0||R.getDay()===6,events:Q.filter(H=>Ks(R,H)).map(H=>({id:H.id,title:H.name,start:H.startDate,end:H.endDate,task:H}))});}return ge},[u,e]),la=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wt=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ct=react.useCallback((O,De)=>{if(!f)return;let Ue={...f,[O]:De};y(Ue),a.onTaskUpdate?.(Ue);},[f,a]),Lt=react.useCallback(O=>{if(!f)return;let De=f.progress||0;O==="completed"?De=100:O==="todo"&&(De=0);let Ue={...f,status:O,progress:De};y(Ue),a.onTaskUpdate?.(Ue),G(false);},[f,a]),jt=react.useCallback((O,De)=>{if(!f)return;let Ue={...f,startDate:O,endDate:De};y(Ue),a.onTaskUpdate?.(Ue);},[f,a]),we=react.useCallback(()=>{G(false),E(false),C(null);},[]);return o?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:k("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:k("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsxRuntime.jsx("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:k("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsxRuntime.jsx("div",{className:k("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx("h2",{className:k("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:wt}),jsxRuntime.jsx("button",{onClick:rt,className:k("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:gt,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:ft,className:k("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:k("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:la.map(O=>jsxRuntime.jsx("div",{className:k("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsxRuntime.jsx("div",{className:k("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:ot.map((O,De)=>{let Ue=O.date.getDay()===0||O.date.getDay()===6;return jsxRuntime.jsxs("div",{className:k("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?Ue?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ue?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let $e=A[De]||L,bt=O.events.slice(0,$e),J=O.events.length-$e;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[bt.map(Q=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:k("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Rd,{task:Q.task}),jsxRuntime.jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxRuntime.jsxs("button",{onClick:Q=>{Q.stopPropagation(),w(xe=>({...xe,[De]:$e+T}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),$e>L&&O.events.length>L&&jsxRuntime.jsx("button",{onClick:Q=>{Q.stopPropagation(),w(xe=>({...xe,[De]:L}));},className:k("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let $e=De>=28,bt=De%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),Ce===De?Le(null):(Le(De),ce(""),F(void 0),V(null),le(null),W(false),ae(false),he(false),Et(O.date));},className:k("w-5 h-5 rounded flex items-center justify-center transition-all",Ce===De?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:k("w-3.5 h-3.5 transition-transform",Ce===De&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce===De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Le(null),ce(""),F(void 0),V(null),le(null),W(false),ae(false),he(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:$e?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:$e?-5:5,scale:.95},transition:{duration:.12},className:k("absolute w-[320px] rounded-lg shadow-2xl z-50",$e?"bottom-full mb-1":"top-full mt-1",bt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),W(false),ae(false),he(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:Pe,onChange:J=>ce(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:k("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&Pe.trim()){let Q=t.availableUsers?.find(ge=>ge.id===M),xe=Ee||O.date;a.onTaskCreate?.({name:Pe.trim(),startDate:xe,endDate:xe,priority:S,assignees:Q?[Q]:void 0}),ce(""),F(void 0),V(null),le(null),Le(null);}J.key==="Escape"&&(Le(null),ce(""),F(void 0),V(null),le(null));}})}),jsxRuntime.jsxs("div",{className:k("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),W(!P),ae(false);},className:k("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxRuntime.jsxs("button",{onClick:()=>{F(J.id),W(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",J.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:J=>{J.stopPropagation(),he(!Ve),W(false),ae(false),Et(Ee||O.date);},className:k("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ee?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:"w-3 h-3"}),(Ee||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ve&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsx("div",{className:k("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let xe=new Date(J);xe.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let ge=new Date(J);ge.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let ee=new Date(J);ee.setDate(J.getDate()+14);let Te=new Date(J);return Te.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:xe,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ee,display:ee.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Te,display:Te.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ke,R)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{le(ke.date),he(false);},children:[jsxRuntime.jsx("span",{children:ke.label}),jsxRuntime.jsx("span",{className:k("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:ke.display})]},R))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:k("text-xs font-medium",i?"text-white":"text-gray-900"),children:at.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Et(new Date),className:k("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Et(new Date(at.getFullYear(),at.getMonth()-1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Et(new Date(at.getFullYear(),at.getMonth()+1)),className:k("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsxRuntime.jsx("div",{className:k("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=at.getFullYear(),Q=at.getMonth(),xe=new Date(J,Q,1).getDay(),ge=new Date(J,Q+1,0).getDate(),ee=new Date(J,Q,0).getDate(),Te=new Date,be=[];for(let R=xe-1;R>=0;R--)be.push({dayNum:ee-R,isCurrentMonth:false,date:new Date(J,Q-1,ee-R)});for(let R=1;R<=ge;R++)be.push({dayNum:R,isCurrentMonth:true,date:new Date(J,Q,R)});let ke=42-be.length;for(let R=1;R<=ke;R++)be.push({dayNum:R,isCurrentMonth:false,date:new Date(J,Q+1,R)});return be.map((R,H)=>{let q=R.date.toDateString()===Te.toDateString(),se=(Ee||O.date).toDateString()===R.date.toDateString();return jsxRuntime.jsx("button",{className:k("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!R.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),R.isCurrentMonth&&(i?"text-white":"text-gray-900"),q&&"ring-1 ring-[#3B82F6]",se&&"bg-[#7C3AED] text-white",!se&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{le(R.date),he(false);},children:R.dayNum},H)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:J=>{J.stopPropagation(),ae(!de),W(false);},className:k("p-1 rounded transition-colors",M?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:M?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===M)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===M)?.initials||t.availableUsers?.find(J=>J.id===M)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:de&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{V(null),ae(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!M&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:k("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxRuntime.jsxs("button",{onClick:()=>{V(J.id),ae(false);},className:k("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",M===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:k("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(Pe.trim()){let J=t.availableUsers?.find(xe=>xe.id===M),Q=Ee||O.date;a.onTaskCreate?.({name:Pe.trim(),startDate:Q,endDate:Q,priority:S,assignees:J?[J]:void 0}),ce(""),F(void 0),V(null),le(null),Le(null);}},disabled:!Pe.trim(),className:k("px-2.5 py-1 rounded text-xs font-medium transition-colors",Pe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:k("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},De)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:k("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:k("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:k("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:k("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:k("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Maximize2,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"w-5 h-5"})}),jsxRuntime.jsx("button",{onClick:()=>y(null),className:k("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>{let O=f.progress===100?0:100,Ue={...f,progress:O,status:O===100?"completed":"todo"};y(Ue),a.onTaskUpdate?.(Ue);},className:k("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:k("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxRuntime.jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{we(),G(!$);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>Lt(O.id),className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.User,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,De)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},De)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{C(g?null:"start"),h(f.startDate||new Date);},className:k("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:k("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>C(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:k("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:k("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,De=new Date(O);De.setDate(O.getDate()+1);let Ue=new Date(O);Ue.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let $e=new Date(O);$e.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let bt=new Date(O);bt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let J=new Date(O);J.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ue,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$e,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:bt,display:bt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ge,ee)=>jsxRuntime.jsxs("button",{className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let Te=f.endDate&&ge.date>f.endDate?ge.date:f.endDate;jt(ge.date,Te),C("end");}else {let Te=f.startDate&&ge.date<f.startDate?ge.date:f.startDate;jt(Te,ge.date),C(null);}},children:[jsxRuntime.jsx("span",{children:ge.label}),jsxRuntime.jsx("span",{className:k("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:ge.display})]},ee))})(),jsxRuntime.jsx("div",{className:k("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{jt(void 0,void 0),C(null);},className:k("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("div",{className:k("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>h(new Date),className:k("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()-1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>h(new Date(D.getFullYear(),D.getMonth()+1)),className:k("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsxRuntime.jsx("div",{className:k("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=D.getFullYear(),De=D.getMonth(),Ue=new Date(O,De,1).getDay(),$e=new Date(O,De+1,0).getDate(),bt=new Date(O,De,0).getDate(),J=new Date,Q=[];for(let ge=Ue-1;ge>=0;ge--)Q.push({day:bt-ge,isCurrentMonth:false,date:new Date(O,De-1,bt-ge)});for(let ge=1;ge<=$e;ge++)Q.push({day:ge,isCurrentMonth:true,date:new Date(O,De,ge)});let xe=42-Q.length;for(let ge=1;ge<=xe;ge++)Q.push({day:ge,isCurrentMonth:false,date:new Date(O,De+1,ge)});return Q.map((ge,ee)=>{let Te=ge.date.toDateString()===J.toDateString(),be=f.startDate?.toDateString()===ge.date.toDateString(),ke=f.endDate?.toDateString()===ge.date.toDateString(),R=be||ke,H=f.startDate&&f.endDate&&ge.date>=f.startDate&&ge.date<=f.endDate;return jsxRuntime.jsx("button",{className:k("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ge.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ge.isCurrentMonth&&(i?"text-white":"text-gray-900"),Te&&"ring-2 ring-[#3B82F6]",be&&"bg-[#3B82F6] text-white",ke&&!be&&"bg-[#7C3AED] text-white",H&&!R&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let q=new Date(ge.date);if(g==="start"){let se=f.endDate&&q>f.endDate?q:f.endDate;jt(q,se),C("end");}else {let se=f.startDate&&q<f.startDate?q:f.startDate;jt(se,q),C(null);}},children:ge.day},ee)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{we(),E(!z);},className:k("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:k("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxRuntime.jsxs("button",{onClick:()=>{ct("priority",O.id),E(false);},className:k("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:k("w-2 h-2 rounded-full",O.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[X?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let De=parseInt(O.target.value),Ue=f.status;De===100?Ue="completed":De>0?Ue="in-progress":Ue="todo";let $e={...f,progress:De,status:Ue};y($e),a.onTaskUpdate?.($e);},onBlur:()=>fe(false),className:k("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsxRuntime.jsx("button",{onClick:()=>fe(true),className:k("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:k("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:k("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:k("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:k("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:k("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:k("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:k("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:k("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:k("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsxRuntime.jsx(lucideReact.ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:k("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:k("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:k("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:k("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:k("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:k("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:k("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:k("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:k("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:k("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:k("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:k("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:k("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>b(null),className:k("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxRuntime.jsxs("button",{onClick:()=>{b(null),y(O.task);},className:k("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Rd,{task:O.task}),jsxRuntime.jsx("span",{className:k("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Ys={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},qs={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},Xs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},cn={dark:Ys,light:qs,neutral:Xs};function $d(e){return cn[e]||cn.dark}function Ef({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[m,n]=react.useState(false),p=react.useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=react.useMemo(()=>{let u=p.length,v=new Set(p.flatMap(x=>x.assignedUserIds||[])).size,f=p.map(x=>x.priority).filter(Boolean),y=new Set(p.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[p]),i=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:k("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:k("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:p.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:p.map(u=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsxRuntime.jsx("h4",{children:u.title}),u.description&&jsxRuntime.jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var Wd={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function lo(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function co(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Gd(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Hd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let m=react.useMemo(()=>({...Wd,...d}),[d]),[n,p]=react.useState(new Set),l=react.useRef(null),i=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let C=g.timestamp.toISOString().split("T")[0],D=b.get(C);D?D.push(g):b.set(C,[g]);}),Array.from(b.entries()).sort((g,C)=>C[0].localeCompare(g[0])).map(([g,C])=>({date:new Date(g),events:C.sort((D,h)=>h.timestamp.getTime()-D.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=react.useMemo(()=>{let b=new Set,g=new Set;return e.forEach(C=>{b.add(C.userId),g.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{p(g=>{let C=new Set(g);return C.has(b)?C.delete(b):C.add(b),C});},y=b=>{let C=new Date().getTime()-b.getTime(),D=Math.floor(C/6e4),h=Math.floor(C/36e5),A=Math.floor(C/864e5);return D<1?"just now":D<60?`${D}m ago`:h<24?`${h}h ago`:A<7?`${A}d ago`:b.toLocaleDateString()},x=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:k("history-timeline-empty",c),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:k("history-timeline",m.compact&&"compact",c),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxRuntime.jsxs("option",{value:b,children:[co(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),u.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((g,C)=>{let D=n.has(g.id),h=s===g.id,A=Gd(g.type);return jsxRuntime.jsxs("div",{"data-event-id":g.id,className:k("history-timeline-event",D&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:co(g.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&g.userAvatar&&jsxRuntime.jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:lo(g)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),f(g.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},w)),g.metadata&&Object.keys(g.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(g.metadata).map(([w,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},w))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Vd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:m,className:n}){let p=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:k("history-replay-empty",n),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:k("history-replay",n),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&co(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&lo(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsxRuntime.jsx("div",{className:k("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:lo(u)},u.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:p.map(u=>jsxRuntime.jsxs("button",{className:k("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>m(u),children:[u,"x"]},u))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxRuntime.jsxs("div",{className:k("history-replay-start",n),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Js(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Zs(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function jd(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Kd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ff(e,t,a,r,o,s=100){let d=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;d.forEach(p=>{let l=a/2,i=r/2;p.vx+=(l-p.x)*o.centerForce*n,p.vy+=(i-p.y)*o.centerForce*n,d.forEach(u=>{if(p.id===u.id)return;let v=p.x-u.x,f=p.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);p.vx+=v/y*x,p.vy+=f/y*x;});}),t.forEach(p=>{let l=c.get(typeof p.source=="string"?p.source:p.source.id),i=c.get(typeof p.target=="string"?p.target:p.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,p.x)),p.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return d}function Yd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:m}){let n=react.useRef(null),[p,l]=react.useState([]),[i,u]=react.useState(null),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(1),[C,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let z=Ff(e,t,a.width,a.height,a,150);l(z);},[e,t,a]);let h=react.useCallback((z,E)=>{a.enableDragging&&(E.stopPropagation(),u(z));},[a.enableDragging]),A=react.useCallback(z=>{if(!i||!n.current)return;let X=n.current.getBoundingClientRect(),fe=(z.clientX-X.left-C.x)/b,Ce=(z.clientY-X.top-C.y)/b;l(Le=>Le.map(Pe=>Pe.id===i?{...Pe,x:fe,y:Ce,fx:fe,fy:Ce}:Pe));},[i,b,C]),w=react.useCallback(()=>{u(null);},[]),L=react.useCallback((z,E)=>{E.stopPropagation(),c?.({type:"node-click",node:z,position:{x:E.clientX,y:E.clientY}});},[c]),T=react.useCallback((z,E)=>{E.stopPropagation(),c?.({type:"edge-click",edge:z,position:{x:E.clientX,y:E.clientY}});},[c]),$=react.useCallback(z=>{let E=p.find(X=>X.id===z);return E?{x:E.x,y:E.y}:{x:0,y:0}},[p]),G=react.useCallback(z=>{if(z.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return z.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let E=z.card.priority;return E==="URGENT"?"#ef4444":E==="HIGH"?"#f59e0b":E==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return z.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:k("relationships-graph-empty",m),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:k("relationships-graph",m),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:d.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(z=>Math.min(z+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(z=>Math.max(z-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(z=>z.type))).map(z=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Js(z)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[jd(z)," ",Zs(z)]})]},z))}),jsxRuntime.jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(z=>{let E=$(typeof z.source=="string"?z.source:z.source.id),X=$(typeof z.target=="string"?z.target:z.target.id),fe=Kd(z.type),Ce=y===z.id,Le=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-edge",Ce&&"hovered",Le&&"critical"),onMouseEnter:()=>x(z.id),onMouseLeave:()=>x(null),onClick:Pe=>T(z,Pe),children:[jsxRuntime.jsx("line",{x1:E.x,y1:E.y,x2:X.x,y2:X.y,stroke:Js(z.type),strokeWidth:Le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Ce?1:.6,markerEnd:fe?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Ce&&jsxRuntime.jsx("text",{x:(E.x+X.x)/2,y:(E.y+X.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zs(z.type)})]},z.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:p.map(z=>{let E=v===z.id,X=z.onCriticalPath;return jsxRuntime.jsxs("g",{className:k("relationships-graph-node",E&&"hovered",X&&"critical"),transform:`translate(${z.x}, ${z.y})`,onMouseDown:fe=>h(z.id,fe),onMouseEnter:()=>f(z.id),onMouseLeave:()=>f(null),onClick:fe=>L(z,fe),children:[jsxRuntime.jsx("circle",{r:X?a.nodeSize*1.2:a.nodeSize,fill:G(z),stroke:X?"#fbbf24":"#ffffff",strokeWidth:X?3:2,opacity:E?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:z.card.title.length>20?z.card.title.substring(0,20)+"...":z.card.title})]},z.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Jd({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=react.useState(""),[c,m]=react.useState(false),[n,p]=react.useState(null),[l,i]=react.useState(null),u=react.useRef(null),v=c||o;react.useEffect(()=>{e&&u.current&&u.current.focus();},[e]),react.useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),p(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){m(true),p(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){p(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},x=()=>{l&&(a(l),f());};return e?jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,g)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,g)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:u,value:s,onChange:b=>d(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,g)=>jsxRuntime.jsx("button",{onClick:()=>d(b),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},g))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:v&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:f,disabled:v,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick:x,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:y,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qs={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Rf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Of={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function zf(e,t,a){let r=Qs[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function mo(e){return `$${e.toFixed(4)}`}var ei=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=zf(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),m=a.reduce((l,i)=>l+i.duration,0),n={},p={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,p[l.feature]=(p[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:p,averageDuration:r>0?m/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(p=>p.timestamp>=d).length,m=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:m,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},fr=new ei;function ec({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(fr.getStats()),[s,d]=react.useState(fr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(fr.getStats()),d(fr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let c=fr.getRecentOperations(5);return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:mo(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,n])=>{let p=r.costsByFeature[m]||0,l=r.totalOperations>0?n/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(p)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:c.map(m=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:mo(m.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function rc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=react.useState(""),[m,n]=react.useState(""),[p,l]=react.useState(""),[i,u]=react.useState(false),[v,f]=react.useState(null),[y,x]=react.useState(null),[b,g]=react.useState(null),C=react.useRef(null),D=i||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let T=$=>{$.key==="Escape"&&!D&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,D]);let h=()=>{D||(c(""),n(""),l(""),f(null),x(null),g(null),t());},A=async()=>{if(!(!d.trim()||D)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:p||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},w=()=>{y&&(a(y),h());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Ye,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:T=>T.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[y.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((T,$)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxRuntime.jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:d,onChange:T=>c(T.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:D}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:m,onChange:T=>n(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:p,onChange:T=>l(T.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:D})]})]}),v&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((T,$)=>jsxRuntime.jsx("button",{onClick:()=>c(T),disabled:D,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:T},$))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:D&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:h,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:A,disabled:!d.trim()||D,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function un({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(y=>{t&&xo(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=react.useCallback(async(y,x,b)=>{r(g=>{let C=g.cards.find(T=>T.id===y);if(!C)return g;let D=C.columnId,h={...C,columnId:x,position:b},A=g.cards.map(T=>T.id===y?h:T),w=g.columns.map(T=>{if(T.id===D)return {...T,cardIds:T.cardIds.filter($=>$!==y)};if(T.id===x){let $=A.filter(G=>G.columnId===x).sort((G,z)=>G.position-z.position);return {...T,cardIds:$.map(G=>G.id)}}return T}),L={...g,cards:A,columns:w};return o(L),L});},[o]),d=react.useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(D=>D.id===y?{...D,...x}:D),C={...b,cards:g};return o(C),C});},[o]),c=react.useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},C=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),D={...b,cards:[...b.cards,g],columns:C};return o(D),D});},[o]),m=react.useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),C=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(A=>A!==y)}:h),D={...x,cards:g,columns:C};return o(D),D});},[o]),n=react.useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},C={...b,columns:[...b.columns,g]};return o(C),C});},[o]),p=react.useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(D=>D.id===y?{...D,...x}:D),C={...b,columns:g};return o(C),C});},[o]),l=react.useCallback(async y=>{r(x=>{let b=x.cards.filter(D=>D.columnId!==y),g=x.columns.filter(D=>D.id!==y),C={...x,cards:b,columns:g};return o(C),C});},[o]),i=react.useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=react.useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=react.useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:m,onColumnCreate:n,onColumnUpdate:p,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:m,deleteColumn:l,clearBoard:v}}}function nc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=un({initialBoard:e,onPersist:a}),d=react.useMemo(()=>({addCard:(m,n,p={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...p});},addColumn:(m,n)=>{let p=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:n??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var po={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},ic={by:"none",order:"asc"};function lc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...po,...e}),[s,d]=react.useState({...ic,...t}),c=react.useCallback(f=>{o(y=>({...y,...f}));},[]),m=react.useCallback(f=>{d(y=>({...y,...f}));},[]),n=react.useCallback(()=>{o(po),d(ic);},[]),p=react.useCallback(()=>{a&&o({...po,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...po,dateFilter:"overdue"});},[]),i=react.useCallback(()=>{o({...po,priorities:["HIGH","URGENT"]});},[]),u=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=react.useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),C=String(x.getDate()).padStart(2,"0"),D=`${b}-${g}-${C}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let A=h.endDate||h.dueDate;if(!A)return false;let w;if(typeof A=="string")w=A.split("T")[0]||A;else {let L=A.getUTCFullYear(),T=String(A.getUTCMonth()+1).padStart(2,"0"),$=String(A.getUTCDate()).padStart(2,"0");w=`${L}-${T}-${$}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let L=new Date(D+"T00:00:00"),T=new Date(w+"T00:00:00"),$=new Date(L);return $.setDate($.getDate()+7),T>=L&&T<=$;case "custom":if(r.dateRange){let G=typeof A=="string"?new Date(A):A;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let C=x.createdAt?new Date(x.createdAt).getTime():0,D=b.createdAt?new Date(b.createdAt).getTime():0;g=C-D;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=h[x.priority||"LOW"],w=h[b.priority||"LOW"];g=A-w;break;case "dueDate":let L=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!L)return 1;if(!T)return -1;let $=typeof L=="string"?new Date(L).getTime():L.getTime(),G=typeof T=="string"?new Date(T).getTime():T.getTime();g=$-G;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let z=x.estimatedTime||0,E=b.estimatedTime||0;g=z-E;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:m,resetFilters:n,filterMyTasks:p,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var cc,mc;if(typeof window<"u")try{let e=ho("ai");cc=e.generateObject,mc=e.generateText;}catch{}function pc(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(cc&&mc&&e.apiKey),d=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),p=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function ai(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function uc(e){let{cards:t}=e,[a,r]=ai(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(w=>w.columnId===f.columnId).sort((w,L)=>w.position-L.position),b=x.findIndex(w=>w.id===a.lastSelectedCardId),g=x.findIndex(w=>w.id===l),[C,D]=b<g?[b,g]:[g,b],h=x.slice(C,D+1).map(w=>w.id),A=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:A,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=react.useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),p=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:d,clearSelection:c,selectAll:m,toggleCard:n,getSelectedCards:p}}var gc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function fc(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...gc,...a}),[a]),[s,d]=react.useState([]),c=react.useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(D=>D.columnId===x).length,createdAt:new Date};d(D=>[...D,C]);},[o.minCardsPerStack,s]),m=react.useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=react.useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),p=react.useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=react.useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(C=>C!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=react.useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=react.useCallback(async f=>{let y=t.filter(D=>D.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(D);});}),b.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(D);});}),g.forEach((D,h)=>{D.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:D.map(A=>A.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(y.forEach(D=>{D.priority&&(C.has(D.priority)||C.set(D.priority,[]),C.get(D.priority).push(D));}),C.forEach((D,h)=>{if(D.length>=o.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${A} ${h} Priority`,cardIds:D.map(w=>w.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of y){let A=(await r.findSimilar(D,y)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(A.length>=o.minCardsPerStack-1){let w=[D.id,...A.map(T=>T.card.id)],L=A.reduce((T,$)=>T+$.similarity,0)/A.length;x.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:L});}}return x.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,h)=>h.confidence-D.confidence).slice(0,5)},[t,o,r]),v=react.useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:m,toggleStack:n,addToStack:p,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var bc=react.createContext(null);function hc({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(m=>{let{Column:n}=ho("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=ho("@libxai/core");d.set(m.id,new n(m));});let c=null;if(t?.board){let{Board:m}=ho("@libxai/core");c=new m(t.board);}r.current=new core.BoardStore({board:c,columns:s,cards:d});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(bc.Provider,{value:{store:o},children:e})}function gn(){let e=react.useContext(bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function go(){let e=gn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,d]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=react.useCallback(b=>{e.updateBoard(b);},[e]),m=react.useCallback(b=>{e.addColumn(b);},[e]),n=react.useCallback((b,g)=>{e.updateColumn(b,g);},[e]),p=react.useCallback(b=>{e.deleteColumn(b);},[e]),l=react.useCallback(b=>e.getColumn(b),[e]),i=react.useCallback(b=>{e.addCard(b);},[e]),u=react.useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=react.useCallback(b=>{e.deleteCard(b);},[e]),f=react.useCallback((b,g,C)=>{e.moveCard(b,g,C);},[e]),y=react.useCallback(b=>e.getCard(b),[e]),x=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:m,updateColumn:n,deleteColumn:p,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function vc(e){let{cards:t}=go();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function xc(e="position",t="asc"){let{cards:a}=go();return react.useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=m-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var fn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ei.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},tb=new fn;function wc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:m}){let n=react.useRef(null),p=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=p.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:n,style:i,className:o,children:jsxRuntime.jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=m?m(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsxRuntime.jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Cc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Dc({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:m,horizontal:n=true}){let p=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:p,style:u,className:s,children:jsxRuntime.jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=m?m(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function Nc(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function Sc(e,t=10){return e>t}var si={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ii={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},li={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},di={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ci={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},mi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ui={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},gi={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},fi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bi={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},hi={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},bn={spacing:si,borderRadius:ii,fontSize:li,fontWeight:di,lineHeight:ci,zIndex:mi,duration:pi,easing:ui,shadows:gi,opacity:fi,kanban:bi,gantt:hi};function Ec(e,t,a){return e[t]??a}function yi(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?yi(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ob(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vi(e="asakaa"){let t=yi(bn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=ob(o);a.push(` ${s}: ${d};`);}return `:root {
324
324
  ${a.join(`
325
325
  `)}
326
326
  }`}function fo(e,t="asakaa"){let a=[],r=yi(e);for(let[o,s]of Object.entries(r)){let d=`--${t}-color-${o}`;a.push(` ${d}: ${s};`);}return `:root {
@@ -349,6 +349,6 @@ ${fo(ki,"asakaa").split(`
349
349
  `).slice(1,-1).join(`
350
350
  `)}
351
351
  }
352
- `}var ob=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return 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:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return 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:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Mc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Pr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([d,c])=>{let m=d,n=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(ob,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
353
- Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=ec;exports.AI_FEATURES=Rf;exports.AI_MODELS=Qs;exports.AddCardButton=zn;exports.AddColumnButton=On;exports.AttachmentUploader=Zr;exports.BoardProvider=hc;exports.BulkOperationsToolbar=Mo;exports.BurnDownChart=qn;exports.CalendarBoard=zd;exports.Card=La;exports.CardDetailModal=Hn;exports.CardDetailModalV2=jn;exports.CardHistoryReplay=Vd;exports.CardHistoryTimeline=Hd;exports.CardRelationshipsGraph=Yd;exports.CardStack=Sf;exports.CardTemplateSelector=as;exports.CircuitBreaker=Cn;exports.Column=Tr;exports.ColumnManager=Ro;exports.CommandPalette=Wn;exports.ConfigMenu=ss;exports.ContextMenu=Ir;exports.DEFAULT_SHORTCUTS=eo;exports.DEFAULT_TEMPLATES=ts;exports.DateRangePicker=Hr;exports.DependenciesSelector=Vr;exports.DependencyLine=Ho;exports.DistributionCharts=Xn;exports.EditableColumnTitle=An;exports.ErrorBoundary=Dr;exports.ExportImportModal=os;exports.FilterBar=ns;exports.GANTT_AI_SYSTEM_PROMPT=yd;exports.GanttAIAssistant=Jo;exports.GanttBoard=hd;exports.GanttI18nContext=Ar;exports.GanttMilestone=Vo;exports.GanttToolbar=Bo;exports.GenerateGanttTasksDialog=rc;exports.GeneratePlanModal=Jd;exports.GroupBySelector=Qn;exports.KanbanBoard=ja;exports.KanbanToolbar=Bn;exports.KanbanViewAdapter=Xr;exports.KeyboardShortcutsHelp=es;exports.ListView=Md;exports.MenuIcons=lt;exports.PluginManager=fn;exports.PrioritySelector=ar;exports.RATE_LIMITS=Bf;exports.SwimlaneBoardView=Jn;exports.TaskBar=Uo;exports.TaskFormModal=Xo;exports.TaskGrid=$o;exports.ThemeModal=cs;exports.ThemeProvider=Il;exports.ThemeSwitcher=Mc;exports.Timeline=Ko;exports.UserAssignmentSelector=or;exports.VelocityChart=Yn;exports.VirtualGrid=Dc;exports.VirtualList=wc;exports.aiUsageTracker=fr;exports.borderRadius=ii;exports.calculatePosition=vo;exports.calendarDarkTheme=Ys;exports.calendarEnTranslations=Ws;exports.calendarEsTranslations=Gs;exports.calendarLightTheme=qs;exports.calendarNeutralTheme=Xs;exports.calendarThemes=cn;exports.calendarTranslations=on;exports.cardToGanttTask=Qo;exports.cardsToGanttTasks=Dd;exports.cn=k;exports.createKanbanView=ul;exports.createRetryWrapper=Yc;exports.darkTheme=is;exports.darkTokenTheme=hn;exports.defaultTheme=Io;exports.designTokens=bn;exports.duration=pi;exports.easing=ui;exports.exportTokensToCSS=Pc;exports.findTaskByName=$a;exports.fontSize=li;exports.fontWeight=di;exports.formatCost=mo;exports.ganttEnTranslations=Fo;exports.ganttEsTranslations=Fl;exports.ganttTaskToCardUpdate=Td;exports.ganttThemes=Oe;exports.ganttTokens=hi;exports.ganttTranslations=ms;exports.ganttUtils=oe;exports.generateCSSVariables=vi;exports.generateCompleteCSS=wi;exports.generateInitialPositions=_c;exports.generateTasksContext=vd;exports.generateThemeVariables=fo;exports.getCalendarTheme=$d;exports.getCalendarTranslations=io;exports.getListViewTheme=Ad;exports.getListViewTranslations=Os;exports.getMonthNames=Id;exports.getToken=Ec;exports.getTranslations=Bl;exports.getWeekdayNames=Ld;exports.kanbanTokens=bi;exports.lightTheme=ls;exports.lightTokenTheme=xi;exports.lineHeight=ci;exports.listViewDarkTheme=zs;exports.listViewEnTranslations=Bs;exports.listViewEsTranslations=Rs;exports.listViewLightTheme=$s;exports.listViewNeutralTheme=Us;exports.listViewThemes=rn;exports.listViewTranslations=en;exports.mergeCalendarTranslations=nn;exports.mergeListViewTranslations=tn;exports.mergeTranslations=ps;exports.neutralTheme=ds;exports.neutralTokenTheme=ki;exports.opacity=fi;exports.parseLocalCommand=wd;exports.parseNaturalDate=Is;exports.parseNaturalDuration=Ls;exports.parseProgress=Fs;exports.parseStatus=kd;exports.pluginManager=eb;exports.retrySyncOperation=Kc;exports.retryWithBackoff=xo;exports.shadows=gi;exports.shouldVirtualizeGrid=Sc;exports.spacing=si;exports.themes=lr;exports.useAI=pc;exports.useBoard=nc;exports.useBoardCore=go;exports.useBoardStore=gn;exports.useCardStacking=fc;exports.useDragState=Ln;exports.useFilteredCards=vc;exports.useFilters=lc;exports.useGanttI18n=to;exports.useKanbanState=un;exports.useKeyboardShortcuts=Pl;exports.useMultiSelect=uc;exports.useSelectionState=ai;exports.useSortedCards=xc;exports.useTheme=Pr;exports.useVirtualGrid=Nc;exports.useVirtualList=Cc;exports.validateAIResponse=Cd;exports.withErrorBoundary=$n;exports.wouldCreateCircularDependency=wo;exports.zIndex=mi;//# sourceMappingURL=index.cjs.map
352
+ `}var nb=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return 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:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return 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:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Mc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Pr();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([d,c])=>{let m=d,n=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":n,title:c.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(nb,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:c.displayName})]},m)})})}
353
+ Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=ec;exports.AI_FEATURES=Of;exports.AI_MODELS=Qs;exports.AddCardButton=zn;exports.AddColumnButton=On;exports.AttachmentUploader=Zr;exports.BoardProvider=hc;exports.BulkOperationsToolbar=Mo;exports.BurnDownChart=qn;exports.CalendarBoard=zd;exports.Card=La;exports.CardDetailModal=Hn;exports.CardDetailModalV2=jn;exports.CardHistoryReplay=Vd;exports.CardHistoryTimeline=Hd;exports.CardRelationshipsGraph=Yd;exports.CardStack=Ef;exports.CardTemplateSelector=as;exports.CircuitBreaker=Cn;exports.Column=Tr;exports.ColumnManager=Ro;exports.CommandPalette=Wn;exports.ConfigMenu=ss;exports.ContextMenu=Ir;exports.DEFAULT_SHORTCUTS=eo;exports.DEFAULT_TEMPLATES=ts;exports.DateRangePicker=Hr;exports.DependenciesSelector=Vr;exports.DependencyLine=Ho;exports.DistributionCharts=Xn;exports.EditableColumnTitle=An;exports.ErrorBoundary=Dr;exports.ExportImportModal=os;exports.FilterBar=ns;exports.GANTT_AI_SYSTEM_PROMPT=yd;exports.GanttAIAssistant=Jo;exports.GanttBoard=hd;exports.GanttI18nContext=Ar;exports.GanttMilestone=Vo;exports.GanttToolbar=Bo;exports.GenerateGanttTasksDialog=rc;exports.GeneratePlanModal=Jd;exports.GroupBySelector=Qn;exports.KanbanBoard=ja;exports.KanbanToolbar=Bn;exports.KanbanViewAdapter=Xr;exports.KeyboardShortcutsHelp=es;exports.ListView=Md;exports.MenuIcons=lt;exports.PluginManager=fn;exports.PrioritySelector=ar;exports.RATE_LIMITS=Rf;exports.SwimlaneBoardView=Jn;exports.TaskBar=Uo;exports.TaskFormModal=Xo;exports.TaskGrid=$o;exports.ThemeModal=cs;exports.ThemeProvider=Il;exports.ThemeSwitcher=Mc;exports.Timeline=Ko;exports.UserAssignmentSelector=or;exports.VelocityChart=Yn;exports.VirtualGrid=Dc;exports.VirtualList=wc;exports.aiUsageTracker=fr;exports.borderRadius=ii;exports.calculatePosition=vo;exports.calendarDarkTheme=Ys;exports.calendarEnTranslations=Ws;exports.calendarEsTranslations=Gs;exports.calendarLightTheme=qs;exports.calendarNeutralTheme=Xs;exports.calendarThemes=cn;exports.calendarTranslations=on;exports.cardToGanttTask=Qo;exports.cardsToGanttTasks=Dd;exports.cn=k;exports.createKanbanView=ul;exports.createRetryWrapper=Yc;exports.darkTheme=is;exports.darkTokenTheme=hn;exports.defaultTheme=Io;exports.designTokens=bn;exports.duration=pi;exports.easing=ui;exports.exportTokensToCSS=Pc;exports.findTaskByName=$a;exports.fontSize=li;exports.fontWeight=di;exports.formatCost=mo;exports.ganttEnTranslations=Fo;exports.ganttEsTranslations=Fl;exports.ganttTaskToCardUpdate=Td;exports.ganttThemes=Oe;exports.ganttTokens=hi;exports.ganttTranslations=ms;exports.ganttUtils=oe;exports.generateCSSVariables=vi;exports.generateCompleteCSS=wi;exports.generateInitialPositions=_c;exports.generateTasksContext=vd;exports.generateThemeVariables=fo;exports.getCalendarTheme=$d;exports.getCalendarTranslations=io;exports.getListViewTheme=Ad;exports.getListViewTranslations=Os;exports.getMonthNames=Id;exports.getToken=Ec;exports.getTranslations=Bl;exports.getWeekdayNames=Ld;exports.kanbanTokens=bi;exports.lightTheme=ls;exports.lightTokenTheme=xi;exports.lineHeight=ci;exports.listViewDarkTheme=zs;exports.listViewEnTranslations=Bs;exports.listViewEsTranslations=Rs;exports.listViewLightTheme=$s;exports.listViewNeutralTheme=Us;exports.listViewThemes=rn;exports.listViewTranslations=en;exports.mergeCalendarTranslations=nn;exports.mergeListViewTranslations=tn;exports.mergeTranslations=ps;exports.neutralTheme=ds;exports.neutralTokenTheme=ki;exports.opacity=fi;exports.parseLocalCommand=wd;exports.parseNaturalDate=Is;exports.parseNaturalDuration=Ls;exports.parseProgress=Fs;exports.parseStatus=kd;exports.pluginManager=tb;exports.retrySyncOperation=Kc;exports.retryWithBackoff=xo;exports.shadows=gi;exports.shouldVirtualizeGrid=Sc;exports.spacing=si;exports.themes=lr;exports.useAI=pc;exports.useBoard=nc;exports.useBoardCore=go;exports.useBoardStore=gn;exports.useCardStacking=fc;exports.useDragState=Ln;exports.useFilteredCards=vc;exports.useFilters=lc;exports.useGanttI18n=to;exports.useKanbanState=un;exports.useKeyboardShortcuts=Pl;exports.useMultiSelect=uc;exports.useSelectionState=ai;exports.useSortedCards=xc;exports.useTheme=Pr;exports.useVirtualGrid=Nc;exports.useVirtualList=Cc;exports.validateAIResponse=Cd;exports.withErrorBoundary=$n;exports.wouldCreateCircularDependency=wo;exports.zIndex=mi;//# sourceMappingURL=index.cjs.map
354
354
  //# sourceMappingURL=index.cjs.map