@libxai/board 0.17.239 → 0.17.241
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 +59 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +59 -59
- package/dist/index.js.map +1 -1
- package/dist/styles.css +43 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=xl(t[0]),r=[],o=new Map,n=[];for(let i=1;i<t.length;i++)try{let m=xl(t[i]||"");if(m.length>a.length){n.push(`Line ${i+1}: Too many columns`);continue}if(a.length-m.length>3){n.push(`Line ${i+1}: Column count mismatch (expected ${a.length}, got ${m.length})`);continue}for(;m.length<a.length;)m.push("");let d={};a.forEach((f,c)=>{d[f]=m[c]||"";});let l=d.Column||"Unnamed";o.has(l)||o.set(l,{id:`col-${o.size+1}`,title:l,position:o.size+1,cardIds:[]});let s=o.get(l),g={id:d["Card ID"]||`card-${i}`,title:d.Title||"Untitled",description:d.Description?d.Description:void 0,columnId:s.id,position:s.cardIds.length+1,priority:d.Priority||void 0,labels:d.Labels?d.Labels.split(";").filter(Boolean):void 0,assignedUserIds:d["Assigned Users"]?d["Assigned Users"].split(";").filter(Boolean):void 0,startDate:d["Start Date"]?d["Start Date"]:void 0,endDate:d["End Date"]?d["End Date"]:void 0,createdAt:d["Created At"]?d["Created At"]:void 0,updatedAt:d["Updated At"]?d["Updated At"]:void 0};r.push(g),s.cardIds.push(g.id);}catch(m){n.push(`Line ${i+1}: ${m instanceof Error?m.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],i=e[o+1];n==='"'&&r&&i==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function kl(e,t){switch(t){case "json":return Ym(e);case "csv":return qm(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var as=react.createContext(null);function Cl(){return react.useContext(as)}var Tl=react.createContext(null);function Dl({children:e,themeName:t}){return jsxRuntime.jsx(Tl.Provider,{value:{themeName:t},children:e})}function Vr(){return react.useContext(Tl)}function nt({children:e,container:t}){let[a,r]=react.useState(false),o=Cl(),n=Vr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let i=t||(typeof document<"u"?document.body:null);if(!i)return null;if(o){let{theme:m,themeName:p}=o,d={"--asakaa-color-background-primary":m.bgPrimary,"--asakaa-color-background-secondary":m.bgSecondary,"--asakaa-color-background-card":m.bgGrid,"--asakaa-color-background-hover":m.hoverBg,"--asakaa-color-text-primary":m.textPrimary,"--asakaa-color-text-secondary":m.textSecondary,"--asakaa-color-text-tertiary":m.textTertiary,"--asakaa-color-text-inverse":m.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":m.border,"--asakaa-color-border-hover":m.borderLight,"--asakaa-color-border-subtle":m.borderLight,"--asakaa-color-interactive-primary":m.accent,"--asakaa-color-interactive-primaryHover":m.accentHover,"--asakaa-color-interactive-primaryBorder":`${m.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${m.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${m.accent}33`,"--asakaa-color-status-success":m.statusCompleted,"--asakaa-color-status-warning":m.milestone,"--asakaa-color-status-error":m.criticalPath,"--asakaa-color-danger":m.criticalPath,"--asakaa-color-danger-border":`${m.criticalPath}4D`,"--asakaa-color-danger-background":`${m.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${m.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:d,children:e}),i)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),i):reactDom.createPortal(e,i)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},rp="#BDC3C7",op=({color:e})=>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",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function wr({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState({top:0,left:0}),m=react.useRef(null),p=react.useRef(null),d=()=>{if(!p.current)return;let f=p.current.getBoundingClientRect(),c=window.innerHeight,w=window.innerWidth,h=160,k=220,u=4,y=f.right-h;y<10&&(y=f.left),y+h>w-10&&(y=w-h-10);let x=c-f.bottom,D=f.top,T;x>=k+u?T=f.bottom+u:D>=k+u?T=f.top-k-u:T=x>=D?f.bottom+u:Math.max(10,f.top-k-u),i({top:T,left:y}),o(true);};react.useEffect(()=>{let f=c=>{m.current&&!m.current.contains(c.target)&&!p.current?.contains(c.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),react.useEffect(()=>{let f=c=>{c.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let l=f=>{t(f),o(false);},s=e?Ml[e]:null,g=s?.color||rp;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:p,onClick:()=>r?o(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${g}10`:"transparent",boxShadow:e?`0 0 0 2px ${g}30 inset`:"none"},title:s?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:g,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:g,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:m,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Ml).map(([f,c])=>jsxRuntime.jsxs("button",{onClick:()=>l(f),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:c.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(op,{color:c.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:c.label}),e===f&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>l(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var np=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function fo({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[i,m]=react.useState({top:0,left:0}),p=react.useRef(null),d=react.useRef(null),g=(Vr()?.themeName||"dark")==="dark",f=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,T=320,M=380,v=4,B=y.left;B+T>D-10&&(B=D-T-10),B<10&&(B=10);let S=x-y.bottom,C=y.top,$;S>=M+v?$=y.bottom+v:C>=M+v?$=y.top-M-v:$=S>=C?y.bottom+v:Math.max(10,y.top-M-v),m({top:$,left:B}),n(true);};react.useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!d.current?.contains(x.target)&&n(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let c=y=>{let x=new Date,D=B=>{let S=B.getFullYear(),C=String(B.getMonth()+1).padStart(2,"0"),$=String(B.getDate()).padStart(2,"0");return `${S}-${C}-${$}`},T=D(x),M=new Date(x);M.setDate(M.getDate()+y);let v=D(M);a(T,v),n(false);},w=()=>{if(!e||!t)return "Set date";let y=M=>{if(M instanceof Date)return M;if(typeof M!="string"||!M.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=M.split("-").map(Number);if(v.length!==3||v.some($=>isNaN($)))return null;let B=v[0],S=v[1],C=v[2];return B===void 0||S===void 0||C===void 0?null:new Date(B,S-1,C)},x=y(e),D=y(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[x.getMonth()]} ${x.getDate()} \u2013 ${T[D.getMonth()]} ${D.getDate()}`},h=e&&t,u=(()=>{if(!t)return false;let y=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),y<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:d,onClick:()=>o?n(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${u?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${w()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:w()})]}),o&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,background:g?"#1A1D25":"#FFFFFF",border:`1px solid ${g?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:g?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:g?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:np.map(y=>jsxRuntime.jsx("button",{onClick:()=>c(y.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:y.label},y.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:g?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:y=>a(y.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:y=>a(e,y.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:g?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:g?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:g?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:g?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:y=>{y.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Tr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,i]=react.useState(false),[m,p]=react.useState(""),[d,l]=react.useState({top:0,left:0}),s=react.useRef(null),g=react.useRef(null),f=()=>{if(!g.current)return;let u=g.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,D=300,T=380,M=4,v=u.right-D;v<10&&(v=u.left),v+D>x-10&&(v=x-D-10);let B=y-u.bottom,S=u.top,C;B>=T+M?C=u.bottom+M:S>=T+M?C=u.top-T-M:C=B>=S?u.bottom+M:Math.max(10,u.top-T-M),l({top:C,left:v}),i(true);};react.useEffect(()=>{let u=y=>{s.current&&!s.current.contains(y.target)&&!g.current?.contains(y.target)&&(i(false),p(""));};if(n)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&(i(false),p(""));};if(n)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[n]);let c=u=>{let y=e.some(x=>x.id===u.id);a(y?e.filter(x=>x.id!==u.id):[...e,u]);},w=t.filter(u=>u.name.toLowerCase().includes(m.toLowerCase())),h=e.slice(0,o),k=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:g,onClick:()=>n?i(false):f(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[h.map(u=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:u.name,children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"asakaa-avatar-img"}):u.initials},u.id)),k>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",k]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),n&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:s,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:u=>p(u.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):w.map(u=>{let y=e.some(x=>x.id===u.id);return jsxRuntime.jsxs("button",{onClick:()=>c(u),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:u.color,color:"#fff"},children:u.avatar?jsxRuntime.jsx("img",{src:u.avatar,alt:u.name,className:"w-full h-full rounded-full object-cover"}):u.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:u.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:y?"#3b82f6":"transparent"},children:y?"\u2713":""})]},u.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),i(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function qo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let d=p.dependencies.map(l=>{if(typeof l=="string")return l;let s=l;return s.taskId||s.targetId||""}).filter(Boolean);r.set(p.id,d);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,i=new Set,m=p=>{if(!n.has(p)){n.add(p),i.add(p);let d=r.get(p)||[];for(let l of d){if(!n.has(l)&&m(l))return true;if(i.has(l))return true}}return i.delete(p),false};return m(a)}function bo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:i}){let[m,p]=react.useState(false),[d,l]=react.useState(""),[s,g]=react.useState(t.length>0),[f,c]=react.useState({top:0,left:0}),[w,h]=react.useState(null),k=react.useRef(null),u=react.useRef(null),y=()=>{if(!u.current)return;let v=u.current.getBoundingClientRect(),B=window.innerHeight,S=window.innerWidth,C=300,$=s?380:120,L=4,q=v.right-C;q<10&&(q=v.left),q+C>S-10&&(q=S-C-10);let j=B-v.bottom,me=v.top,he;j>=$+L?he=v.bottom+L:me>=$+L?he=v.top-$-L:he=j>=me?v.bottom+L:Math.max(10,v.top-$-L),c({top:he,left:q}),p(true);};react.useEffect(()=>{if(!m||!u.current)return;let v=u.current.getBoundingClientRect(),B=window.innerHeight,S=window.innerWidth,C=300,$=s?380:120,L=4,q=v.right-C;q<10&&(q=v.left),q+C>S-10&&(q=S-C-10);let j=B-v.bottom,me=v.top,he;j>=$+L?he=v.bottom+L:me>=$+L?he=v.top-$-L:he=j>=me?v.bottom+L:Math.max(10,v.top-$-L),c({top:he,left:q});},[s,m]),react.useEffect(()=>{let v=B=>{k.current&&!k.current.contains(B.target)&&!u.current?.contains(B.target)&&(p(false),l(""));};if(m)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[m]),react.useEffect(()=>{let v=B=>{B.key==="Escape"&&(p(false),l(""));};if(m)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[m]);let x=v=>{let B=t.includes(v),S=a.find(C=>C.id===v);if(h(null),B){let C=t.filter($=>$!==v);r(C),C.length===0&&g(false);}else {if(n&&qo(a,v,e)){let $=`Cannot add "${S?.title||v}" as dependency - would create circular reference`;h($),i?.(v,S?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),g(true);}},D=()=>{let v=!s;g(v),v||r([]);},T=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(d.toLowerCase())||v.id.toLowerCase().includes(d.toLowerCase())),M=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:u,onClick:()=>m?p(false):y(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[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:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:M,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:M},children:t.length})]}),m&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:k,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[w&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[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:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:w})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:D,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:s?"#3b82f6":"transparent",borderColor:s?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:s&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:d,onChange:v=>l(v.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:T.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):T.map(v=>{let B=t.includes(v.id);return jsxRuntime.jsxs("button",{onClick:()=>x(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:S=>{S.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:S=>{S.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),g(false),p(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Ya=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:i,availableUsers:m=[],allCards:p=[]})=>{let{attributes:d,listeners:l,setNodeRef:s,transform:g,transition:f,isDragging:c}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Vo.Transform.toString(g),transition:f};if(t)return jsxRuntime.jsx("div",{ref:s,style:w,...d,...l,onClick:()=>a?.(e),children:t(e)});let h=m.filter(x=>e.assignedUserIds?.includes(x.id)),k=e.progress===100,u=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),y={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:s,style:y,className:b("asakaa-card",c&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...d,...l,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),u.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:u.length===1&&u[0]?jsxRuntime.jsx("img",{src:u[0].url,alt:u[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:u.slice(0,4).map((x,D)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),D===3&&u.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",u.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:k?"line-through":"none",opacity:k?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(wr,{priority:e.priority,onChange:x=>i?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(fo,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,D)=>i?.(e.id,{startDate:x,endDate:D})})}),m.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Tr,{assignedUsers:h,availableUsers:m,onChange:x=>i?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(bo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:p,onChange:x=>i?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Ya.displayName="Card";var Xo={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Ul=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[i,m]=react.useState({top:0,left:0}),p=react.useRef(null),d=react.useRef(null),l=[...Object.entries(Xo).map(([h,k])=>({id:h,label:k.label,color:k.color,icon:k.icon})),...r.filter(h=>!Object.keys(Xo).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],s=()=>{let h=Xo[e];if(h)return {...h,id:e};let k=r.find(u=>u.id===e);return k?{id:k.id,label:k.title,color:k.color||"#8B5CF6",icon:"circle-dot"}:{...Xo.todo,id:"todo"}},g=()=>{if(!d.current)return;let h=d.current.getBoundingClientRect(),k=window.innerHeight,u=window.innerWidth,y=180,x=280,D=4,T=h.right-y;T<10&&(T=h.left),T+y>u-10&&(T=u-y-10);let M=k-h.bottom,v=h.top,B;M>=x+D?B=h.bottom+D:v>=x+D?B=h.top-x-D:B=M>=v?h.bottom+D:Math.max(10,h.top-x-D),m({top:B,left:T}),n(true);};react.useEffect(()=>{let h=k=>{p.current&&!p.current.contains(k.target)&&!d.current?.contains(k.target)&&n(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{let h=k=>{k.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let f=h=>{t(h),n(false);},c=s(),w=c.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>o?n(false):g(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:c.label,children:jsxRuntime.jsx(Ul,{icon:c.icon,color:w})}),o&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:l.map(h=>jsxRuntime.jsxs("button",{onClick:()=>f(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{icon:h.icon,color:h.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}function Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,i]=react.useState(false),[m,p]=react.useState(false),[d,l]=react.useState(e),[s,g]=react.useState({top:0,left:0}),f=react.useRef(null),c=react.useRef(null),w=react.useRef(null);react.useEffect(()=>{if(n&&c.current){let y=c.current.getBoundingClientRect();g({top:y.bottom+window.scrollY+8,left:y.left+window.scrollX});}},[n]),react.useEffect(()=>{let y=x=>{f.current&&!f.current.contains(x.target)&&!c.current?.contains(x.target)&&(i(false),p(false));};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&(i(false),p(false),l(e));};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n,e]),react.useEffect(()=>{m&&w.current&&(w.current.focus(),w.current.select());},[m]);let h=()=>{p(true),l(e);},k=()=>{let y=d.trim();y&&y!==e&&t(y),p(false),i(false),l(e);},u=y=>{y.key==="Enter"?k():y.key==="Escape"&&(p(false),l(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>i(!n),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children: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:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),n&&jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${s.top}px`,left:`${s.left}px`,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)",zIndex:99999},children:m?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:w,type:"text",value:d,onChange:y=>l(y.target.value),onKeyDown:u,onBlur:k,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[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:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),i(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Yr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:i,onCardUpdate:m,availableUsers:p,allCards:d,enableVirtualization:l,cardHeight:s=120,isCollapsed:g,onToggleCollapse:f,onColumnRename:c,onColumnDelete:w,isDeletable:h=false,className:k})=>{let{setNodeRef:u,isOver:y}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),D=l??gl(t.length),T=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>s,enabled:D});if(a)return jsxRuntime.jsx("div",{ref:u,className:k,children:a(e,t)});let v=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),B=v.state==="exceeded",S=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:u,className:b("asakaa-column",y&&"ring-2 ring-asakaa-accent-blue",B&&"ring-2 ring-asakaa-accent-red",k),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:b(S()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&v.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${v.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[v.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),v.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),v.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),v.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(c||w)&&jsxRuntime.jsx(Hl,{columnTitle:e.title,onRename:C=>c?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:h}),f&&jsxRuntime.jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":g?"Expand column":"Collapse column",children:g?"\u25B6":"\u25BC"})]})]}),!g&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):D?jsxRuntime.jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(C=>{let $=t[C.index];return $?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(Ya,{card:$,render:r,onClick:i,onUpdate:m,availableUsers:p,allCards:d})},$.id):null})}):t.map(C=>jsxRuntime.jsx(Ya,{card:C,render:r,onClick:i,onUpdate:m,availableUsers:p,allCards:d},C.id))})})]})});Yr.displayName="Column";function is({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,i]=react.useState(e),m=react.useRef(null);react.useEffect(()=>{r&&m.current&&(m.current.focus(),m.current.select());},[r]);let p=()=>{let l=n.trim();l&&l!==e?t(l):i(e),o(false);},d=l=>{l.key==="Enter"?p():l.key==="Escape"&&(i(e),o(false));};return r?jsxRuntime.jsx("input",{ref:m,type:"text",value:n,onChange:l=>i(l.target.value),onBlur:p,onKeyDown:d,className:b("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:b("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var en=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function $a({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:n=false,compact:i=true}){let[m,p]=react.useState(false),[d,l]=react.useState(""),[s,g]=react.useState(false),[f,c]=react.useState(en[10]||"#3B82F6"),[w,h]=react.useState({top:0,left:0}),k=react.useRef(null),u=react.useRef(null),y=react.useRef(null),x=react.useRef(null),D=t.filter(C=>C.name.toLowerCase().includes(d.toLowerCase())),T=t.some(C=>C.name.toLowerCase()===d.toLowerCase());react.useEffect(()=>{if(m&&u.current){let C=u.current.getBoundingClientRect();h({top:C.bottom+6,left:C.left});}},[m]),react.useEffect(()=>{let C=$=>{let L=$.target,q=k.current?.contains(L),j=y.current?.contains(L);!q&&!j&&(p(false),l(""),g(false));};if(m)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[m]),react.useEffect(()=>{m&&x.current&&x.current.focus();},[m]);let M=C=>{let $=e.some(L=>L.id===C.id);a($?e.filter(L=>L.id!==C.id):[...e,C]);},v=async()=>{if(!(!r||!d.trim())){g(true);try{let C=await r(d.trim(),f);C&&(a([...e,C]),l(""),c(en[Math.floor(Math.random()*en.length)]||"#3B82F6"));}finally{g(false);}}},B=(C,$)=>{$.stopPropagation(),a(e.filter(L=>L.id!==C));},S={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:k,className:"relative",children:[jsxRuntime.jsxs("button",{ref:u,type:"button",onClick:()=>!n&&p(!m),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:S,disabled:n,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:y,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:w.top,left:w.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:d,onChange:C=>l(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&d.trim()&&!T&&r&&v();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:$=>B(C.id,$),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(C=>{let $=e.some(L=>L.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>M(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:$?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:L=>{$||(L.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:L=>{$||(L.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),$&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):d.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),d.trim()&&!T&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:en.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>c(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:f===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxRuntime.jsxs("button",{type:"button",onClick:v,disabled:s,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:s?.7:1},children:[s?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',d.trim(),'"']})]})]})}),document.body)]})}function ds({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function jl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(n=>jsxRuntime.jsx(ds,{tag:n,size:a},n.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}function Yl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let n=t.find(i=>i.id===o);return n||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Gp(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function ps({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:n="dark",locale:i="es",availableUsers:m=[],availableTags:p=[],onCreateTag:d}){let l=n==="dark",s={textTertiary:l?"#6B7280":"#9CA3AF",textSecondary:l?"#9CA3AF":"#6B7280",textPrimary:l?"#FFFFFF":"#111827",borderLight:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:l?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:l?"#1A1D25":"#FFFFFF",bgSecondary:l?"#0F1117":"#F9FAFB",hoverBg:l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},g=e&&"title"in e&&!("name"in e),f=e,[c,w]=react.useState(e?Yl(e,m):null),[h,k]=react.useState(false),[u,y]=react.useState(false),[x,D]=react.useState(false),[T,M]=react.useState(null),[v,B]=react.useState(new Date),[S,C]=react.useState(false);react.useEffect(()=>{e&&w(Yl(e,m));},[e?.id,m]);let $=react.useCallback(W=>{w(W),g&&o&&f?o(Gp(W,f)):r&&r(W);},[g,f,o,r]),L=react.useCallback(()=>{k(false),y(false),D(false),M(null);},[]),q=react.useCallback((W,te)=>{if(!c)return;let F={...c,[W]:te};$(F);},[c,$]),j=react.useCallback(W=>{if(!c)return;let te=c.progress||0;W==="completed"?te=100:W==="in-progress"&&te===0?te=10:W==="todo"&&(te=0);let F={...c,status:W,progress:te};$(F),k(false);},[c,$]),me=react.useCallback((W,te)=>{if(!c)return;let F={...c,startDate:W,endDate:te};$(F);},[c,$]),he=react.useCallback(()=>{let W=v.getFullYear(),te=v.getMonth(),F=new Date(W,te,1),R=new Date(W,te+1,0).getDate(),P=F.getDay(),X=[],ee=new Date(W,te,0).getDate();for(let ye=P-1;ye>=0;ye--)X.push({date:new Date(W,te-1,ee-ye),isCurrentMonth:false});for(let ye=1;ye<=R;ye++)X.push({date:new Date(W,te,ye),isCurrentMonth:true});let z=42-X.length;for(let ye=1;ye<=z;ye++)X.push({date:new Date(W,te+1,ye),isCurrentMonth:false});return X},[v]);return !t||!c?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",l?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",l?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",l?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[i==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",l?"text-[#6B7280]":"text-gray-400"),children:c.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",l?"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:b("p-1.5 rounded transition-colors",l?"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:b("p-1.5 rounded transition-colors",l?"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:a,className:b("p-1.5 rounded transition-colors",l?"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 W=c.progress===100?0:100,F={...c,progress:W,status:W===100?"completed":"todo"};$(F);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",c.progress===100?"bg-green-500 border-green-500":l?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:c.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",c.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:c.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:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{L(),k(!h);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",c.progress===100||c.status==="completed"?"bg-green-500/20 text-green-400":c.progress&&c.progress>0||c.status==="in-progress"?"bg-blue-500/20 text-blue-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:c.progress===100||c.status==="completed"?i==="es"?"COMPLETADO":"DONE":c.progress&&c.progress>0||c.status==="in-progress"?i==="es"?"EN PROGRESO":"IN PROGRESS":i==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:i==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:i==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:i==="es"?"Completado":"Done",color:"bg-green-500"}].map(W=>jsxRuntime.jsxs("button",{onClick:()=>j(W.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",c.status===W.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",W.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:W.label})]},W.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{L(),D(!x);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[c.assignees&&c.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[c.assignees.slice(0,3).map((W,te)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:W.color||"#8B5CF6"},title:W.name,children:W.initials||W.name.slice(0,2).toUpperCase()},te)),c.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:["+",c.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:i==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",l?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:m.length>0?m.map(W=>{let te=c.assignees?.some(F=>F.name===W.name);return jsxRuntime.jsxs("button",{onClick:()=>{let F=c.assignees||[],I;te?I=F.filter(R=>R.name!==W.name):I=[...F,W],q("assignees",I);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",te&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:W.color||"#8B5CF6"},children:W.initials||W.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:b("flex-1",l?"text-white":"text-gray-900"),children:W.name}),te&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},W.name)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",l?"text-[#6B7280]":"text-gray-500"),children:i==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{M(T?null:"start"),B(c.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",l?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[c.startDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",l?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),c.endDate?.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(i==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-44 py-2 border-r",l?"border-white/10":"border-gray-200"),children:(()=>{let W=new Date,te=new Date(W);te.setDate(W.getDate()+1);let F=new Date(W);F.setDate(W.getDate()+7);let I=new Date(W);return I.setDate(W.getDate()+14),[{label:i==="es"?"Hoy":"Today",date:W},{label:i==="es"?"Ma\xF1ana":"Tomorrow",date:te},{label:i==="es"?"Pr\xF3xima semana":"Next week",date:F},{label:i==="es"?"2 semanas":"2 weeks",date:I}].map((R,P)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",l?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{T==="start"?(me(R.date,c.endDate),M("end")):(me(c.startDate,R.date),M(null));},children:[jsxRuntime.jsx("span",{children:R.label}),jsxRuntime.jsx("span",{className:b("text-xs",l?"text-[#6B7280]":"text-gray-400"),children:R.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},P))})()}),jsxRuntime.jsxs("div",{className:"p-4 w-[280px]",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:b("text-sm font-medium",l?"text-white":"text-gray-900"),children:T==="start"?i==="es"?"Fecha inicio":"Start date":i==="es"?"Fecha fin":"End date"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>B(new Date(v.getFullYear(),v.getMonth()-1)),className:b("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("span",{className:b("text-sm min-w-[100px] text-center",l?"text-white":"text-gray-900"),children:v.toLocaleDateString(i==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>B(new Date(v.getFullYear(),v.getMonth()+1)),className:b("p-1 rounded",l?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(i==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map((W,te)=>jsxRuntime.jsx("div",{className:b("text-xs text-center py-1",l?"text-[#6B7280]":"text-gray-400"),children:W},te))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:he().map((W,te)=>{let F=W.date.toDateString()===new Date().toDateString(),I=c.startDate?.toDateString()===W.date.toDateString(),R=c.endDate?.toDateString()===W.date.toDateString(),P=c.startDate&&c.endDate&&W.date>=c.startDate&&W.date<=c.endDate;return jsxRuntime.jsx("button",{onClick:()=>{T==="start"?(me(W.date,c.endDate&&W.date>c.endDate?W.date:c.endDate),M("end")):(me(c.startDate&&W.date<c.startDate?W.date:c.startDate,W.date),M(null));},className:b("w-8 h-8 text-xs rounded-lg transition-colors",!W.isCurrentMonth&&(l?"text-[#4B5563]":"text-gray-300"),W.isCurrentMonth&&(l?"text-white":"text-gray-900"),F&&"ring-1 ring-blue-500",(I||R)&&"bg-blue-500 text-white",P&&!I&&!R&&(l?"bg-blue-500/20":"bg-blue-100"),l?"hover:bg-white/10":"hover:bg-gray-100"),children:W.date.getDate()},te)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{L(),y(!u);},className:b("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",c.priority==="high"||c.priority==="urgent"?"bg-red-500/20 text-red-400":c.priority==="medium"?"bg-yellow-500/20 text-yellow-400":c.priority==="low"?"bg-green-500/20 text-green-400":l?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:c.priority?c.priority==="high"||c.priority==="urgent"?i==="es"?"Alta":"High":c.priority==="medium"?i==="es"?"Media":"Medium":i==="es"?"Baja":"Low":i==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>y(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",l?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:i==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:i==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:i==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:i==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:i==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(W=>jsxRuntime.jsxs("button",{onClick:()=>{q("priority",W.id),y(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",l?"hover:bg-white/5":"hover:bg-gray-50",c.priority===W.id&&(l?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",W.color)}),jsxRuntime.jsx("span",{className:l?"text-white":"text-gray-900",children:W.label})]},W.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",l?"text-white":"text-gray-900"),children:c.startDate&&c.endDate?`${Math.ceil((c.endDate.getTime()-c.startDate.getTime())/(1e3*60*60*24))} ${i==="es"?"d\xEDas":"days"}`:i==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",l?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[S?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:c.progress||0,onChange:W=>{let te=parseInt(W.target.value),F=c.status;te===100?F="completed":te>0?F="in-progress":F="todo";let I={...c,progress:te,status:F};$(I);},onBlur:()=>C(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",l?"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:()=>C(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",l?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",c.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${c.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",l?"text-white":"text-gray-900"),children:[c.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx($a,{selectedTags:c.tags||[],availableTags:p,onChange:W=>{q("tags",W);},onCreateTag:d,theme:s})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-400"),children:c.dependencies&&c.dependencies.length>0?`${c.dependencies.length} ${i==="es"?"dependencias":"dependencies"}`:i==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm transition-colors",l?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),i==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",l?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),i==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),i==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Subtareas":"Subtasks"}),c.subtasks&&c.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:c.subtasks.map(W=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",W.progress===100?"bg-green-500 border-green-500":l?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:W.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",W.progress===100?"line-through text-[#6B7280]":l?"text-white":"text-gray-900"),children:W.name})]},W.id))}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),i==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",l?"text-white":"text-gray-900"),children:i==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",l?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",l?"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"}),i==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",l?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",l?"text-white":"text-gray-900"),children:i==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:b("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",l?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",l?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b("text-sm",l?"text-[#9CA3AF]":"text-gray-500"),children:i==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED para ",jsxRuntime.jsx("span",{className:"underline",children:"subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here to ",jsxRuntime.jsx("span",{className:"underline",children:"upload"})]})})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-80 border-l flex flex-col",l?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",l?"text-white":"text-gray-900"),children:i==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:b("w-10 h-10 mb-3",l?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:b("text-sm",l?"text-[#6B7280]":"text-gray-500"),children:i==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:b("p-4 border-t",l?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:b("flex items-center gap-2 px-3 py-2 rounded-lg",l?"bg-white/5":"bg-white border border-gray-200"),children:[jsxRuntime.jsx("input",{type:"text",placeholder:i==="es"?"Escribe un comentario...":"Write a comment...",className:b("flex-1 bg-transparent text-sm outline-none",l?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("button",{className:b("p-1.5 rounded transition-colors",l?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function lr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:i,style:m,isLoading:p,error:d,children:l,availableTags:s=[],onCreateTag:g}){let[f,c]=gs(),[w,h]=react.useState(null),k=o?.theme||"dark",u=k==="dark"||k==="neutral",y=u?"dark":"",x=react.useCallback((j,me)=>{t.onCardUpdate?.(j,me);},[t]),D=react.useCallback((j,me)=>{t.onColumnUpdate?.(j,{title:me});},[t]),T=react.useCallback(j=>{t.onColumnDelete?.(j);},[t]),M=["todo","in-progress","completed"],v=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),B=react.useMemo(()=>{let j=new Map;return e.columns.forEach(me=>{let he=me.cardIds.map(W=>e.cards.find(te=>te.id===W)).filter(W=>W!==void 0).sort((W,te)=>W.position-te.position);j.set(me.id,he);}),j},[e.cards,e.columns]),S=react.useCallback(j=>{let{active:me}=j,he=e.cards.find(W=>W.id===me.id);he&&c({isDragging:true,draggedCardId:he.id,sourceColumnId:he.columnId,targetColumnId:he.columnId});},[e.cards,c]),C=react.useCallback(j=>{let{active:me,over:he}=j;if(!he||!e.cards.find(F=>F.id===me.id))return;let te=null;he.data.current?.type==="column"?te=he.id:he.data.current?.type==="card"&&(te=e.cards.find(I=>I.id===he.id)?.columnId||null),te&&te!==f.targetColumnId&&c({...f,targetColumnId:te});},[e.cards,f,c]),$=react.useCallback(async j=>{let{active:me,over:he}=j;if(c({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!he)return;let W=e.cards.find(R=>R.id===me.id);if(!W)return;let te,F;if(he.data.current?.type==="column"){te=he.id;let R=B.get(te)||[];F=Zn(R,0);}else {let R=e.cards.find(ee=>ee.id===he.id);if(!R)return;te=R.columnId;let P=B.get(te)||[],X=P.findIndex(ee=>ee.id===he.id);F=Zn(P,X);}let I=e.columns.find(R=>R.id===te);if(I&&I.wipLimit&&I.wipLimitType==="hard"){let R=B.get(te)||[];if(W.columnId!==te&&R.length>=I.wipLimit){t.onWipLimitExceeded?.(I,W);return}}(W.columnId!==te||W.position!==F)&&await t.onCardMove?.(W.id,te,F);},[e.cards,e.columns,B,t,c]),L=react.useCallback(j=>{h(j),a?.(j);},[a]),q=react.useCallback(j=>{t.onCardUpdate?.(j.id,j),h(j);},[t]);return p?jsxRuntime.jsx("div",{className:b("asakaa-board",y,i),style:m,children:jsxRuntime.jsx(au,{columnCount:3})}):d?jsxRuntime.jsx("div",{className:b("asakaa-board",y,i),style:m,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof d=="string"?d:d.message})]})})}):jsxRuntime.jsxs(Dl,{themeName:k,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:v,collisionDetection:core$1.closestCorners,onDragStart:S,onDragOver:C,onDragEnd:$,children:[jsxRuntime.jsxs("div",{className:b("asakaa-board",y,i),style:m,"data-theme":k,children:[e.columns.sort((j,me)=>j.position-me.position).map(j=>{let me=B.get(j.id)||[],he=!M.includes(j.id);return jsxRuntime.jsx(Yr,{column:j,cards:me,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:L,onCardUpdate:x,onColumnRename:D,onColumnDelete:T,isDeletable:he,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},j.id)}),l]}),jsxRuntime.jsx(core$1.DragOverlay,{children:f.draggedCardId?jsxRuntime.jsx(Ya,{card:e.cards.find(j=>j.id===f.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(ps,{task:w,isOpen:!!w,onClose:()=>h(null),onCardUpdate:q,theme:u?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:n,availableTags:s,onCreateTag:g})]})}function au({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var iu={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},lu={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},du={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},cu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function mu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,i]=react.useState(false),m=react.useRef(null);react.useEffect(()=>{let d=l=>{m.current&&!m.current.contains(l.target)&&i(false);};return n&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let p=d=>{t(d),i(false);};return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(!n),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:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((d,l)=>d.position-l.position).map((d,l)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(d.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:l<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:l*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:d.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[d.cardIds.length," ",d.cardIds.length===1?"tarea":"tareas"]})]})]},d.id))]})})})]})}function pu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,i]=react.useState(false),[m,p]=react.useState(null),d=react.useRef(null);if(react.useEffect(()=>{let f=c=>{d.current&&!d.current.contains(c.target)&&i(false);};return n&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),!(a||r||o))return null;let s=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(f=>f.handler),g=async(f,c)=>{if(c){p(f);try{await c();}catch(w){console.error(`Export ${f} failed:`,w);}finally{p(null),i(false);}}};return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>i(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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-44 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:s.map((f,c)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(f.id,f.handler),disabled:m!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<s.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.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:m===f.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"})}):f.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:f.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function uu({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,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:t})]})}function hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:i,onExportJSON:m,onExportExcel:p,translations:d}){let l=r==="dark"?iu:lu,s={...o==="es"?du:cu,...d},g=i||m||p;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:l.bgGrid,borderColor:l.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(pu,{theme:l,t:s,onExportCSV:i,onExportJSON:m,onExportExcel:p}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:l.borderLight}})]}),t&&(n?jsxRuntime.jsx(mu,{columns:e,onSelect:t,theme:l,t:s,createTaskLabel:a}):jsxRuntime.jsx(uu,{onClick:()=>t(),label:a||s.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,i]=react.useState(false),[m,p]=react.useState(""),d=react.useCallback(()=>{let g=m.trim();g&&(e(g),p(""),i(false));},[m,e]),l=react.useCallback(g=>{g.key==="Enter"?(g.preventDefault(),d()):g.key==="Escape"&&(p(""),i(false));},[d]),s=react.useCallback(()=>{setTimeout(()=>{m.trim()||i(false);},150);},[m]);return n?jsxRuntime.jsx("div",{className:b("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:m,onChange:g=>p(g.target.value),onKeyDown:l,onBlur:s,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:d,disabled:!m.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{p(""),i(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:b("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>i(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:i=false,theme:m="dark",locale:p="es"}){let[d,l]=react.useState(false),[s,g]=react.useState(false),[f,c]=react.useState(""),[w,h]=react.useState([]),[k,u]=react.useState(""),[y,x]=react.useState(""),[D,T]=react.useState(""),[M,v]=react.useState(false),[B,S]=react.useState(false),[C,$]=react.useState(false),L=react.useRef(null),q=react.useRef(null),j={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},me=react.useCallback(()=>{c(""),h([]),u(""),x(""),T(""),v(false),S(false),$(false),l(false);},[]);react.useEffect(()=>{d&&L.current&&L.current.focus();},[d]),react.useEffect(()=>{if(!d)return;let I=R=>{q.current&&!q.current.contains(R.target)&&(f.trim()||me());};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[d,f,me]);let he=react.useCallback(async()=>{let I=f.trim();if(!(!I||s)){g(true);try{await t({name:I,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:k?new Date(k):void 0,endDate:y?new Date(y):void 0,priority:D||void 0}),c(""),h([]),u(""),x(""),T(""),v(!1),S(!1),$(!1),L.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{g(false);}}},[f,e,w,k,y,D,t,s]),W=react.useCallback(I=>{I.key==="Enter"&&!I.shiftKey?(I.preventDefault(),he()):I.key==="Escape"&&me();},[he,me]),te=react.useCallback(I=>{h(R=>R.includes(I)?R.filter(P=>P!==I):[...R,I]);},[]),F=m==="dark";return d?jsxRuntime.jsxs("div",{ref:q,className:b("rounded-lg overflow-hidden shadow-lg",F?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:L,type:"text",value:f,onChange:I=>c(I.target.value),onKeyDown:W,placeholder:j.placeholder,disabled:s,className:b("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",F?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>v(!M),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||w.length>0?"bg-emerald-500/20 text-emerald-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),w.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:w.length})]}),jsxRuntime.jsx("button",{onClick:()=>S(!B),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",B||k||y?"bg-blue-500/20 text-blue-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>$(!C),className:b("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":F?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:j.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:he,disabled:!f.trim()||s,className:b("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:s?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):j.save})]})]}),M&&a.length>0&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(I=>jsxRuntime.jsxs("button",{onClick:()=>te(I.id),className:b("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(I.id)?"bg-emerald-500 text-white":F?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[I.avatar?jsxRuntime.jsx("img",{src:I.avatar,alt:I.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(I.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:I.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:I.name.split(" ")[0]})]},I.id))})}),B&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",F?"text-gray-500":"text-gray-400"),children:j.startDate}),jsxRuntime.jsx("input",{type:"date",value:k,onChange:I=>u(I.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",F?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:b("block text-[10px] uppercase tracking-wide mb-1",F?"text-gray-500":"text-gray-400"),children:j.endDate}),jsxRuntime.jsx("input",{type:"date",value:y,onChange:I=>x(I.target.value),className:b("w-full px-2 py-1.5 rounded text-xs border",F?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:b("px-3 pb-3 pt-0","border-t",F?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(I=>jsxRuntime.jsx("button",{onClick:()=>T(D===I?"":I),className:b("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===I?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[I]} text-white`:F?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:j[I]},I))})})]}):jsxRuntime.jsxs("button",{onClick:()=>l(true),disabled:i,className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",F?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",i&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:j.buttonLabel})]})}var wo=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(lr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(n=>n.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,n)=>{r.toBlob(i=>{i?o(i):n(new Error("Failed to create PNG blob"));},"image/png");})}};function nd(e={}){return new wo(e)}var Zr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(i){console.error("Error in error handler:",i);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:i}=this.props;return a&&r?n?n(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:i?`Error in ${i}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function xs(e,t){let a=r=>jsxRuntime.jsx(Zr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:i,onPredictRisks:m,onOpenAIUsage:p,shortcut:d="k",className:l=""}){let[s,g]=react.useState(false),[f,c]=react.useState(""),[w,h]=react.useState("home"),[k,u]=react.useState(""),[y,x]=react.useState("");react.useEffect(()=>{let v=B=>{(B.metaKey||B.ctrlKey)&&B.key===d&&(B.preventDefault(),g(S=>!S)),B.key==="Escape"&&(g(false),h("home"),c(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[d]),react.useEffect(()=>{s||(h("home"),c(""),u(""),x(""));},[s]);let D=react.useCallback(()=>{g(false);},[]),T=react.useCallback(v=>{let[B,S]=v.split(":");switch(B){case "create-card":h("create-card");break;case "create-card-in":u(S||"");break;case "navigate":S?(a?.(S),D()):h("navigate");break;case "search":r?.(f),D();break;case "priority":h("priority");break;case "set-priority":y&&S&&(o?.(y,S),D());break;case "assign":h("assign");break;case "assign-user":y&&S&&(n?.(y,S),D());break;case "ai":h("ai");break;case "ai-generate-plan":i?.(),D();break;case "ai-predict-risks":m?.(),D();break;case "ai-usage":p?.(),D();break;case "back":h("home");break;}},[f,y,t,a,r,o,n,i,m,p,D]),M=react.useCallback(()=>{k&&f.trim()&&(t?.(k,f.trim()),D());},[k,f,t,D]);return s?jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:D,children:jsxRuntime.jsx("div",{className:`command-palette ${l}`,onClick:v=>v.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:f,onValueChange:c,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:w==="create-card"&&k?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&w==="create-card"&&k&&M();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),w==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:T,className:"command-palette-item",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"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:T,className:"command-palette-item",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(B=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:B},B))})]},v.id))})]}),w==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(v=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("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:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:v.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),w==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(v=>{let B=e.columns.find(S=>S.id===v.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:v.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),v.labels&&v.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(S=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:S},S))})]},v.id)})})]}),w==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function ld(e,t,a,r,o){let n=document.getElementById("attachment-lightbox-native");n&&n.remove();let i=document.createElement("div");i.id="attachment-lightbox-native",i.className="attachment-lightbox",i.style.cssText=`
|
|
1
|
+
'use strict';var client=require('react-dom/client'),core=require('@libxai/core'),react=require('react'),core$1=require('@dnd-kit/core'),sortable=require('@dnd-kit/sortable'),reactVirtual=require('@tanstack/react-virtual'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jspdf=require('jspdf'),pc=require('html2canvas'),reactDom=require('react-dom'),jsxRuntime=require('react/jsx-runtime'),framerMotion=require('framer-motion'),lucideReact=require('lucide-react'),cmdk=require('cmdk'),Mu=require('react-markdown'),Au=require('remark-gfm'),Iu=require('rehype-sanitize'),recharts=require('recharts');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var pc__default=/*#__PURE__*/_interopDefault(pc);var Mu__default=/*#__PURE__*/_interopDefault(Mu);var Au__default=/*#__PURE__*/_interopDefault(Au);var Iu__default=/*#__PURE__*/_interopDefault(Iu);var _o=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Vo=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [Vo.Translate.toString(e),Vo.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function y(...e){return tailwindMerge.twMerge(clsx.clsx(e))}function jo(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function Up(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zn(e,t){return e.length===0?1e3:t===0?jo(null,e[0].position):t>=e.length?jo(e[e.length-1].position,null):jo(e[t-1].position,e[t].position)}function gl(e,t=100){return e>t}var Wp=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function Hp(e,t,a,r){let o=t*Math.pow(a,e-1),n=o*.2*Math.random();return Math.min(o+n,r)}async function Ko(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:n=1e4,shouldRetry:s=Wp,onRetry:p}=t,m,l=0;for(let u=1;u<=a;u++){l=u;try{return {data:await e(),attempts:l,success:!0}}catch(c){if(m=c,u===a||!s(m,u))return {error:m,attempts:l,success:false};let i=Hp(u,r,o,n);if(p)try{p(m,u,i);}catch(w){console.error("Error in retry callback:",w);}await new Promise(w=>setTimeout(w,i));}}return {error:m||new Error("Unknown error"),attempts:l,success:false}}function Gp(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function _p(e,t={}){return async(...a)=>Ko(()=>e(...a),t)}var Qn=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var fl=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.NONE=4]="NONE",n))(fl||{}),Sr=class Sr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:n,...s}=t,p=`[${a}] [${r}] [${n}]`,m=Object.keys(s).length>0;switch(r){case "DEBUG":console.debug(p,o,m?s:"");break;case "INFO":console.info(p,o,m?s:"");break;case "WARN":console.warn(p,o,m?s:"");break;case "ERROR":console.error(p,o,m?s:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Sr.globalOptions};}static configure(t){Sr.globalOptions={...Sr.globalOptions,...t};}child(t){return new Sr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Yo((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Yo(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:fl[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Sr.globalOptions={};var es=Sr,Yo=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},hl=new es;function jp(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Kp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(n=>{let s=e.columns.find(p=>p.id===n.columnId);return [n.id,ts(n.title),ts(n.description||""),ts(s?.title||""),n.priority||"",(n.labels||[]).join(";"),(n.assignedUserIds||[]).join(";"),n.startDate||"",n.endDate||"",n.createdAt||"",n.updatedAt||""]});return [a.join(","),...r.map(n=>n.join(","))].join(`
|
|
2
|
+
`)}async function Yp(e,t,a){let r=t;if(!r){let s=document.querySelector(".asakaa-board");s&&(r=s.parentElement||s);}if(r)try{let s=await pc__default.default(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=s.toDataURL("image/png"),m=297,l=210,u=s.width/s.height,c=m-20,d=c/u;d>l-20&&(d=l-20,c=d*u);let i=new jspdf.jsPDF({orientation:"landscape",unit:"mm",format:"a4"});i.setFontSize(16),i.setTextColor(255,255,255),i.setFillColor(10,10,10),i.rect(0,0,m,15,"F"),i.text(e.title||"Kanban Board",10,10);let w=(m-c)/2;return i.addImage(p,"PNG",w,20,c,d),i}catch(s){console.error("Error capturing board:",s);}let o=new jspdf.jsPDF,n=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,n),n+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,n),n+=15,o.setTextColor(0,0,0),e.columns.forEach(s=>{let p=e.cards.filter(m=>m.columnId===s.id);n>250&&(o.addPage(),n=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(s.title,20,n),n+=8,p.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,n),o.setTextColor(0,0,0),n+=10):p.forEach(m=>{if(n>260&&(o.addPage(),n=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,n),n+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(m.description,160);o.text(u,25,n),n+=u.length*5;}let l=[];if(m.priority&&l.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&l.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&l.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),l.push(u.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,n),o.setTextColor(0,0,0),n+=5),n+=5;}),n+=5;}),o}function ts(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function yl(e,t,a,r){switch(t){case "json":return jp(e,r);case "csv":return Kp(e);case "pdf":return await Yp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function vl(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let n=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,s={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:s[t]}),m=URL.createObjectURL(p),l=document.createElement("a");l.href=m,l.download=n,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(m);}function qp(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Xp(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=xl(t[0]),r=[],o=new Map,n=[];for(let s=1;s<t.length;s++)try{let p=xl(t[s]||"");if(p.length>a.length){n.push(`Line ${s+1}: Too many columns`);continue}if(a.length-p.length>3){n.push(`Line ${s+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let l={};a.forEach((i,w)=>{l[i]=p[w]||"";});let u=l.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let c=o.get(u),d={id:l["Card ID"]||`card-${s}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:c.id,position:c.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),c.cardIds.push(d.id);}catch(p){n.push(`Line ${s+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...n]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:n.length>0?n:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function xl(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let n=e[o],s=e[o+1];n==='"'&&r&&s==='"'?(a+='"',o++):n==='"'?r=!r:n===","&&!r?(t.push(a),a=""):a+=n;}return t.push(a),t}function kl(e,t){switch(t){case "json":return qp(e);case "csv":return Xp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function wl(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var as=react.createContext(null);function Cl(){return react.useContext(as)}var Tl=react.createContext(null);function Dl({children:e,themeName:t}){return jsxRuntime.jsx(Tl.Provider,{value:{themeName:t},children:e})}function Kr(){return react.useContext(Tl)}function it({children:e,container:t}){let[a,r]=react.useState(false),o=Cl(),n=Kr();if(react.useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let s=t||(typeof document<"u"?document.body:null);if(!s)return null;if(o){let{theme:p,themeName:m}=o,l={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:l,children:e}),s)}return n?reactDom.createPortal(jsxRuntime.jsx("div",{"data-theme":n.themeName,"data-kanban-portal":"true",children:e}),s):reactDom.createPortal(e,s)}var Ml={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},om="#BDC3C7",nm=({color:e})=>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",fill:e,opacity:"0.9"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Er({priority:e,onChange:t,className:a}){let[r,o]=react.useState(false),[n,s]=react.useState({top:0,left:0}),p=react.useRef(null),m=react.useRef(null),l=()=>{if(!m.current)return;let i=m.current.getBoundingClientRect(),w=window.innerHeight,g=window.innerWidth,b=160,h=220,v=4,f=i.right-b;f<10&&(f=i.left),f+b>g-10&&(f=g-b-10);let x=w-i.bottom,T=i.top,D;x>=h+v?D=i.bottom+v:T>=h+v?D=i.top-h-v:D=x>=T?i.bottom+v:Math.max(10,i.top-h-v),s({top:D,left:f}),o(true);};react.useEffect(()=>{let i=w=>{p.current&&!p.current.contains(w.target)&&!m.current?.contains(w.target)&&o(false);};if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]),react.useEffect(()=>{let i=w=>{w.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[r]);let u=i=>{t(i),o(false);},c=e?Ml[e]:null,d=c?.color||om;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:m,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:c?.label||"Set priority",children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:p,className:"priority-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxRuntime.jsxs("div",{className:"py-1",children:[Object.entries(Ml).map(([i,w])=>jsxRuntime.jsxs("button",{onClick:()=>u(i),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:w.color,background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(nm,{color:w.color}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:w.label}),e===i&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},i)),jsxRuntime.jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:i=>{i.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:i=>{i.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsxRuntime.jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var sm=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function fo({startDate:e,endDate:t,onChange:a,className:r}){let[o,n]=react.useState(false),[s,p]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),d=(Kr()?.themeName||"dark")==="dark",i=()=>{if(!l.current)return;let f=l.current.getBoundingClientRect(),x=window.innerHeight,T=window.innerWidth,D=320,I=380,k=4,L=f.left;L+D>T-10&&(L=T-D-10),L<10&&(L=10);let N=x-f.bottom,C=f.top,G;N>=I+k?G=f.bottom+k:C>=I+k?G=f.top-I-k:G=N>=C?f.bottom+k:Math.max(10,f.top-I-k),p({top:G,left:L}),n(true);};react.useEffect(()=>{let f=x=>{m.current&&!m.current.contains(x.target)&&!l.current?.contains(x.target)&&n(false);};if(o)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),react.useEffect(()=>{let f=x=>{x.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let w=f=>{let x=new Date,T=L=>{let N=L.getFullYear(),C=String(L.getMonth()+1).padStart(2,"0"),G=String(L.getDate()).padStart(2,"0");return `${N}-${C}-${G}`},D=T(x),I=new Date(x);I.setDate(I.getDate()+f);let k=T(I);a(D,k),n(false);},g=()=>{if(!e||!t)return "Set date";let f=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=I.split("-").map(Number);if(k.length!==3||k.some(G=>isNaN(G)))return null;let L=k[0],N=k[1],C=k[2];return L===void 0||N===void 0||C===void 0?null:new Date(L,N-1,C)},x=f(e),T=f(t);if(!x||!T||isNaN(x.getTime())||isNaN(T.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[T.getMonth()]} ${T.getDate()}`},b=e&&t,v=(()=>{if(!t)return false;let f=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),f<x})();return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsxs("button",{ref:l,onClick:()=>o?n(false):i(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${v?"asakaa-date-overdue":"asakaa-date"}`,title:b?`${g()}`:"Set date range",children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:g()})]}),o&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxRuntime.jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-2",children:sm.map(f=>jsxRuntime.jsx("button",{onClick:()=>w(f.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:f.label},f.label))})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("input",{type:"date",value:e||"",onChange:f=>a(f.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsxRuntime.jsx("input",{type:"date",value:t||"",onChange:f=>a(e,f.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsxRuntime.jsx("button",{onClick:()=>{a(void 0,void 0),n(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:f=>{f.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[n,s]=react.useState(false),[p,m]=react.useState(""),[l,u]=react.useState({top:0,left:0}),c=react.useRef(null),d=react.useRef(null),i=()=>{if(!d.current)return;let v=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,T=300,D=380,I=4,k=v.right-T;k<10&&(k=v.left),k+T>x-10&&(k=x-T-10);let L=f-v.bottom,N=v.top,C;L>=D+I?C=v.bottom+I:N>=D+I?C=v.top-D-I:C=L>=N?v.bottom+I:Math.max(10,v.top-D-I),u({top:C,left:k}),s(true);};react.useEffect(()=>{let v=f=>{c.current&&!c.current.contains(f.target)&&!d.current?.contains(f.target)&&(s(false),m(""));};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&(s(false),m(""));};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let w=v=>{let f=e.some(x=>x.id===v.id);a(f?e.filter(x=>x.id!==v.id):[...e,v]);},g=t.filter(v=>v.name.toLowerCase().includes(p.toLowerCase())),b=e.slice(0,o),h=e.length-o;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:d,onClick:()=>n?s(false):i(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxRuntime.jsxs("div",{className:"asakaa-avatar-group",children:[b.map(v=>jsxRuntime.jsx("div",{className:"asakaa-avatar",title:v.name,children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"asakaa-avatar-img"}):v.initials},v.id)),h>0&&jsxRuntime.jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),n&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:c,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsxRuntime.jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("input",{type:"text",value:p,onChange:v=>m(v.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:g.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):g.map(v=>{let f=e.some(x=>x.id===v.id);return jsxRuntime.jsxs("button",{onClick:()=>w(v),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:v.color,color:"#fff"},children:v.avatar?jsxRuntime.jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.initials}),jsxRuntime.jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:v.name}),jsxRuntime.jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:f?"#3b82f6":"transparent"},children:f?"\u2713":""})]},v.id)})}),e.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsxRuntime.jsx("button",{onClick:()=>{a([]),s(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function qo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let l=m.dependencies.map(u=>{if(typeof u=="string")return u;let c=u;return c.taskId||c.targetId||""}).filter(Boolean);r.set(m.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let n=new Set,s=new Set,p=m=>{if(!n.has(m)){n.add(m),s.add(m);let l=r.get(m)||[];for(let u of l){if(!n.has(u)&&p(u))return true;if(s.has(u))return true}}return s.delete(m),false};return p(a)}function bo({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:n=true,onCircularDependencyError:s}){let[p,m]=react.useState(false),[l,u]=react.useState(""),[c,d]=react.useState(t.length>0),[i,w]=react.useState({top:0,left:0}),[g,b]=react.useState(null),h=react.useRef(null),v=react.useRef(null),f=()=>{if(!v.current)return;let k=v.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,G=c?380:120,F=4,J=k.right-C;J<10&&(J=k.left),J+C>N-10&&(J=N-C-10);let K=L-k.bottom,de=k.top,ge;K>=G+F?ge=k.bottom+F:de>=G+F?ge=k.top-G-F:ge=K>=de?k.bottom+F:Math.max(10,k.top-G-F),w({top:ge,left:J}),m(true);};react.useEffect(()=>{if(!p||!v.current)return;let k=v.current.getBoundingClientRect(),L=window.innerHeight,N=window.innerWidth,C=300,G=c?380:120,F=4,J=k.right-C;J<10&&(J=k.left),J+C>N-10&&(J=N-C-10);let K=L-k.bottom,de=k.top,ge;K>=G+F?ge=k.bottom+F:de>=G+F?ge=k.top-G-F:ge=K>=de?k.bottom+F:Math.max(10,k.top-G-F),w({top:ge,left:J});},[c,p]),react.useEffect(()=>{let k=L=>{h.current&&!h.current.contains(L.target)&&!v.current?.contains(L.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]),react.useEffect(()=>{let k=L=>{L.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[p]);let x=k=>{let L=t.includes(k),N=a.find(C=>C.id===k);if(b(null),L){let C=t.filter(G=>G!==k);r(C),C.length===0&&d(false);}else {if(n&&qo(a,k,e)){let G=`Cannot add "${N?.title||k}" as dependency - would create circular reference`;b(G),s?.(k,N?.title||k),setTimeout(()=>b(null),3e3);return}r([...t,k]),d(true);}},T=()=>{let k=!c;d(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(l.toLowerCase())||k.id.toLowerCase().includes(l.toLowerCase())),I=t.length>0?"#3B82F6":"#BDC3C7";return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsxs("button",{ref:v,onClick:()=>p?m(false):f(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[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:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),p&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:h,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[g&&jsxRuntime.jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[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:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:g})]}),jsxRuntime.jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsxRuntime.jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:c?"#3b82f6":"transparent",borderColor:c?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:c&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxRuntime.jsx("input",{type:"text",value:l,onChange:k=>u(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsxRuntime.jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsxRuntime.jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let L=t.includes(k.id);return jsxRuntime.jsxs("button",{onClick:()=>x(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:N=>{N.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:N=>{N.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:L?"#3b82f6":"transparent",borderColor:L?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:L&&jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:k.title}),jsxRuntime.jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsxRuntime.jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsxRuntime.jsx("button",{onClick:()=>{r([]),d(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var er=react.memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:n,onUpdate:s,availableUsers:p=[],allCards:m=[]})=>{let{attributes:l,listeners:u,setNodeRef:c,transform:d,transition:i,isDragging:w}=sortable.useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),g={transform:Vo.Transform.toString(d),transition:i};if(t)return jsxRuntime.jsx("div",{ref:c,style:g,...l,...u,onClick:()=>a?.(e),children:t(e)});let b=p.filter(x=>e.assignedUserIds?.includes(x.id)),h=e.progress===100,v=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),f={...g,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxRuntime.jsxs("div",{ref:c,style:f,className:y("asakaa-card",w&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",n),...l,...u,onClick:x=>{x.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-cover mb-3",children:jsxRuntime.jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:x=>{x.currentTarget.style.display="none";}})}),v.length>0&&!e.coverImage&&jsxRuntime.jsx("div",{className:"asakaa-card-attachments mb-3",children:v.length===1&&v[0]?jsxRuntime.jsx("img",{src:v[0].url,alt:v[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsxRuntime.jsx("div",{className:"grid grid-cols-2 gap-1",children:v.slice(0,4).map((x,T)=>jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),T===3&&v.length>4&&jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxRuntime.jsxs("span",{className:"text-white text-sm font-medium",children:["+",v.length-4]})})]},x.id))})}),jsxRuntime.jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.6:1},children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"priority-selector",children:jsxRuntime.jsx(Er,{priority:e.priority,onChange:x=>s?.(e.id,{priority:x})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsxRuntime.jsx(fo,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(x,T)=>s?.(e.id,{startDate:x,endDate:T})})}),p.length>0&&jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsxRuntime.jsx(Mr,{assignedUsers:b,availableUsers:p,onChange:x=>s?.(e.id,{assignedUserIds:x.map(T=>T.id)})})}),jsxRuntime.jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsxRuntime.jsx(bo,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>s?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsxRuntime.jsx("span",{className:"asakaa-label",children:x},x))}),typeof e.progress=="number"&&jsxRuntime.jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxRuntime.jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsxRuntime.jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));er.displayName="Card";var Xo={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Ul=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Wl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,n]=react.useState(false),[s,p]=react.useState({top:0,left:0}),m=react.useRef(null),l=react.useRef(null),u=[...Object.entries(Xo).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Xo).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],c=()=>{let b=Xo[e];if(b)return {...b,id:e};let h=r.find(v=>v.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Xo.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,v=window.innerWidth,f=180,x=280,T=4,D=b.right-f;D<10&&(D=b.left),D+f>v-10&&(D=v-f-10);let I=h-b.bottom,k=b.top,L;I>=x+T?L=b.bottom+T:k>=x+T?L=b.top-x-T:L=I>=k?b.bottom+T:Math.max(10,b.top-x-T),p({top:L,left:D}),n(true);};react.useEffect(()=>{let b=h=>{m.current&&!m.current.contains(h.target)&&!l.current?.contains(h.target)&&n(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),react.useEffect(()=>{let b=h=>{h.key==="Escape"&&n(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let i=b=>{t(b),n(false);},w=c(),g=w.color;return jsxRuntime.jsxs("div",{className:`relative ${a||""}`,children:[jsxRuntime.jsx("button",{ref:l,onClick:()=>o?n(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${g}10`,boxShadow:`0 0 0 2px ${g}30 inset`},title:w.label,children:jsxRuntime.jsx(Ul,{icon:w.icon,color:g})}),o&&jsxRuntime.jsx(it,{children:jsxRuntime.jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:u.map(b=>jsxRuntime.jsxs("button",{onClick:()=>i(b.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(Ul,{icon:b.icon,color:b.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:b.label}),e===b.id&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},b.id))})]})})]})}function Hl({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[n,s]=react.useState(false),[p,m]=react.useState(false),[l,u]=react.useState(e),[c,d]=react.useState({top:0,left:0}),i=react.useRef(null),w=react.useRef(null),g=react.useRef(null);react.useEffect(()=>{if(n&&w.current){let f=w.current.getBoundingClientRect();d({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[n]),react.useEffect(()=>{let f=x=>{i.current&&!i.current.contains(x.target)&&!w.current?.contains(x.target)&&(s(false),m(false));};if(n)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[n]),react.useEffect(()=>{let f=x=>{x.key==="Escape"&&(s(false),m(false),u(e));};if(n)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[n,e]),react.useEffect(()=>{p&&g.current&&(g.current.focus(),g.current.select());},[p]);let b=()=>{m(true),u(e);},h=()=>{let f=l.trim();f&&f!==e&&t(f),m(false),s(false),u(e);},v=f=>{f.key==="Enter"?h():f.key==="Escape"&&(m(false),u(e));};return jsxRuntime.jsxs("div",{className:`relative ${o||""}`,children:[jsxRuntime.jsx("button",{ref:w,onClick:()=>s(!n),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children: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:"3",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),n&&jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{ref:i,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${c.top}px`,left:`${c.left}px`,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)",zIndex:99999},children:p?jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsxRuntime.jsx("input",{ref:g,type:"text",value:l,onChange:f=>u(f.target.value),onKeyDown:v,onBlur:h,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsxs("button",{onClick:b,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[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:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxRuntime.jsxs("button",{onClick:()=>{a(),s(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsxRuntime.jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Xr=react.memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:n,onCardClick:s,onCardUpdate:p,availableUsers:m,allCards:l,enableVirtualization:u,cardHeight:c=120,isCollapsed:d,onToggleCollapse:i,onColumnRename:w,onColumnDelete:g,isDeletable:b=false,className:h})=>{let{setNodeRef:v,isOver:f}=core$1.useDroppable({id:e.id,data:{type:"column",column:e}}),x=react.useRef(null),T=u??gl(t.length),D=reactVirtual.useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>c,enabled:T});if(a)return jsxRuntime.jsx("div",{ref:v,className:h,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),L=k.state==="exceeded",N=()=>"asakaa-column-count";return jsxRuntime.jsxs("div",{ref:v,className:y("asakaa-column",f&&"ring-2 ring-asakaa-accent-blue",L&&"ring-2 ring-asakaa-accent-red",h),children:[o?o(e,t.length):jsxRuntime.jsxs("div",{className:"asakaa-column-header group",children:[jsxRuntime.jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:y(N()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxRuntime.jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.state==="exceeded"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),k.state==="warning"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),k.state==="approaching"&&jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),k.state==="ok"&&jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(w||g)&&jsxRuntime.jsx(Hl,{columnTitle:e.title,onRename:C=>w?.(e.id,C),onDelete:g?()=>g(e.id):void 0,isDeletable:b}),i&&jsxRuntime.jsx("button",{onClick:i,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),!d&&jsxRuntime.jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsxRuntime.jsx(sortable.SortableContext,{items:t.map(C=>C.id),strategy:sortable.verticalListSortingStrategy,children:t.length===0?n?n(e):jsxRuntime.jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsxRuntime.jsx("p",{children:"Drop cards here"})}):T?jsxRuntime.jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let G=t[C.index];return G?jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsxRuntime.jsx(er,{card:G,render:r,onClick:s,onUpdate:p,availableUsers:m,allCards:l})},G.id):null})}):t.map(C=>jsxRuntime.jsx(er,{card:C,render:r,onClick:s,onUpdate:p,availableUsers:m,allCards:l},C.id))})})]})});Xr.displayName="Column";function is({title:e,onSave:t,className:a}){let[r,o]=react.useState(false),[n,s]=react.useState(e),p=react.useRef(null);react.useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=n.trim();u&&u!==e?t(u):s(e),o(false);},l=u=>{u.key==="Enter"?m():u.key==="Escape"&&(s(e),o(false));};return r?jsxRuntime.jsx("input",{ref:p,type:"text",value:n,onChange:u=>s(u.target.value),onBlur:m,onKeyDown:l,className:y("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsxRuntime.jsx("h2",{className:y("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}var en=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function ja({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:n=false,compact:s=true}){let[p,m]=react.useState(false),[l,u]=react.useState(""),[c,d]=react.useState(false),[i,w]=react.useState(en[10]||"#3B82F6"),[g,b]=react.useState({top:0,left:0}),h=react.useRef(null),v=react.useRef(null),f=react.useRef(null),x=react.useRef(null),T=t.filter(C=>C.name.toLowerCase().includes(l.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===l.toLowerCase());react.useEffect(()=>{if(p&&v.current){let C=v.current.getBoundingClientRect();b({top:C.bottom+6,left:C.left});}},[p]),react.useEffect(()=>{let C=G=>{let F=G.target,J=h.current?.contains(F),K=f.current?.contains(F);!J&&!K&&(m(false),u(""),d(false));};if(p)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[p]),react.useEffect(()=>{p&&x.current&&x.current.focus();},[p]);let I=C=>{let G=e.some(F=>F.id===C.id);a(G?e.filter(F=>F.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!l.trim())){d(true);try{let C=await r(l.trim(),i);C&&(a([...e,C]),u(""),w(en[Math.floor(Math.random()*en.length)]||"#3B82F6"));}finally{d(false);}}},L=(C,G)=>{G.stopPropagation(),a(e.filter(F=>F.id!==C));},N={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxRuntime.jsxs("div",{ref:h,className:"relative",children:[jsxRuntime.jsxs("button",{ref:v,type:"button",onClick:()=>!n&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:N,disabled:n,children:[jsxRuntime.jsx(lucideReact.Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(C=>jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.id)),e.length>2&&jsxRuntime.jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsxRuntime.jsx("span",{children:"Agregar"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:f,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:g.top,left:g.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsxRuntime.jsx("input",{ref:x,type:"text",value:l,onChange:C=>u(C.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:C=>{C.key==="Enter"&&l.trim()&&!D&&r&&k();}})}),e.length>0&&jsxRuntime.jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsxRuntime.jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(C=>jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${C.color}20`,color:C.color},onClick:G=>L(C.id,G),children:[C.name,jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})]},C.id))})]}),jsxRuntime.jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(C=>{let G=e.some(F=>F.id===C.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>I(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:F=>{G||(F.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:F=>{G||(F.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsxRuntime.jsx("span",{className:"flex-1 text-left",children:C.name}),G&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:C.color}})]},C.id)}):l.trim()?jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsxRuntime.jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!D&&r&&jsxRuntime.jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2 mb-2",children:jsxRuntime.jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:en.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>w(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:i===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxRuntime.jsxs("button",{type:"button",onClick:k,disabled:c,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:i,color:"#FFFFFF",opacity:c?.7:1},children:[c?jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function ds({tag:e,onRemove:t,size:a="sm"}){return jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsxRuntime.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function jl({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(n=>jsxRuntime.jsx(ds,{tag:n,size:a},n.id)),o>0&&jsxRuntime.jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}function Yl(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let n=t.find(s=>s.id===o);return n||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description}}return e}function Ym(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds}}function ms({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:n="dark",locale:s="es",availableUsers:p=[],availableTags:m=[],onCreateTag:l,attachments:u=[],onUploadAttachments:c,onDeleteAttachment:d}){let i=n==="dark",w={textTertiary:i?"#6B7280":"#9CA3AF",textSecondary:i?"#9CA3AF":"#6B7280",textPrimary:i?"#FFFFFF":"#111827",borderLight:i?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:i?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:i?"#1A1D25":"#FFFFFF",bgSecondary:i?"#0F1117":"#F9FAFB",hoverBg:i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},g=e&&"title"in e&&!("name"in e),b=e,[h,v]=react.useState(e?Yl(e,p):null),[f,x]=react.useState(false),[T,D]=react.useState(false),[I,k]=react.useState(false),[L,N]=react.useState(null),[C,G]=react.useState(new Date),[F,J]=react.useState(false),[K,de]=react.useState(false),[ge,Te]=react.useState(false);react.useEffect(()=>{e&&v(Yl(e,p));},[e?.id,p]);let Ce=react.useCallback(U=>{v(U),g&&o&&b?o(Ym(U,b)):r&&r(U);},[g,b,o,r]),z=react.useCallback(()=>{x(false),D(false),k(false),N(null);},[]),B=react.useCallback((U,ae)=>{if(!h)return;let Me={...h,[U]:ae};Ce(Me);},[h,Ce]),$=react.useCallback(U=>{if(!h)return;let ae=h.progress||0;U==="completed"?ae=100:U==="in-progress"&&ae===0?ae=10:U==="todo"&&(ae=0);let Me={...h,status:U,progress:ae};Ce(Me),x(false);},[h,Ce]),P=react.useCallback((U,ae)=>{if(!h)return;let Me={...h,startDate:U,endDate:ae};Ce(Me);},[h,Ce]),Q=react.useCallback(()=>{let U=C.getFullYear(),ae=C.getMonth(),Me=new Date(U,ae,1),qe=new Date(U,ae+1,0).getDate(),Ke=Me.getDay(),O=[],re=new Date(U,ae,0).getDate();for(let fe=Ke-1;fe>=0;fe--)O.push({date:new Date(U,ae-1,re-fe),isCurrentMonth:false});for(let fe=1;fe<=qe;fe++)O.push({date:new Date(U,ae,fe),isCurrentMonth:true});let ce=42-O.length;for(let fe=1;fe<=ce;fe++)O.push({date:new Date(U,ae+1,fe),isCurrentMonth:false});return O},[C]),ee=react.useCallback(async U=>{if(U.preventDefault(),U.stopPropagation(),de(false),!h||!c)return;let ae=Array.from(U.dataTransfer.files);if(ae.length!==0){Te(true);try{await c(h.id,ae);}finally{Te(false);}}},[h,c]),H=react.useCallback(async U=>{if(!h||!c||!U.target.files)return;let ae=Array.from(U.target.files);if(ae.length!==0){Te(true);try{await c(h.id,ae);}finally{Te(false);}U.target.value="";}},[h,c]),De=react.useCallback(U=>{U.preventDefault(),U.stopPropagation(),de(true);},[]),Ee=react.useCallback(U=>{U.preventDefault(),U.stopPropagation(),de(false);},[]),Be=react.useCallback(U=>U<1024?`${U} B`:U<1024*1024?`${(U/1024).toFixed(1)} KB`:`${(U/(1024*1024)).toFixed(1)} MB`,[]),xe=react.useCallback(U=>U.startsWith("image/")?lucideReact.Image:U.includes("pdf")||U.includes("document")?lucideReact.FileText:lucideReact.File,[]);return !t||!h?null:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:y("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:y("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:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[s==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:h.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("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:y("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:y("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:a,className:y("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 U=h.progress===100?0:100,Me={...h,progress:U,status:U===100?"completed":"todo"};Ce(Me);},className:y("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",h.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:h.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:y("text-xl font-semibold flex-1",h.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:h.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:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{z(),x(!f);},className:y("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",h.progress===100||h.status==="completed"?"bg-green-500/20 text-green-400":h.progress&&h.progress>0||h.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:h.progress===100||h.status==="completed"?s==="es"?"COMPLETADO":"DONE":h.progress&&h.progress>0||h.status==="in-progress"?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>x(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("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:s==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:s==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:s==="es"?"Completado":"Done",color:"bg-green-500"}].map(U=>jsxRuntime.jsxs("button",{onClick:()=>$(U.id),className:y("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",h.status===U.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",U.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:U.label})]},U.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{z(),k(!I);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[h.assignees&&h.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[h.assignees.slice(0,3).map((U,ae)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:U.color||"#8B5CF6"},title:U.name,children:U.initials||U.name.slice(0,2).toUpperCase()},ae)),h.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",h.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",i?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:p.length>0?p.map(U=>{let ae=h.assignees?.some(Me=>Me.name===U.name);return jsxRuntime.jsxs("button",{onClick:()=>{let Me=h.assignees||[],_e;ae?_e=Me.filter(qe=>qe.name!==U.name):_e=[...Me,U],B("assignees",_e);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",ae&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:U.color||"#8B5CF6"},children:U.initials||U.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:y("flex-1",i?"text-white":"text-gray-900"),children:U.name}),ae&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},U.name)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",i?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{N(L?null:"start"),G(h.startDate||new Date);},className:y("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:[h.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),h.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End")]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>N(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("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:U=>U.stopPropagation(),children:[jsxRuntime.jsx("div",{className:y("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,ae=new Date(U);ae.setDate(U.getDate()+1);let Me=new Date(U);Me.setDate(U.getDate()+7);let _e=new Date(U);return _e.setDate(U.getDate()+14),[{label:s==="es"?"Hoy":"Today",date:U},{label:s==="es"?"Ma\xF1ana":"Tomorrow",date:ae},{label:s==="es"?"Pr\xF3xima semana":"Next week",date:Me},{label:s==="es"?"2 semanas":"2 weeks",date:_e}].map((qe,Ke)=>jsxRuntime.jsxs("button",{className:y("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:()=>{L==="start"?(P(qe.date,h.endDate),N("end")):(P(h.startDate,qe.date),N(null));},children:[jsxRuntime.jsx("span",{children:qe.label}),jsxRuntime.jsx("span",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:qe.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]},Ke))})()}),jsxRuntime.jsxs("div",{className:"p-4 w-[280px]",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:y("text-sm font-medium",i?"text-white":"text-gray-900"),children:L==="start"?s==="es"?"Fecha inicio":"Start date":s==="es"?"Fecha fin":"End date"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>G(new Date(C.getFullYear(),C.getMonth()-1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsxRuntime.jsx("span",{className:y("text-sm min-w-[100px] text-center",i?"text-white":"text-gray-900"),children:C.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>G(new Date(C.getFullYear(),C.getMonth()+1)),className:y("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(s==="es"?["L","M","M","J","V","S","D"]:["S","M","T","W","T","F","S"]).map((U,ae)=>jsxRuntime.jsx("div",{className:y("text-xs text-center py-1",i?"text-[#6B7280]":"text-gray-400"),children:U},ae))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:Q().map((U,ae)=>{let Me=U.date.toDateString()===new Date().toDateString(),_e=h.startDate?.toDateString()===U.date.toDateString(),qe=h.endDate?.toDateString()===U.date.toDateString(),Ke=h.startDate&&h.endDate&&U.date>=h.startDate&&U.date<=h.endDate;return jsxRuntime.jsx("button",{onClick:()=>{L==="start"?(P(U.date,h.endDate&&U.date>h.endDate?U.date:h.endDate),N("end")):(P(h.startDate&&U.date<h.startDate?U.date:h.startDate,U.date),N(null));},className:y("w-8 h-8 text-xs rounded-lg transition-colors",!U.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),U.isCurrentMonth&&(i?"text-white":"text-gray-900"),Me&&"ring-1 ring-blue-500",(_e||qe)&&"bg-blue-500 text-white",Ke&&!_e&&!qe&&(i?"bg-blue-500/20":"bg-blue-100"),i?"hover:bg-white/10":"hover:bg-gray-100"),children:U.date.getDate()},ae)})})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{z(),D(!T);},className:y("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",h.priority==="high"||h.priority==="urgent"?"bg-red-500/20 text-red-400":h.priority==="medium"?"bg-yellow-500/20 text-yellow-400":h.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:h.priority?h.priority==="high"||h.priority==="urgent"?s==="es"?"Alta":"High":h.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>D(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("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:s==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:s==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:s==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:s==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:s==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(U=>jsxRuntime.jsxs("button",{onClick:()=>{B("priority",U.id),D(false);},className:y("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",h.priority===U.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",U.color)}),jsxRuntime.jsx("span",{className:i?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",i?"text-white":"text-gray-900"),children:h.startDate&&h.endDate?`${Math.ceil((h.endDate.getTime()-h.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:h.progress||0,onChange:U=>{let ae=parseInt(U.target.value),Me=h.status;ae===100?Me="completed":ae>0?Me="in-progress":Me="todo";let _e={...h,progress:ae,status:Me};Ce(_e);},onBlur:()=>J(false),className:y("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:()=>J(true),className:y("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:y("h-full rounded-full transition-all",h.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${h.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[h.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(ja,{selectedTags:h.tags||[],availableTags:m,onChange:U=>{B("tags",U);},onCreateTag:l,theme:w})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:h.dependencies&&h.dependencies.length>0?`${h.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:y("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:h.description||"",onChange:U=>B("description",U.target.value),placeholder:s==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",i?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:y("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"}),s==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:s==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("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"}),s==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:s==="es"?"Subtareas":"Subtasks"}),h.subtasks&&h.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:h.subtasks.map(U=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",U.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:U.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",U.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:U.name})]},U.id))}),jsxRuntime.jsxs("button",{className:y("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"}),s==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxRuntime.jsxs("div",{className:y("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:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("button",{className:y("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"}),s==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:y("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:[s==="es"?"Adjuntos":"Attachments",u.length>0&&jsxRuntime.jsxs("span",{className:y("ml-2 text-xs font-normal",i?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:u.map(U=>{let ae=xe(U.type),Me=U.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",i?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Me&&U.thumbnailUrl?jsxRuntime.jsx("img",{src:U.thumbnailUrl,alt:U.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ae,{className:y("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:U.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",i?"text-white":"text-gray-900"),children:U.name}),jsxRuntime.jsx("p",{className:y("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:Be(U.size)})]}),d&&jsxRuntime.jsx("button",{onClick:()=>d(U.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",i?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:s==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},U.id)})}),jsxRuntime.jsxs("div",{onDragOver:De,onDragLeave:Ee,onDrop:ee,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",K?i?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ge&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:H,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!c||ge}),ge?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",K?"text-blue-500":i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:K?s==="es"?"Suelta los archivos aqu\xED":"Drop files here":s==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!c&&jsxRuntime.jsx("p",{className:y("text-xs mt-1",i?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-80 border-l flex flex-col",i?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",i?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:y("w-10 h-10 mb-3",i?"text-[#3B4252]":"text-gray-300")}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#6B7280]":"text-gray-500"),children:s==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsxRuntime.jsx("div",{className:y("p-4 border-t",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:y("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:s==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")}),jsxRuntime.jsx("button",{className:y("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600"),children:jsxRuntime.jsx(lucideReact.Send,{className:"w-4 h-4"})})]})})]})]})]})})}function gs(){let[e,t]=react.useState(()=>core.dragStore.getState());react.useEffect(()=>core.dragStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.dragStore.setState(r);},[]);return [e,a]}function fr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:n=[],className:s,style:p,isLoading:m,error:l,children:u,availableTags:c=[],onCreateTag:d}){let[i,w]=gs(),[g,b]=react.useState(null),h=o?.theme||"dark",v=h==="dark"||h==="neutral",f=v?"dark":"",x=react.useCallback((K,de)=>{t.onCardUpdate?.(K,de);},[t]),T=react.useCallback((K,de)=>{t.onColumnUpdate?.(K,{title:de});},[t]),D=react.useCallback(K=>{t.onColumnDelete?.(K);},[t]),I=["todo","in-progress","completed"],k=core$1.useSensors(core$1.useSensor(core$1.PointerSensor,{activationConstraint:{distance:8}}),core$1.useSensor(core$1.KeyboardSensor,{coordinateGetter:sortable.sortableKeyboardCoordinates})),L=react.useMemo(()=>{let K=new Map;return e.columns.forEach(de=>{let ge=de.cardIds.map(Te=>e.cards.find(Ce=>Ce.id===Te)).filter(Te=>Te!==void 0).sort((Te,Ce)=>Te.position-Ce.position);K.set(de.id,ge);}),K},[e.cards,e.columns]),N=react.useCallback(K=>{let{active:de}=K,ge=e.cards.find(Te=>Te.id===de.id);ge&&w({isDragging:true,draggedCardId:ge.id,sourceColumnId:ge.columnId,targetColumnId:ge.columnId});},[e.cards,w]),C=react.useCallback(K=>{let{active:de,over:ge}=K;if(!ge||!e.cards.find(z=>z.id===de.id))return;let Ce=null;ge.data.current?.type==="column"?Ce=ge.id:ge.data.current?.type==="card"&&(Ce=e.cards.find(B=>B.id===ge.id)?.columnId||null),Ce&&Ce!==i.targetColumnId&&w({...i,targetColumnId:Ce});},[e.cards,i,w]),G=react.useCallback(async K=>{let{active:de,over:ge}=K;if(w({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ge)return;let Te=e.cards.find($=>$.id===de.id);if(!Te)return;let Ce,z;if(ge.data.current?.type==="column"){Ce=ge.id;let $=L.get(Ce)||[];z=Zn($,0);}else {let $=e.cards.find(ee=>ee.id===ge.id);if(!$)return;Ce=$.columnId;let P=L.get(Ce)||[],Q=P.findIndex(ee=>ee.id===ge.id);z=Zn(P,Q);}let B=e.columns.find($=>$.id===Ce);if(B&&B.wipLimit&&B.wipLimitType==="hard"){let $=L.get(Ce)||[];if(Te.columnId!==Ce&&$.length>=B.wipLimit){t.onWipLimitExceeded?.(B,Te);return}}(Te.columnId!==Ce||Te.position!==z)&&await t.onCardMove?.(Te.id,Ce,z);},[e.cards,e.columns,L,t,w]),F=react.useCallback(K=>{b(K),a?.(K);},[a]),J=react.useCallback(K=>{t.onCardUpdate?.(K.id,K),b(K);},[t]);return m?jsxRuntime.jsx("div",{className:y("asakaa-board",f,s),style:p,children:jsxRuntime.jsx(iu,{columnCount:3})}):l?jsxRuntime.jsx("div",{className:y("asakaa-board",f,s),style:p,children:jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsxRuntime.jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxRuntime.jsxs(Dl,{themeName:h,children:[jsxRuntime.jsxs(core$1.DndContext,{sensors:k,collisionDetection:core$1.closestCorners,onDragStart:N,onDragOver:C,onDragEnd:G,children:[jsxRuntime.jsxs("div",{className:y("asakaa-board",f,s),style:p,"data-theme":h,children:[e.columns.sort((K,de)=>K.position-de.position).map(K=>{let de=L.get(K.id)||[],ge=!I.includes(K.id);return jsxRuntime.jsx(Xr,{column:K,cards:de,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:F,onCardUpdate:x,onColumnRename:T,onColumnDelete:D,isDeletable:ge,availableUsers:n,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},K.id)}),u]}),jsxRuntime.jsx(core$1.DragOverlay,{children:i.draggedCardId?jsxRuntime.jsx(er,{card:e.cards.find(K=>K.id===i.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsxRuntime.jsx(ms,{task:g,isOpen:!!g,onClose:()=>b(null),onCardUpdate:J,theme:v?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:n,availableTags:c,onCreateTag:d})]})}function iu({columnCount:e}){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((t,a)=>jsxRuntime.jsxs("div",{className:"asakaa-column",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx("div",{className:"asakaa-skeleton h-24"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-32"}),jsxRuntime.jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var mu={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},uu={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},gu={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},fu={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hu({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[n,s]=react.useState(false),p=react.useRef(null);react.useEffect(()=>{let l=u=>{p.current&&!p.current.contains(u.target)&&s(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]);let m=l=>{t(l),s(false);};return jsxRuntime.jsxs("div",{ref:p,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>s(!n),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:o||r.newTask}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxRuntime.jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function bu({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[n,s]=react.useState(false),[p,m]=react.useState(null),l=react.useRef(null);if(react.useEffect(()=>{let i=w=>{l.current&&!l.current.contains(w.target)&&s(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),!(a||r||o))return null;let c=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(i=>i.handler),d=async(i,w)=>{if(w){m(i);try{await w();}catch(g){console.error(`Export ${i} failed:`,g);}finally{m(null),s(false);}}};return jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>s(!n),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:n?e.accent:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?"#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:t.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:n?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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-44 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((i,w)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>d(i.id,i.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:w*.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:p===i.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"})}):i.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:i.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:i.description})]})]},i.id))})})})]})}function yu({onClick:e,label:t}){return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:e,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:t})]})}function hs({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:n=false,onExportCSV:s,onExportJSON:p,onExportExcel:m,translations:l}){let u=r==="dark"?mu:uu,c={...o==="es"?gu:fu,...l},d=s||p||m;return jsxRuntime.jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bu,{theme:u,t:c,onExportCSV:s,onExportJSON:p,onExportExcel:m}),t&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(n?jsxRuntime.jsx(hu,{columns:e,onSelect:t,theme:u,t:c,createTaskLabel:a}):jsxRuntime.jsx(yu,{onClick:()=>t(),label:a||c.newTask}))]})})}function ys({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[n,s]=react.useState(false),[p,m]=react.useState(""),l=react.useCallback(()=>{let d=p.trim();d&&(e(d),m(""),s(false));},[p,e]),u=react.useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(m(""),s(false));},[l]),c=react.useCallback(()=>{setTimeout(()=>{p.trim()||s(false);},150);},[p]);return n?jsxRuntime.jsx("div",{className:y("asakaa-add-column asakaa-add-column--editing",t),children:jsxRuntime.jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsxRuntime.jsx("input",{type:"text",value:p,onChange:d=>m(d.target.value),onKeyDown:u,onBlur:c,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxRuntime.jsxs("div",{className:"asakaa-add-column__actions",children:[jsxRuntime.jsx("button",{onClick:l,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsxRuntime.jsx("button",{onClick:()=>{m(""),s(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsxRuntime.jsx("div",{className:y("asakaa-add-column",t),children:jsxRuntime.jsxs("button",{onClick:()=>s(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function vs({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:n,disabled:s=false,theme:p="dark",locale:m="es"}){let[l,u]=react.useState(false),[c,d]=react.useState(false),[i,w]=react.useState(""),[g,b]=react.useState([]),[h,v]=react.useState(""),[f,x]=react.useState(""),[T,D]=react.useState(""),[I,k]=react.useState(false),[L,N]=react.useState(false),[C,G]=react.useState(false),F=react.useRef(null),J=react.useRef(null),K={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:n||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},de=react.useCallback(()=>{w(""),b([]),v(""),x(""),D(""),k(false),N(false),G(false),u(false);},[]);react.useEffect(()=>{l&&F.current&&F.current.focus();},[l]),react.useEffect(()=>{if(!l)return;let B=$=>{J.current&&!J.current.contains($.target)&&(i.trim()||de());};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[l,i,de]);let ge=react.useCallback(async()=>{let B=i.trim();if(!(!B||c)){d(true);try{await t({name:B,columnId:e,assigneeIds:g.length>0?g:void 0,startDate:h?new Date(h):void 0,endDate:f?new Date(f):void 0,priority:T||void 0}),w(""),b([]),v(""),x(""),D(""),k(!1),N(!1),G(!1),F.current?.focus();}catch($){console.error("Error creating card:",$);}finally{d(false);}}},[i,e,g,h,f,T,t,c]),Te=react.useCallback(B=>{B.key==="Enter"&&!B.shiftKey?(B.preventDefault(),ge()):B.key==="Escape"&&de();},[ge,de]),Ce=react.useCallback(B=>{b($=>$.includes(B)?$.filter(P=>P!==B):[...$,B]);},[]),z=p==="dark";return l?jsxRuntime.jsxs("div",{ref:J,className:y("rounded-lg overflow-hidden shadow-lg",z?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsx("input",{ref:F,type:"text",value:i,onChange:B=>w(B.target.value),onKeyDown:Te,placeholder:K.placeholder,disabled:c,className:y("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",z?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxRuntime.jsxs("button",{onClick:()=>k(!I),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",I||g.length>0?"bg-emerald-500/20 text-emerald-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.addAssignee,children:[jsxRuntime.jsxs("svg",{width:"14",height:"14",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"})]}),g.length>0&&jsxRuntime.jsx("span",{className:"ml-0.5",children:g.length})]}),jsxRuntime.jsx("button",{onClick:()=>N(!L),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",L||h||f?"bg-blue-500/20 text-blue-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.addDates,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsxRuntime.jsx("button",{onClick:()=>G(!C),className:y("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":z?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:K.addPriority,children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsxRuntime.jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{onClick:ge,disabled:!i.trim()||c,className:y("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:c?jsxRuntime.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):K.save})]})]}),I&&a.length>0&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(B=>jsxRuntime.jsxs("button",{onClick:()=>Ce(B.id),className:y("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",g.includes(B.id)?"bg-emerald-500 text-white":z?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[B.avatar?jsxRuntime.jsx("img",{src:B.avatar,alt:B.name,className:"w-4 h-4 rounded-full"}):jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",g.includes(B.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:B.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{children:B.name.split(" ")[0]})]},B.id))})}),L&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:K.startDate}),jsxRuntime.jsx("input",{type:"date",value:h,onChange:B=>v(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:y("block text-[10px] uppercase tracking-wide mb-1",z?"text-gray-500":"text-gray-400"),children:K.endDate}),jsxRuntime.jsx("input",{type:"date",value:f,onChange:B=>x(B.target.value),className:y("w-full px-2 py-1.5 rounded text-xs border",z?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsxRuntime.jsx("div",{className:y("px-3 pb-3 pt-0","border-t",z?"border-[#3a3a4e]":"border-gray-200"),children:jsxRuntime.jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(B=>jsxRuntime.jsx("button",{onClick:()=>D(T===B?"":B),className:y("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===B?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[B]} text-white`:z?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:K[B]},B))})})]}):jsxRuntime.jsxs("button",{onClick:()=>u(true),disabled:s,className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",z?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",s&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:K.buttonLabel})]})}var wo=class extends core.BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=client.createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsxRuntime.jsx(fr,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(n=>n.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,n)=>{r.toBlob(s=>{s?o(s):n(new Error("Failed to create PNG blob"));},"image/png");})}};function nd(e={}){return new wo(e)}var Qr=class extends react.Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:n}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${n||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(s){console.error("Error in error handler:",s);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:n,componentName:s}=this.props;return a&&r?n?n(r,this.resetError):jsxRuntime.jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:s?`Error in ${s}`:"Something went wrong"}),jsxRuntime.jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxRuntime.jsxs("details",{className:"mb-3",children:[jsxRuntime.jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsxRuntime.jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsxRuntime.jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function xs(e,t){let a=r=>jsxRuntime.jsx(Qr,{...t,children:jsxRuntime.jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function ws({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:n,onGeneratePlan:s,onPredictRisks:p,onOpenAIUsage:m,shortcut:l="k",className:u=""}){let[c,d]=react.useState(false),[i,w]=react.useState(""),[g,b]=react.useState("home"),[h,v]=react.useState(""),[f,x]=react.useState("");react.useEffect(()=>{let k=L=>{(L.metaKey||L.ctrlKey)&&L.key===l&&(L.preventDefault(),d(N=>!N)),L.key==="Escape"&&(d(false),b("home"),w(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),react.useEffect(()=>{c||(b("home"),w(""),v(""),x(""));},[c]);let T=react.useCallback(()=>{d(false);},[]),D=react.useCallback(k=>{let[L,N]=k.split(":");switch(L){case "create-card":b("create-card");break;case "create-card-in":v(N||"");break;case "navigate":N?(a?.(N),T()):b("navigate");break;case "search":r?.(i),T();break;case "priority":b("priority");break;case "set-priority":f&&N&&(o?.(f,N),T());break;case "assign":b("assign");break;case "assign-user":f&&N&&(n?.(f,N),T());break;case "ai":b("ai");break;case "ai-generate-plan":s?.(),T();break;case "ai-predict-risks":p?.(),T();break;case "ai-usage":m?.(),T();break;case "back":b("home");break;}},[i,f,t,a,r,o,n,s,p,m,T]),I=react.useCallback(()=>{h&&i.trim()&&(t?.(h,i.trim()),T());},[h,i,t,T]);return c?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"command-palette-overlay",onClick:T,children:jsxRuntime.jsx("div",{className:`command-palette ${u}`,onClick:k=>k.stopPropagation(),children:jsxRuntime.jsxs(cmdk.Command,{value:i,onValueChange:w,label:"Command Menu",children:[jsxRuntime.jsxs("div",{className:"command-palette-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx(cmdk.Command.Input,{placeholder:g==="create-card"&&h?"Type card title and press Enter...":g==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&g==="create-card"&&h&&I();}}),jsxRuntime.jsxs("div",{className:"command-palette-shortcut",children:[jsxRuntime.jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsxRuntime.jsx("kbd",{children:"K"})]})]}),jsxRuntime.jsxs(cmdk.Command.List,{className:"command-palette-list",children:[jsxRuntime.jsx(cmdk.Command.Empty,{className:"command-palette-empty",children:"No results found."}),g==="home"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",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"}),jsxRuntime.jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsxRuntime.jsx("span",{children:"Create Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 16 16 12 12 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsxRuntime.jsx("span",{children:"Navigate to Card"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"11",cy:"11",r:"8"}),jsxRuntime.jsx("path",{d:"m21 21-4.35-4.35"})]}),jsxRuntime.jsx("span",{children:"Search Cards"}),jsxRuntime.jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"AI Commands"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(L=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:L},L))})]},k.id))})]}),g==="create-card"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxRuntime.jsxs(cmdk.Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("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:"7",height:"18",rx:"1"})}),jsxRuntime.jsx("span",{children:k.title}),jsxRuntime.jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),g==="navigate"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsx(cmdk.Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let L=e.columns.find(N=>N.id===k.columnId);return jsxRuntime.jsxs(cmdk.Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsxRuntime.jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsxs("div",{className:"command-palette-item-content",children:[jsxRuntime.jsx("div",{children:k.title}),jsxRuntime.jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),k.labels&&k.labels.length>0&&jsxRuntime.jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(N=>jsxRuntime.jsx("span",{className:"command-palette-item-label",children:N},N))})]},k.id)})})]}),g==="ai"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsxRuntime.jsx("span",{children:"Back"})]}),jsxRuntime.jsxs(cmdk.Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("span",{children:"Generate Project Plan"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Predict Risks"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxRuntime.jsxs(cmdk.Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsxRuntime.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsxRuntime.jsx("span",{children:"AI Usage & Costs"}),jsxRuntime.jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer",children:[jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"\u2191"}),jsxRuntime.jsx("kbd",{children:"\u2193"}),jsxRuntime.jsx("span",{children:"Navigate"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Enter"}),jsxRuntime.jsx("span",{children:"Select"})]}),jsxRuntime.jsxs("div",{className:"command-palette-footer-hint",children:[jsxRuntime.jsx("kbd",{children:"Esc"}),jsxRuntime.jsx("span",{children:"Close"})]})]})]})})})}):null}function ld(e,t,a,r,o){let n=document.getElementById("attachment-lightbox-native");n&&n.remove();let s=document.createElement("div");s.id="attachment-lightbox-native",s.className="attachment-lightbox",s.style.cssText=`
|
|
6
6
|
position: fixed !important;
|
|
7
7
|
inset: 0 !important;
|
|
8
8
|
z-index: 2147483647 !important;
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
justify-content: center !important;
|
|
12
12
|
background: rgba(0, 0, 0, 0.95) !important;
|
|
13
13
|
cursor: pointer !important;
|
|
14
|
-
`;let
|
|
14
|
+
`;let p=document.createElement("img");p.src=e,p.alt=t,p.className="attachment-lightbox-image",p.style.cssText=`
|
|
15
15
|
max-width: 92vw !important;
|
|
16
16
|
max-height: 92vh !important;
|
|
17
17
|
object-fit: contain !important;
|
|
18
18
|
cursor: default !important;
|
|
19
|
-
`,
|
|
19
|
+
`,p.onclick=c=>c.stopPropagation();let m=document.createElement("div");m.className="attachment-lightbox-hint",m.textContent="Click anywhere or press ESC to close",m.style.cssText=`
|
|
20
20
|
position: absolute !important;
|
|
21
21
|
bottom: 24px !important;
|
|
22
22
|
left: 50% !important;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
font-size: 12px !important;
|
|
25
25
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
26
26
|
pointer-events: none !important;
|
|
27
|
-
`;let
|
|
27
|
+
`;let l=()=>{s.remove(),document.removeEventListener("keydown",u);},u=c=>{if(c.key==="Escape")l();else if(c.key==="ArrowLeft"&&a.length>1){let d=r>0?r-1:a.length-1;l(),o(d);}else if(c.key==="ArrowRight"&&a.length>1){let d=r<a.length-1?r+1:0;l(),o(d);}};if(s.onclick=l,document.addEventListener("keydown",u),a.length>1){let c=document.createElement("div");c.className="attachment-lightbox-dots",c.style.cssText=`
|
|
28
28
|
position: absolute !important;
|
|
29
29
|
bottom: 48px !important;
|
|
30
30
|
left: 50% !important;
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
padding: 8px 12px !important;
|
|
35
35
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
36
36
|
border-radius: 20px !important;
|
|
37
|
-
`,
|
|
37
|
+
`,c.onclick=w=>w.stopPropagation(),a.forEach((w,g)=>{let b=document.createElement("button");b.className=`attachment-lightbox-dot ${g===r?"active":""}`,b.style.cssText=`
|
|
38
38
|
width: 8px !important;
|
|
39
39
|
height: 8px !important;
|
|
40
40
|
border-radius: 50% !important;
|
|
41
|
-
background: ${
|
|
41
|
+
background: ${g===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
42
42
|
border: none !important;
|
|
43
43
|
padding: 0 !important;
|
|
44
44
|
cursor: pointer !important;
|
|
45
|
-
`,
|
|
45
|
+
`,b.onclick=h=>{h.stopPropagation(),l(),o(g);},c.appendChild(b);});let d=document.createElement("button");d.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',d.style.cssText=`
|
|
46
46
|
position: absolute !important;
|
|
47
47
|
left: 0 !important;
|
|
48
48
|
top: 0 !important;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
border: none !important;
|
|
56
56
|
cursor: pointer !important;
|
|
57
57
|
opacity: 0.5 !important;
|
|
58
|
-
`,
|
|
58
|
+
`,d.onmouseenter=()=>{d.style.opacity="1";},d.onmouseleave=()=>{d.style.opacity="0.5";},d.onclick=w=>{w.stopPropagation();let g=r>0?r-1:a.length-1;l(),o(g);};let i=document.createElement("button");i.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',i.style.cssText=`
|
|
59
59
|
position: absolute !important;
|
|
60
60
|
right: 0 !important;
|
|
61
61
|
top: 0 !important;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
border: none !important;
|
|
69
69
|
cursor: pointer !important;
|
|
70
70
|
opacity: 0.5 !important;
|
|
71
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=c=>{c.stopPropagation();let w=r<a.length-1?r+1:0;d(),o(w);},i.appendChild(s),i.appendChild(g),i.appendChild(f);}i.appendChild(m),i.appendChild(p),document.body.appendChild(i),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function vu(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function xu(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Ts(e){return e.startsWith("image/")}function Ha({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[i,m]=react.useState(false),[p,d]=react.useState(false),[l,s]=react.useState(null),g=react.useRef(null),f=react.useRef(e);f.current=e;let c=react.useCallback((v,B)=>{B.preventDefault(),B.stopPropagation();let S=f.current.filter(L=>Ts(L.type)),C=S.findIndex(L=>L.id===v.id),$=L=>{let q=f.current.filter(me=>Ts(me.type)),j=q[L];j&&ld(j.url,j.name,q,L,$);};ld(v.url,v.name,S,C,$);},[]),w=react.useCallback(v=>{let B=[],S=[];return e.length+v.length>n?(S.push(`Maximum ${n} files allowed`),{valid:B,errors:S}):(v.forEach(C=>{if(C.size/1048576>r){S.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(L=>C.type.match(L))){S.push(`${C.name} has invalid file type`);return}B.push(C);}),{valid:B,errors:S})},[e.length,n,r,o]),h=react.useCallback(async v=>{let{valid:B,errors:S}=w(v);if(S.length>0){s(S.join(", ")),setTimeout(()=>s(null),5e3);return}if(B.length!==0){d(true),s(null);try{await t?.(B);}catch(C){s(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>s(null),5e3);}finally{d(false);}}},[w,t]),k=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(true);},[]),u=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);},[]),y=react.useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),x=react.useCallback(v=>{v.preventDefault(),v.stopPropagation(),m(false);let B=Array.from(v.dataTransfer.files);h(B);},[h]),D=react.useCallback(v=>{let B=v.target.files?Array.from(v.target.files):[];h(B),g.current&&(g.current.value="");},[h]),T=react.useCallback(()=>{g.current?.click();},[]),M=react.useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${i?"dragging":""} ${p?"uploading":""}`,onDragEnter:k,onDragLeave:u,onDragOver:y,onDrop:x,onClick:T,children:[jsxRuntime.jsx("input",{ref:g,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:i?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",n," files"]})]})})]}),l&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:l})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(v=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ts(v.type)&&v.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>c(v,B),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:v.thumbnailUrl||v.url,alt:v.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:xu(v.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:vu(v.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>M(v.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},v.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:m=[],aiInsights:p=[],attachments:d=[],onAddComment:l,onDeleteComment:s,onUploadAttachments:g,onDeleteAttachment:f,onSuggestAssignee:c,onGenerateSubtasks:w,onEstimateEffort:h,currentUserId:k="user-1"}){let[u,y]=react.useState("details"),[x,D]=react.useState(false),[T,M]=react.useState({}),[v,B]=react.useState(""),[S,C]=react.useState(false),[$,L]=react.useState({});if(!t||!e)return null;let q=react.useCallback(()=>{D(false),M({}),y("details"),B(""),L({}),a();},[a]),j=react.useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),M({}),D(false));},[e.id,T,r]),me=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),q());},[e.id,o,q]),he=react.useCallback(()=>{l&&v.trim()&&(l(e.id,v.trim()),B(""));},[e.id,v,l]),W=react.useCallback(async()=>{if(c){C(true);try{let P=await c(e);L(X=>({...X,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{C(false);}}},[e,c]),te=react.useCallback(async()=>{if(w){C(true);try{let P=await w(e);L(X=>({...X,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{C(false);}}},[e,w]),F=react.useCallback(async()=>{if(h){C(true);try{let P=await h(e);L(X=>({...X,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{C(false);}}},[e,h]),I={...e,...T},R=n.filter(P=>I.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:q,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:T.title??I.title,onChange:P=>M({...T,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:I.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:j,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{D(false),M({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>D(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:me,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:q,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>y("details"),className:`card-detail-tab ${u==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>y("comments"),className:`card-detail-tab ${u==="comments"?"active":""}`,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 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",i.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("activity"),className:`card-detail-tab ${u==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",m.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:m.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("attachments"),className:`card-detail-tab ${u==="attachments"?"active":""}`,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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",d.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxRuntime.jsxs("button",{onClick:()=>y("ai"),className:`card-detail-tab ${u==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[u==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:T.description??I.description??"",onChange:P=>M({...T,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:I.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:T.assignedUserIds??I.assignedUserIds??[],onChange:P=>{let X=Array.from(P.target.selectedOptions,ee=>ee.value);M({...T,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:R.length>0?R.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:T.priority??I.priority??"",onChange:P=>M({...T,priority:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:I.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:I.labels&&I.labels.length>0?I.labels.map(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:I.startDate?new Date(I.startDate).toISOString().split("T")[0]:"",onChange:P=>M({...T,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:I.startDate?new Date(I.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:I.endDate?new Date(I.endDate).toISOString().split("T")[0]:"",onChange:P=>M({...T,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:I.endDate?new Date(I.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??I.estimatedTime??"",onChange:P=>M({...T,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:I.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:I.dependencies&&I.dependencies.length>0?I.dependencies.map(P=>{let X=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:I.createdAt?new Date(I.createdAt).toLocaleString():"Unknown"})]})]}),u==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:v,onChange:P=>B(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:he,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:i.length>0?i.map(P=>{let X=n.find(ee=>ee.id===P.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[X&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),s&&jsxRuntime.jsx("button",{onClick:()=>s(P.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:P.content})]},P.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),u==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:m.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:m.map(P=>{let X=n.find(ee=>ee.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:X?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),u==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(Ha,{cardId:e.id,attachments:d,onUpload:g?P=>g(e.id,P):void 0,onDelete:f,currentUserId:k,maxSizeMB:10,maxFiles:20})}),u==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:W,disabled:S||!c,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:te,disabled:S||!w,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:F,disabled:S||!h,className:"card-detail-ai-btn",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),$.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),$.assignees.map((P,X)=>{let ee=n.find(z=>z.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},X)})]}),$.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),$.subtasks.map((P,X)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},X))]}),$.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[$.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",($.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),p.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!$.assignees&&!$.subtasks&&!$.effort&&p.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function To({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:i=""}){let[m,p]=react.useState({top:0,left:0}),d=react.useRef(null),l=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let s=e.current.getBoundingClientRect(),g=window.innerHeight,f=window.innerWidth,c=4,w=s.left;w+o>f-10&&(w=f-o-10),w<10&&(w=10);let h=g-s.bottom,k=s.top,u;return h>=n+c?u=s.bottom+c:k>=n+c?u=s.top-n-c:h>=k?u=s.bottom+c:u=Math.max(10,s.top-n-c),{top:u,left:w}},[e,o,n]);return react.useEffect(()=>{t&&p(l());},[t,l]),react.useEffect(()=>{if(!t)return;let s=f=>{let c=f.target;d.current&&!d.current.contains(c)&&e.current&&!e.current.contains(c)&&a();},g=setTimeout(()=>{document.addEventListener("mousedown",s);},0);return ()=>{clearTimeout(g),document.removeEventListener("mousedown",s);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let s=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),a());};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,a]),t?jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{ref:d,className:`smart-popover ${i}`,style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ve={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:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#D21E24",todayLight:"rgba(210, 30, 36, 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"}};var Eu=["LOW","MEDIUM","HIGH","URGENT"],Pu=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:i=[],activities:m=[],onAddComment:p,onDeleteComment:d,currentUser:l,onAIGenerateDescription:s,onAICreateSubtasks:g,onAIFindSimilar:f,availableColumns:c=[],availableLabels:w=[],availableTags:h=[],onCreateTag:k,onUploadCoverImage:u,unsplashAccessKey:y,theme:x,onSubtasksChange:D,attachments:T=[],onUploadAttachments:M,onDeleteAttachment:v}){let B=Vr(),S=x||B?.themeName||"dark",[C,$]=react.useState(e),[L,q]=react.useState(false),[j,me]=react.useState(e?.subtasks||[]),[he,W]=react.useState(false),[te,F]=react.useState(""),[I,R]=react.useState(""),[P,X]=react.useState("all"),[ee,z]=react.useState(false),[ye,Se]=react.useState(false),[We,Te]=react.useState(false),[Xe,ze]=react.useState(false),[Qe,yt]=react.useState(false),[pt,dt]=react.useState(false),O=react.useRef(null),oe=react.useRef(null),ue=react.useRef(null),Ee=react.useRef(null),Ae=react.useRef(null),rt=react.useRef(null),wt=react.useRef(null),Be=react.useRef(null),ke=react.useRef(null),Pe=react.useRef(null),qt=react.useRef(null),it=react.useRef(null);react.useEffect(()=>{e&&!C?($({...e}),me(e.subtasks||[])):e&&C&&e.id!==C.id&&($({...e}),me(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let U=Z=>{let Fe=Z.target;Ee.current&&!Ee.current.contains(Fe)&&z(false),Ae.current&&!Ae.current.contains(Fe)&&Se(false),rt.current&&!rt.current.contains(Fe)&&Te(false),wt.current&&!wt.current.contains(Fe)&&ze(false);};if(ee||ye||We||Xe)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ee,ye,We,Xe]),react.useEffect(()=>{if(!t)return;let U=Z=>{let Fe=Z.target,kt=Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.isContentEditable;if(Z.key==="Escape"){Z.preventDefault(),ee||ye||We||Xe||Qe||pt?(z(false),Se(false),Te(false),ze(false),yt(false),dt(false)):kt||a();return}if(kt&&Z.key!=="Escape")return;let ot=Z.metaKey||Z.ctrlKey;switch(Z.key.toLowerCase()){case "s":Z.preventDefault(),z(true);break;case "a":Z.preventDefault(),Te(true);break;case "p":Z.preventDefault(),Se(true);break;case "l":Z.preventDefault(),ze(true);break;case "d":ot||(Z.preventDefault(),yt(true),setTimeout(()=>Be.current?.focus(),0));break;case "e":ot||(Z.preventDefault(),dt(true));break;case "i":Z.preventDefault(),q(true),setTimeout(()=>oe.current?.focus(),0);break;case "t":Z.preventDefault(),W(true);break;case "c":Z.preventDefault(),ue.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,ee,ye,We,Xe,Qe,pt]);let ta=react.useCallback(U=>{let Z=U.currentTarget.textContent?.trim()||"";if(C&&Z!==C.title){let Fe={...C,title:Z};$(Fe),r?.(C.id,{title:Z});}},[C,r]),H=react.useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=C?.title||"",U.currentTarget.blur());},[C]),re=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),q(false);},[C,e,r]),be=react.useCallback(U=>{if(C){let Z={...C,columnId:U};$(Z),r?.(C.id,{columnId:U}),z(false);}},[C,r]),tt=react.useCallback(U=>{if(C){let Z={...C,priority:U};$(Z),r?.(C.id,{priority:U}),Se(false);}},[C,r]),ie=react.useCallback(U=>{if(C){let Z=C.assignedUserIds||[],Fe=Z.includes(U)?Z.filter(ot=>ot!==U):[...Z,U],kt={...C,assignedUserIds:Fe};$(kt),r?.(C.id,{assignedUserIds:Fe});}},[C,r]),K=react.useCallback(U=>{if(C){let Z=C.labels||[],Fe=Z.includes(U)?Z.filter(ot=>ot!==U):[...Z,U],kt={...C,labels:Fe};$(kt),r?.(C.id,{labels:Fe});}},[C,r]),ae=react.useCallback(U=>{if(C){let Z={...C,tags:U};$(Z),r?.(C.id,{tags:U});}},[C,r]),Me=react.useCallback(U=>{if(C){let Z=U.target.value,Fe={...C,endDate:Z};$(Fe),r?.(C.id,{endDate:Z}),yt(false);}},[C,r]),le=react.useCallback(U=>{if(C){let Z={...C,estimatedTime:parseFloat(U)||0};$(Z),r?.(C.id,{estimatedTime:parseFloat(U)||0});}},[C,r]),Je=react.useCallback(()=>{if(te.trim()&&C){let U={id:`subtask-${Date.now()}`,title:te.trim(),completed:false,createdAt:new Date},Z=[...j,U];me(Z),F(""),W(false),D?.(C.id,Z);}},[te,j,C,D]),$e=react.useCallback(U=>{let Z=j.map(Fe=>Fe.id===U?{...Fe,completed:!Fe.completed,updatedAt:new Date}:Fe);me(Z),C&&D?.(C.id,Z);},[j,C,D]),Re=react.useCallback(U=>{let Z=j.filter(Fe=>Fe.id!==U);me(Z),C&&D?.(C.id,Z);},[j,C,D]),Le=react.useCallback(()=>{I.trim()&&C&&p&&(p(C.id,I.trim()),R(""));},[I,C,p]),Ne=react.useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),Le());},[Le]),_=U=>jsxRuntime.jsx(Du__default.default,{remarkPlugins:[Nu__default.default],rehypePlugins:[Su__default.default],components:{a:({node:Z,...Fe})=>jsxRuntime.jsx("a",{...Fe,target:"_blank",rel:"noopener noreferrer"})},children:U}),J=m.filter(U=>P==="comments"?U.type.includes("COMMENT"):P==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let De=C||e,_e=n.filter(U=>De.assignedUserIds?.includes(U.id)),Ue=j.filter(U=>U.completed).length;return jsxRuntime.jsx(nt,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":S,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:ta,onKeyDown:H,children:De.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>z(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:De.columnId||"No status"})]}),jsxRuntime.jsx(To,{triggerRef:ke,isOpen:ee,onClose:()=>z(false),width:250,estimatedHeight:200,children:(c.length>0?c:Pu.map(U=>({id:U,title:U}))).map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${De.columnId===U.id?"active":""}`,onClick:()=>be(U.id),children:U.title},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxRuntime.jsxs("button",{ref:Pe,className:"modal-v2-field",onClick:()=>Te(!We),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:_e.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:_e.map(U=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(To,{triggerRef:Pe,isOpen:We,onClose:()=>Te(false),width:280,estimatedHeight:300,children:n.map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${De.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>ie(U.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,De.assignedUserIds?.includes(U.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ae,children:[jsxRuntime.jsxs("button",{ref:qt,className:"modal-v2-field",onClick:()=>Se(!ye),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:De.priority||"None"})]}),jsxRuntime.jsxs(To,{triggerRef:qt,isOpen:ye,onClose:()=>Se(false),width:180,estimatedHeight:220,children:[Eu.map(U=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${De.priority===U?"active":""}`,onClick:()=>tt(U),children:U},U)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>tt(""),children:"None"})]})]}),h.length>0||k?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx($a,{selectedTags:De.tags||[],availableTags:h,onChange:ae,onCreateTag:k,theme:Ve[S]||Ve.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:wt,children:[jsxRuntime.jsxs("button",{ref:it,className:"modal-v2-field",onClick:()=>ze(!Xe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:De.labels&&De.labels.length>0?jsxRuntime.jsx("span",{children:De.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(To,{triggerRef:it,isOpen:Xe,onClose:()=>ze(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${De.labels?.includes(U)?"active":""}`,onClick:()=>K(U),children:[U,De.labels?.includes(U)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},U))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{yt(!Qe),setTimeout(()=>Be.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:De.endDate?new Date(De.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Be,type:"date",value:typeof De.endDate=="string"?De.endDate.split("T")[0]:De.endDate?(()=>{let U=new Date(De.endDate),Z=U.getUTCFullYear(),Fe=String(U.getUTCMonth()+1).padStart(2,"0"),kt=String(U.getUTCDate()).padStart(2,"0");return `${Z}-${Fe}-${kt}`})():"",onChange:Me,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>dt(!pt),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:De.estimatedTime?`${De.estimatedTime}h`:"Not set"})]}),pt&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:De.estimatedTime||"",onChange:U=>le(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>dt(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),L?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:De.description||"",onChange:U=>{if(C){let Z={...C,description:U.target.value};$(Z);}},onBlur:re,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>q(true),children:De.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(De.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),j.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[Ue,"/",j.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>W(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[j.map(U=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>$e(U.id),children:U.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:U.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Re(U.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},U.id)),he&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:te,onChange:U=>F(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Je(),U.key==="Escape"&&(W(false),F(""));},onBlur:Je,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(M||T.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),T.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:T.length})]}),jsxRuntime.jsx(Ha,{cardId:De.id,attachments:T,onUpload:M?U=>M(De.id,U):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="all"?"active":""}`,onClick:()=>X("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[l&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:l.color},children:l.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ue,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:I,onChange:U=>R(U.target.value),onKeyDown:Ne,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:Le,disabled:!I.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[J.map(U=>{let Z=n.find(kt=>kt.id===U.userId);if(U.type.includes("COMMENT")){let kt=i.find(ot=>ot.id===U.metadata?.commentId);return kt?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[Z&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:Z.color},children:Z.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Z?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:kt.content})]})]},U.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:Z?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:U.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),J.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function zu({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(i=>({...i,average:i.average??e.reduce((m,p)=>m+p.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(zu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((i,m)=>i+m.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((i,m)=>i+m.completed,0)/e.length).toFixed(1)})]}),o&&e.some(i=>i.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((i,m)=>i+(m.planned||0),0)})]})]})]})}function Ku({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),i=e[e.length-1]?.remaining||0,m=e[e.length-1]?.ideal||0,p=n>0?(n-i)/n*100:0,d=i<=m;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Ku,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:d?"#10B981":"#EF4444",fill:d?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:d?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:d?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:d?"#10B981":"#EF4444"},children:i})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:d?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:d?"#10B981":"#EF4444"},children:d?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ag={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function rg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let i=r+(o-r)*.5,m=e+i*Math.cos(-a*(Math.PI/180)),p=t+i*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:m,y:p,fill:"white",textAnchor:m>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function yd({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((p,d)=>p+d.value,0),i=e.map(p=>({...p,totalValue:n,color:p.color||ag[p.name]||bd[e.indexOf(p)%bd.length]})),m=i.map(p=>p.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:i,cx:"50%",cy:"50%",labelLine:false,label:o?rg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:i.map((p,d)=>jsxRuntime.jsx(recharts.Cell,{fill:m[d]},`cell-${d}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,d)=>{let l=d.payload,s=n>0?(l.value/n*100).toFixed(0):"0";return `${p} (${l.value} - ${s}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:i.map((p,d)=>jsxRuntime.jsx(recharts.Cell,{fill:m[d]},`cell-${d}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,d)=>d.value>p.value?d:p).name})]})]})]})}var nn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[i,m]=react.useState(false),[p,d]=react.useState(false),[l,s]=react.useState(false),[g,f]=react.useState(false);if(e.length===0)return null;let c=e.map(x=>x.id),w=x=>{r.onBulkUpdate?.(c,{priority:x}),m(false);},h=x=>{r.onBulkMove?.(c,x),d(false),a();},k=x=>{r.onBulkUpdate?.(c,{assignedUserIds:x}),s(false);},u=x=>{let D=new Set;e.forEach(M=>{M.labels?.forEach(v=>D.add(v));});let T=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(c,{labels:T}),f(false);},y=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(c),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!i),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),i&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(x),children:[jsxRuntime.jsx("span",{className:b("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!p),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),p&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>s(!l),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),l&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!g),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),g&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>u([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:y,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});nn.displayName="BulkOperationsToolbar";function lg(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,i,m,p,d;switch(t){case "assignee":let l=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);l.length>0?l.forEach(f=>{let c=a?.find(w=>w.id===f);i=`assignee-${f}`,m=c?.name||`User ${f}`,p=c?.color,d=c?.avatar,r.has(i)||r.set(i,{id:i,title:m,groupValue:f,cardIds:[],color:p,icon:d}),r.get(i).cardIds.push(o.id);}):(i="assignee-unassigned",m="Unassigned",p="#6b7280",d="\u{1F464}",r.has(i)||r.set(i,{id:i,title:m,groupValue:null,cardIds:[],color:p,icon:d}),r.get(i).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",i=`priority-${n}`;let g={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[n];m=g.title,p=g.color,r.has(i)||r.set(i,{id:i,title:m,groupValue:n,cardIds:[],color:p}),r.get(i).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{i=`label-${f}`,m=f,p="#6b7280",r.has(i)||r.set(i,{id:i,title:m,groupValue:f,cardIds:[],color:p}),r.get(i).cardIds.push(o.id);}):(i="label-none",m="No Labels",p="#6b7280",r.has(i)||r.set(i,{id:i,title:m,groupValue:null,cardIds:[],color:p}),r.get(i).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Fs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,i]=react.useState(new Set),m=react.useMemo(()=>lg(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=react.useCallback(d=>{i(l=>{let s=new Set(l);return s.has(d)?s.delete(d):s.add(d),s});},[]);return t.groupBy==="none"||m.length===0?jsxRuntime.jsx(lr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:b("asakaa-swimlane-view",o),children:[m.map(d=>{let l=n.has(d.id),s=e.cards.filter(f=>d.cardIds.includes(f.id)),g={...e,cards:s};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(d.id),style:{borderLeft:d.color?`4px solid ${d.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[d.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:d.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:d.color},children:d.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",d.cardIds.length," ",d.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":l?"Expand lane":"Collapse lane",children:l?"\u25B6":"\u25BC"})]}),!l&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(lr,{board:g,callbacks:r,availableUsers:a})})]},d.id)}),m.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ls=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Bs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null),m=Ls.find(d=>d.value===e)||Ls[0];react.useEffect(()=>{function d(l){n.current&&!n.current.contains(l.target)&&i.current&&!i.current.contains(l.target)&&o(false);}if(r)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let p=d=>{t(d),o(false);};return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:m.icon}),jsxRuntime.jsx("span",{children:m.label}),jsxRuntime.jsx("svg",{className:b("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:n,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Ls.map(d=>jsxRuntime.jsxs("button",{onClick:()=>p(d.value),className:b("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===d.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:d.label}),e===d.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:d.description})]})]},d.value))})]})]})}var Do=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function mg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(d=>e.key===d||e.code===d))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,i=o.shift?e.shiftKey:!e.shiftKey,m=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return n&&i&&m&&p}function Cd(e={}){let{shortcuts:t=Do,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let i=react.useCallback(p=>{o.current=[...o.current,p];},[]),m=react.useCallback(p=>{o.current=o.current.filter(d=>d.action!==p);},[]);return react.useEffect(()=>{function p(d){if(!n.current)return;let l=d.target;if(!((l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)&&d.key!=="Escape"&&!d.ctrlKey&&!d.metaKey)){for(let s of o.current)if(mg(d,s)){r&&d.preventDefault();let g=new CustomEvent("keyboard-action",{detail:s.action,bubbles:true,cancelable:true});window.dispatchEvent(g);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:i,unregisterShortcut:m,isEnabled:a}}function ug(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function gg(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function fg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=gg(e),r=t?ug(t):"";return a?`${a} + ${r}`:r}function hg(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Rs({shortcuts:e=Do,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function m(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),!o||!t)return null;let i=hg(e);return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(i).map(([m,p])=>p.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),m]}),jsxRuntime.jsx("div",{className:"space-y-3",children:p.map(d=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:d.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:fg(d)})]},d.action))})]},m))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Os=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
71
|
+
`,i.onmouseenter=()=>{i.style.opacity="1";},i.onmouseleave=()=>{i.style.opacity="0.5";},i.onclick=w=>{w.stopPropagation();let g=r<a.length-1?r+1:0;l(),o(g);},s.appendChild(c),s.appendChild(d),s.appendChild(i);}s.appendChild(p),s.appendChild(m),document.body.appendChild(s),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function Tu(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Du(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Ts(e){return e.startsWith("image/")}function qa({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:n=10}){let[s,p]=react.useState(false),[m,l]=react.useState(false),[u,c]=react.useState(null),d=react.useRef(null),i=react.useRef(e);i.current=e;let w=react.useCallback((k,L)=>{L.preventDefault(),L.stopPropagation();let N=i.current.filter(F=>Ts(F.type)),C=N.findIndex(F=>F.id===k.id),G=F=>{let J=i.current.filter(de=>Ts(de.type)),K=J[F];K&&ld(K.url,K.name,J,F,G);};ld(k.url,k.name,N,C,G);},[]),g=react.useCallback(k=>{let L=[],N=[];return e.length+k.length>n?(N.push(`Maximum ${n} files allowed`),{valid:L,errors:N}):(k.forEach(C=>{if(C.size/1048576>r){N.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(F=>C.type.match(F))){N.push(`${C.name} has invalid file type`);return}L.push(C);}),{valid:L,errors:N})},[e.length,n,r,o]),b=react.useCallback(async k=>{let{valid:L,errors:N}=g(k);if(N.length>0){c(N.join(", ")),setTimeout(()=>c(null),5e3);return}if(L.length!==0){l(true),c(null);try{await t?.(L);}catch(C){c(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>c(null),5e3);}finally{l(false);}}},[g,t]),h=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(true);},[]),v=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);},[]),f=react.useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);let L=Array.from(k.dataTransfer.files);b(L);},[b]),T=react.useCallback(k=>{let L=k.target.files?Array.from(k.target.files):[];b(L),d.current&&(d.current.value="");},[b]),D=react.useCallback(()=>{d.current?.click();},[]),I=react.useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxRuntime.jsxs("div",{className:"attachment-uploader",children:[jsxRuntime.jsxs("div",{className:`attachment-dropzone ${s?"dragging":""} ${m?"uploading":""}`,onDragEnter:h,onDragLeave:v,onDragOver:f,onDrop:x,onClick:D,children:[jsxRuntime.jsx("input",{ref:d,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:o?.join(",")}),jsxRuntime.jsx("div",{className:"attachment-dropzone-content",children:m?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"attachment-spinner"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsxRuntime.jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsxRuntime.jsx("p",{className:"attachment-dropzone-text",children:s?"Drop files here":"Drag & drop files here"}),jsxRuntime.jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxRuntime.jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",n," files"]})]})})]}),u&&jsxRuntime.jsxs("div",{className:"attachment-error",children:[jsxRuntime.jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsxRuntime.jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsxRuntime.jsx("div",{className:"attachment-list",children:e.map(k=>jsxRuntime.jsxs("div",{className:"attachment-item",children:[jsxRuntime.jsx("div",{className:"attachment-preview",children:Ts(k.type)&&k.url?jsxRuntime.jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:L=>w(k,L),title:"Click to view full size",children:[jsxRuntime.jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}),jsxRuntime.jsx("div",{className:"attachment-thumbnail-overlay",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsxRuntime.jsx("div",{className:"attachment-icon",children:Du(k.type)})}),jsxRuntime.jsxs("div",{className:"attachment-info",children:[jsxRuntime.jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxRuntime.jsxs("div",{className:"attachment-meta",children:[jsxRuntime.jsx("span",{className:"attachment-size",children:Tu(k.size)}),jsxRuntime.jsx("span",{className:"attachment-separator",children:"\u2022"}),jsxRuntime.jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsxRuntime.jsx("button",{onClick:()=>I(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Ds({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:p=[],aiInsights:m=[],attachments:l=[],onAddComment:u,onDeleteComment:c,onUploadAttachments:d,onDeleteAttachment:i,onSuggestAssignee:w,onGenerateSubtasks:g,onEstimateEffort:b,currentUserId:h="user-1"}){let[v,f]=react.useState("details"),[x,T]=react.useState(false),[D,I]=react.useState({}),[k,L]=react.useState(""),[N,C]=react.useState(false),[G,F]=react.useState({});if(!t||!e)return null;let J=react.useCallback(()=>{T(false),I({}),f("details"),L(""),F({}),a();},[a]),K=react.useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),I({}),T(false));},[e.id,D,r]),de=react.useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),J());},[e.id,o,J]),ge=react.useCallback(()=>{u&&k.trim()&&(u(e.id,k.trim()),L(""));},[e.id,k,u]),Te=react.useCallback(async()=>{if(w){C(true);try{let P=await w(e);F(Q=>({...Q,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{C(false);}}},[e,w]),Ce=react.useCallback(async()=>{if(g){C(true);try{let P=await g(e);F(Q=>({...Q,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{C(false);}}},[e,g]),z=react.useCallback(async()=>{if(b){C(true);try{let P=await b(e);F(Q=>({...Q,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{C(false);}}},[e,b]),B={...e,...D},$=n.filter(P=>B.assignedUserIds?.includes(P.id));return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"card-detail-overlay",onClick:J,children:jsxRuntime.jsxs("div",{className:"card-detail-modal",onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"card-detail-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-header-left",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsxRuntime.jsx("input",{type:"text",value:D.title??B.title,onChange:P=>I({...D,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsxRuntime.jsx("h2",{className:"card-detail-title",children:B.title})]}),jsxRuntime.jsxs("div",{className:"card-detail-header-actions",children:[x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:K,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsxRuntime.jsx("button",{onClick:()=>{T(false),I({});},className:"card-detail-btn",children:"Cancel"})]}):jsxRuntime.jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxRuntime.jsxs("button",{onClick:de,className:"card-detail-btn card-detail-btn-danger",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsxRuntime.jsx("button",{onClick:J,className:"card-detail-btn-close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-tabs",children:[jsxRuntime.jsxs("button",{onClick:()=>f("details"),className:`card-detail-tab ${v==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxRuntime.jsxs("button",{onClick:()=>f("comments"),className:`card-detail-tab ${v==="comments"?"active":""}`,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 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",s.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:s.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("activity"),className:`card-detail-tab ${v==="activity"?"active":""}`,children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("attachments"),className:`card-detail-tab ${v==="attachments"?"active":""}`,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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsxRuntime.jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxRuntime.jsxs("button",{onClick:()=>f("ai"),className:`card-detail-tab ${v==="ai"?"active":""}`,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsxRuntime.jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-content",children:[v==="details"&&jsxRuntime.jsxs("div",{className:"card-detail-details",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Description"}),x?jsxRuntime.jsx("textarea",{value:D.description??B.description??"",onChange:P=>I({...D,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsxRuntime.jsx("p",{className:"card-detail-text",children:B.description||"No description"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsxRuntime.jsx("select",{multiple:true,value:D.assignedUserIds??B.assignedUserIds??[],onChange:P=>{let Q=Array.from(P.target.selectedOptions,ee=>ee.value);I({...D,assignedUserIds:Q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:n.map(P=>jsxRuntime.jsx("option",{value:P.id,children:P.name},P.id))}):jsxRuntime.jsx("div",{className:"card-detail-users",children:$.length>0?$.map(P=>jsxRuntime.jsxs("div",{className:"card-detail-user",children:[jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsxRuntime.jsx("span",{children:P.name})]},P.id)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxRuntime.jsxs("select",{value:D.priority??B.priority??"",onChange:P=>I({...D,priority:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsxRuntime.jsx("option",{value:"",children:"None"}),jsxRuntime.jsx("option",{value:"LOW",children:"LOW"}),jsxRuntime.jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsxRuntime.jsx("option",{value:"HIGH",children:"HIGH"}),jsxRuntime.jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxRuntime.jsxs("div",{className:"card-detail-priority",children:[jsxRuntime.jsx("div",{className:"card-detail-priority-dot",style:{background:B.priority==="URGENT"?"#EF4444":B.priority==="HIGH"?"#F59E0B":B.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxRuntime.jsx("span",{children:B.priority||"None"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Labels"}),jsxRuntime.jsx("div",{className:"card-detail-labels",children:B.labels&&B.labels.length>0?B.labels.map(P=>jsxRuntime.jsx("span",{className:"card-detail-label-tag",children:P},P)):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section-row",children:[jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Start Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:B.startDate?new Date(B.startDate).toISOString().split("T")[0]:"",onChange:P=>I({...D,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.startDate?new Date(B.startDate).toLocaleDateString():"Not set"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsxRuntime.jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:B.endDate?new Date(B.endDate).toISOString().split("T")[0]:"",onChange:P=>I({...D,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.endDate?new Date(B.endDate).toLocaleDateString():"Not set"})]})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??B.estimatedTime??"",onChange:P=>I({...D,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsxRuntime.jsx("span",{className:"card-detail-text",children:B.estimatedTime||"Not estimated"})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsxRuntime.jsx("div",{className:"card-detail-dependencies",children:B.dependencies&&B.dependencies.length>0?B.dependencies.map(P=>{let Q=typeof P=="string"?P:P.taskId;return jsxRuntime.jsxs("span",{className:"card-detail-dependency",children:["Card #",Q.slice(-4)]},Q)}):jsxRuntime.jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxRuntime.jsxs("div",{className:"card-detail-section",children:[jsxRuntime.jsx("label",{className:"card-detail-label",children:"Created"}),jsxRuntime.jsx("span",{className:"card-detail-text",children:B.createdAt?new Date(B.createdAt).toLocaleString():"Unknown"})]})]}),v==="comments"&&jsxRuntime.jsxs("div",{className:"card-detail-comments",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-form",children:[jsxRuntime.jsx("textarea",{value:k,onChange:P=>L(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsxRuntime.jsx("button",{onClick:ge,disabled:!k.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsxRuntime.jsx("div",{className:"card-detail-comments-list",children:s.length>0?s.map(P=>{let Q=n.find(ee=>ee.id===P.authorId);return jsxRuntime.jsxs("div",{className:"card-detail-comment",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-header",children:[jsxRuntime.jsxs("div",{className:"card-detail-comment-author",children:[Q&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:Q.color},children:Q.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-comment-author-name",children:Q?.name||"Unknown"}),jsxRuntime.jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),c&&jsxRuntime.jsx("button",{onClick:()=>c(P.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsxRuntime.jsx("p",{className:"card-detail-comment-content",children:P.content})]},P.id)}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("p",{children:"No comments yet"}),jsxRuntime.jsx("span",{children:"Be the first to comment"})]})})]}),v==="activity"&&jsxRuntime.jsx("div",{className:"card-detail-activity",children:p.length>0?jsxRuntime.jsx("div",{className:"card-detail-activity-list",children:p.map(P=>{let Q=n.find(ee=>ee.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-activity-item",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxRuntime.jsxs("div",{className:"card-detail-activity-content",children:[jsxRuntime.jsxs("div",{className:"card-detail-activity-text",children:[jsxRuntime.jsx("strong",{children:Q?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxRuntime.jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsxRuntime.jsx("strong",{children:P.newValue})]})]}),jsxRuntime.jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)})}):jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntime.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})}),v==="attachments"&&jsxRuntime.jsx("div",{className:"card-detail-attachments",children:jsxRuntime.jsx(qa,{cardId:e.id,attachments:l,onUpload:d?P=>d(e.id,P):void 0,onDelete:i,currentUserId:h,maxSizeMB:10,maxFiles:20})}),v==="ai"&&jsxRuntime.jsxs("div",{className:"card-detail-ai",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-actions",children:[jsxRuntime.jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxRuntime.jsxs("button",{onClick:Te,disabled:N||!w,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxRuntime.jsxs("button",{onClick:Ce,disabled:N||!g,className:"card-detail-ai-btn",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsxRuntime.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsxRuntime.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsxRuntime.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxRuntime.jsxs("button",{onClick:z,disabled:N||!b,className:"card-detail-ai-btn",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),G.assignees&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map((P,Q)=>{let ee=n.find(H=>H.id===P.userId);return jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsxRuntime.jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsxRuntime.jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxRuntime.jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},Q)})]}),G.subtasks&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map((P,Q)=>jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask",children:[jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsxRuntime.jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxRuntime.jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},Q))]}),G.effort&&jsxRuntime.jsxs("div",{className:"card-detail-ai-results",children:[jsxRuntime.jsx("h4",{children:"Effort Estimate"}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort",children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-hours",children:[G.effort.hours," hours"]}),jsxRuntime.jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insights",children:[jsxRuntime.jsx("h4",{children:"AI Insights"}),m.map(P=>jsxRuntime.jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-header",children:[jsxRuntime.jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsxRuntime.jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsxRuntime.jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxRuntime.jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&m.length===0&&jsxRuntime.jsxs("div",{className:"card-detail-empty-state",children:[jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12"})]}),jsxRuntime.jsx("p",{children:"AI Suggestions"}),jsxRuntime.jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function To({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:n=300,className:s=""}){let[p,m]=react.useState({top:0,left:0}),l=react.useRef(null),u=react.useCallback(()=>{if(!e.current)return {top:0,left:0};let c=e.current.getBoundingClientRect(),d=window.innerHeight,i=window.innerWidth,w=4,g=c.left;g+o>i-10&&(g=i-o-10),g<10&&(g=10);let b=d-c.bottom,h=c.top,v;return b>=n+w?v=c.bottom+w:h>=n+w?v=c.top-n-w:b>=h?v=c.bottom+w:v=Math.max(10,c.top-n-w),{top:v,left:g}},[e,o,n]);return react.useEffect(()=>{t&&m(u());},[t,u]),react.useEffect(()=>{if(!t)return;let c=i=>{let w=i.target;l.current&&!l.current.contains(w)&&e.current&&!e.current.contains(w)&&a();},d=setTimeout(()=>{document.addEventListener("mousedown",c);},0);return ()=>{clearTimeout(d),document.removeEventListener("mousedown",c);}},[t,a,e]),react.useEffect(()=>{if(!t)return;let c=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a());};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),t?jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{ref:l,className:`smart-popover ${s}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Ve={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:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#D21E24",todayLight:"rgba(210, 30, 36, 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"}};var Fu=["LOW","MEDIUM","HIGH","URGENT"],Lu=["todo","in-progress","review","done"];function Es({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:n=[],comments:s=[],activities:p=[],onAddComment:m,onDeleteComment:l,currentUser:u,onAIGenerateDescription:c,onAICreateSubtasks:d,onAIFindSimilar:i,availableColumns:w=[],availableLabels:g=[],availableTags:b=[],onCreateTag:h,onUploadCoverImage:v,unsplashAccessKey:f,theme:x,onSubtasksChange:T,attachments:D=[],onUploadAttachments:I,onDeleteAttachment:k}){let L=Kr(),N=x||L?.themeName||"dark",[C,G]=react.useState(e),[F,J]=react.useState(false),[K,de]=react.useState(e?.subtasks||[]),[ge,Te]=react.useState(false),[Ce,z]=react.useState(""),[B,$]=react.useState(""),[P,Q]=react.useState("all"),[ee,H]=react.useState(false),[De,Ee]=react.useState(false),[Be,xe]=react.useState(false),[U,ae]=react.useState(false),[Me,_e]=react.useState(false),[qe,Ke]=react.useState(false),O=react.useRef(null),re=react.useRef(null),ce=react.useRef(null),fe=react.useRef(null),Ae=react.useRef(null),ot=react.useRef(null),kt=react.useRef(null),Le=react.useRef(null),ke=react.useRef(null),Ie=react.useRef(null),Zt=react.useRef(null),vt=react.useRef(null);react.useEffect(()=>{e&&!C?(G({...e}),de(e.subtasks||[])):e&&C&&e.id!==C.id&&(G({...e}),de(e.subtasks||[]));},[e,C]),react.useEffect(()=>{let R=W=>{let Ne=W.target;fe.current&&!fe.current.contains(Ne)&&H(false),Ae.current&&!Ae.current.contains(Ne)&&Ee(false),ot.current&&!ot.current.contains(Ne)&&xe(false),kt.current&&!kt.current.contains(Ne)&&ae(false);};if(ee||De||Be||U)return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[ee,De,Be,U]),react.useEffect(()=>{if(!t)return;let R=W=>{let Ne=W.target,et=Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.isContentEditable;if(W.key==="Escape"){W.preventDefault(),ee||De||Be||U||Me||qe?(H(false),Ee(false),xe(false),ae(false),_e(false),Ke(false)):et||a();return}if(et&&W.key!=="Escape")return;let $e=W.metaKey||W.ctrlKey;switch(W.key.toLowerCase()){case "s":W.preventDefault(),H(true);break;case "a":W.preventDefault(),xe(true);break;case "p":W.preventDefault(),Ee(true);break;case "l":W.preventDefault(),ae(true);break;case "d":$e||(W.preventDefault(),_e(true),setTimeout(()=>Le.current?.focus(),0));break;case "e":$e||(W.preventDefault(),Ke(true));break;case "i":W.preventDefault(),J(true),setTimeout(()=>re.current?.focus(),0);break;case "t":W.preventDefault(),Te(true);break;case "c":W.preventDefault(),ce.current?.focus();break}};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,a,ee,De,Be,U,Me,qe]);let sa=react.useCallback(R=>{let W=R.currentTarget.textContent?.trim()||"";if(C&&W!==C.title){let Ne={...C,title:W};G(Ne),r?.(C.id,{title:W});}},[C,r]),Na=react.useCallback(R=>{R.key==="Enter"&&(R.preventDefault(),R.currentTarget.blur()),R.key==="Escape"&&(R.preventDefault(),R.currentTarget.textContent=C?.title||"",R.currentTarget.blur());},[C]),Oe=react.useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),J(false);},[C,e,r]),Ue=react.useCallback(R=>{if(C){let W={...C,columnId:R};G(W),r?.(C.id,{columnId:R}),H(false);}},[C,r]),qt=react.useCallback(R=>{if(C){let W={...C,priority:R};G(W),r?.(C.id,{priority:R}),Ee(false);}},[C,r]),he=react.useCallback(R=>{if(C){let W=C.assignedUserIds||[],Ne=W.includes(R)?W.filter($e=>$e!==R):[...W,R],et={...C,assignedUserIds:Ne};G(et),r?.(C.id,{assignedUserIds:Ne});}},[C,r]),Ge=react.useCallback(R=>{if(C){let W=C.labels||[],Ne=W.includes(R)?W.filter($e=>$e!==R):[...W,R],et={...C,labels:Ne};G(et),r?.(C.id,{labels:Ne});}},[C,r]),Fe=react.useCallback(R=>{if(C){let W={...C,tags:R};G(W),r?.(C.id,{tags:R});}},[C,r]),tt=react.useCallback(R=>{if(C){let W=R.target.value,Ne={...C,endDate:W};G(Ne),r?.(C.id,{endDate:W}),_e(false);}},[C,r]),Xe=react.useCallback(R=>{if(C){let W={...C,estimatedTime:parseFloat(R)||0};G(W),r?.(C.id,{estimatedTime:parseFloat(R)||0});}},[C,r]),wt=react.useCallback(()=>{if(Ce.trim()&&C){let R={id:`subtask-${Date.now()}`,title:Ce.trim(),completed:false,createdAt:new Date},W=[...K,R];de(W),z(""),Te(false),T?.(C.id,W);}},[Ce,K,C,T]),st=react.useCallback(R=>{let W=K.map(Ne=>Ne.id===R?{...Ne,completed:!Ne.completed,updatedAt:new Date}:Ne);de(W),C&&T?.(C.id,W);},[K,C,T]),Qe=react.useCallback(R=>{let W=K.filter(Ne=>Ne.id!==R);de(W),C&&T?.(C.id,W);},[K,C,T]),A=react.useCallback(()=>{B.trim()&&C&&m&&(m(C.id,B.trim()),$(""));},[B,C,m]),ue=react.useCallback(R=>{(R.metaKey||R.ctrlKey)&&R.key==="Enter"&&(R.preventDefault(),A());},[A]),_=R=>jsxRuntime.jsx(Mu__default.default,{remarkPlugins:[Au__default.default],rehypePlugins:[Iu__default.default],components:{a:({node:W,...Ne})=>jsxRuntime.jsx("a",{...Ne,target:"_blank",rel:"noopener noreferrer"})},children:R}),Z=p.filter(R=>P==="comments"?R.type.includes("COMMENT"):P==="history"?!R.type.includes("COMMENT"):true);if(!t||!e)return null;let ve=C||e,Y=n.filter(R=>ve.assignedUserIds?.includes(R.id)),ne=K.filter(R=>R.completed).length;return jsxRuntime.jsx(it,{children:jsxRuntime.jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsxs("div",{className:"modal-v2-container",onClick:R=>R.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxRuntime.jsxs("header",{className:"modal-v2-header",children:[jsxRuntime.jsx("h1",{id:"modal-title",ref:O,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:Na,children:ve.title}),jsxRuntime.jsxs("p",{className:"modal-v2-ai-prompt",children:[jsxRuntime.jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsxRuntime.jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxRuntime.jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-metadata",children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:fe,children:[jsxRuntime.jsxs("button",{ref:ke,className:"modal-v2-field",onClick:()=>H(!ee),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"10"}),jsxRuntime.jsx("path",{d:"M12 6v6l4 2"})]}),jsxRuntime.jsx("span",{children:"Status"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ve.columnId||"No status"})]}),jsxRuntime.jsx(To,{triggerRef:ke,isOpen:ee,onClose:()=>H(false),width:250,estimatedHeight:200,children:(w.length>0?w:Lu.map(R=>({id:R,title:R}))).map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item ${ve.columnId===R.id?"active":""}`,onClick:()=>Ue(R.id),children:R.title},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:ot,children:[jsxRuntime.jsxs("button",{ref:Ie,className:"modal-v2-field",onClick:()=>xe(!Be),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsx("span",{children:"Assignees"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:Y.length>0?jsxRuntime.jsx("div",{className:"modal-v2-avatars",children:Y.map(R=>jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:R.color},title:R.name,children:R.initials},R.id))}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(To,{triggerRef:Ie,isOpen:Be,onClose:()=>xe(false),width:280,estimatedHeight:300,children:n.map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.assignedUserIds?.includes(R.id)?"active":""}`,onClick:()=>he(R.id),children:[jsxRuntime.jsx("div",{className:"modal-v2-avatar-small",style:{background:R.color},children:R.initials}),R.name,ve.assignedUserIds?.includes(R.id)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},R.id))})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:Ae,children:[jsxRuntime.jsxs("button",{ref:Zt,className:"modal-v2-field",onClick:()=>Ee(!De),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsxRuntime.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsxRuntime.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsxRuntime.jsx("span",{children:"Priority"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ve.priority||"None"})]}),jsxRuntime.jsxs(To,{triggerRef:Zt,isOpen:De,onClose:()=>Ee(false),width:180,estimatedHeight:220,children:[Fu.map(R=>jsxRuntime.jsx("button",{className:`modal-v2-popover-item priority-${R.toLowerCase()} ${ve.priority===R?"active":""}`,onClick:()=>qt(R),children:R},R)),jsxRuntime.jsx("button",{className:"modal-v2-popover-item",onClick:()=>qt(""),children:"None"})]})]}),b.length>0||h?jsxRuntime.jsx("div",{className:"modal-v2-field-wrapper",children:jsxRuntime.jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Etiquetas"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:jsxRuntime.jsx(ja,{selectedTags:ve.tags||[],availableTags:b,onChange:Fe,onCreateTag:h,theme:Ve[N]||Ve.dark})})]})}):jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",ref:kt,children:[jsxRuntime.jsxs("button",{ref:vt,className:"modal-v2-field",onClick:()=>ae(!U),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsx("span",{children:"Labels"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ve.labels&&ve.labels.length>0?jsxRuntime.jsx("span",{children:ve.labels.join(", ")}):jsxRuntime.jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsxRuntime.jsx(To,{triggerRef:vt,isOpen:U,onClose:()=>ae(false),width:220,estimatedHeight:200,children:(g.length>0?g:["Bug","Feature","Enhancement","Documentation"]).map(R=>jsxRuntime.jsxs("button",{className:`modal-v2-popover-item ${ve.labels?.includes(R)?"active":""}`,onClick:()=>Ge(R),children:[R,ve.labels?.includes(R)&&jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})]},R))})]}),jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>{_e(!Me),setTimeout(()=>Le.current?.showPicker?.(),0);},children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsxRuntime.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsxRuntime.jsx("span",{children:"Due Date"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ve.endDate?new Date(ve.endDate).toLocaleDateString():"Not set"}),jsxRuntime.jsx("input",{ref:Le,type:"date",value:typeof ve.endDate=="string"?ve.endDate.split("T")[0]:ve.endDate?(()=>{let R=new Date(ve.endDate),W=R.getUTCFullYear(),Ne=String(R.getUTCMonth()+1).padStart(2,"0"),et=String(R.getUTCDate()).padStart(2,"0");return `${W}-${Ne}-${et}`})():"",onChange:tt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxRuntime.jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxRuntime.jsxs("button",{className:"modal-v2-field",onClick:()=>Ke(!qe),children:[jsxRuntime.jsxs("div",{className:"modal-v2-field-label",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:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx("span",{children:"Estimated Time"}),jsxRuntime.jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsxRuntime.jsx("div",{className:"modal-v2-field-value",children:ve.estimatedTime?`${ve.estimatedTime}h`:"Not set"})]}),qe&&jsxRuntime.jsx("div",{className:"modal-v2-popover",children:jsxRuntime.jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ve.estimatedTime||"",onChange:R=>Xe(R.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ke(false)})})]})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsxRuntime.jsx("h2",{children:"Description"})]}),F?jsxRuntime.jsx("textarea",{className:"modal-v2-textarea",value:ve.description||"",onChange:R=>{if(C){let W={...C,description:R.target.value};G(W);}},onBlur:Oe,placeholder:"Add a detailed description...",autoFocus:true}):jsxRuntime.jsx("div",{className:"modal-v2-content",onClick:()=>J(true),children:ve.description?jsxRuntime.jsx("div",{className:"modal-v2-markdown",children:_(ve.description)}):jsxRuntime.jsxs("p",{className:"modal-v2-placeholder",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsxRuntime.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M9 11l3 3L22 4"}),jsxRuntime.jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsxRuntime.jsx("h2",{children:"Subtasks"}),K.length>0&&jsxRuntime.jsxs("span",{className:"modal-v2-count",children:[ne,"/",K.length]}),jsxRuntime.jsxs("button",{className:"modal-v2-add-button",onClick:()=>Te(true),children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsxRuntime.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-subtasks",children:[K.map(R=>jsxRuntime.jsxs("div",{className:`modal-v2-subtask ${R.completed?"completed":""}`,children:[jsxRuntime.jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>st(R.id),children:R.completed?jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsxRuntime.jsx("span",{className:"modal-v2-subtask-title",children:R.title}),jsxRuntime.jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Qe(R.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},R.id)),ge&&jsxRuntime.jsx("div",{className:"modal-v2-subtask-input-row",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Subtask title...",value:Ce,onChange:R=>z(R.target.value),onKeyDown:R=>{R.key==="Enter"&&wt(),R.key==="Escape"&&(Te(false),z(""));},onBlur:wt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(I||D.length>0)&&jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsx("h2",{children:"Attachments"}),D.length>0&&jsxRuntime.jsx("span",{className:"modal-v2-count",children:D.length})]}),jsxRuntime.jsx(qa,{cardId:ve.id,attachments:D,onUpload:I?R=>I(ve.id,R):void 0,onDelete:k,maxSizeMB:10,maxFiles:20})]}),jsxRuntime.jsxs("section",{className:"modal-v2-section",children:[jsxRuntime.jsxs("div",{className:"modal-v2-section-header",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsxRuntime.jsx("h2",{children:"Activity"}),jsxRuntime.jsxs("div",{className:"modal-v2-filters",children:[jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="all"?"active":""}`,onClick:()=>Q("all"),children:"All"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="comments"?"active":""}`,onClick:()=>Q("comments"),children:"Comments"}),jsxRuntime.jsx("button",{className:`modal-v2-filter ${P==="history"?"active":""}`,onClick:()=>Q("history"),children:"History"})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsxRuntime.jsx("textarea",{ref:ce,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:B,onChange:R=>$(R.target.value),onKeyDown:ue,rows:1}),jsxRuntime.jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxRuntime.jsxs("div",{className:"modal-v2-toolbar-left",children:[jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",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.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsxRuntime.jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsxRuntime.jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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:"10"}),jsxRuntime.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsxRuntime.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsxRuntime.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsxRuntime.jsx("button",{className:"modal-v2-send-button",onClick:A,disabled:!B.trim(),children:"Send"})]})]})]}),jsxRuntime.jsxs("div",{className:"modal-v2-timeline",children:[Z.map(R=>{let W=n.find(et=>et.id===R.userId);if(R.type.includes("COMMENT")){let et=s.find($e=>$e.id===R.metadata?.commentId);return et?jsxRuntime.jsxs("div",{className:"modal-v2-activity-item comment-item",children:[W&&jsxRuntime.jsx("div",{className:"modal-v2-avatar",style:{background:W.color},children:W.initials}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-activity-header",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:W?.name||"Unknown"}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]}),jsxRuntime.jsx("div",{className:"modal-v2-comment-body",children:et.content})]})]},R.id):null}return jsxRuntime.jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-icon",children:[R.type.includes("CREATED")&&"\u2795",R.type.includes("UPDATED")&&"\u270F\uFE0F",R.type.includes("MOVED")&&"\u27A1\uFE0F",R.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",R.type.includes("ASSIGNED")&&"\u{1F464}",R.type.includes("PRIORITY")&&"\u{1F3AF}",R.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxRuntime.jsxs("div",{className:"modal-v2-activity-content",children:[jsxRuntime.jsxs("div",{className:"modal-v2-history-text",children:[jsxRuntime.jsx("span",{className:"modal-v2-activity-user",children:W?.name||"Unknown"})," ",R.type.replace(/_/g," ").toLowerCase(),R.newValue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" to ",jsxRuntime.jsx("strong",{children:R.newValue})]})]}),jsxRuntime.jsx("span",{className:"modal-v2-activity-time",children:new Date(R.timestamp).toLocaleString()})]})]},R.id)}),Z.length===0&&jsxRuntime.jsxs("div",{className:"modal-v2-empty",children:[jsxRuntime.jsx("p",{children:"No activity yet"}),jsxRuntime.jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Gu({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," cards"]},r))]})}function Ms({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let n=e.map(s=>({...s,average:s.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(recharts.LineChart,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Gu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((s,p)=>s+p.completed,0)})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((s,p)=>s+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(s=>s.planned)&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((s,p)=>s+(p.planned||0),0)})]})]})]})}function Zu({active:e,payload:t}){return !e||!t||!t.length?null:jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsxRuntime.jsx("strong",{children:a.value})," tasks"]},r))]})}function As({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let n=r??(e[0]?.ideal||e[0]?.remaining||0),s=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=n>0?(n-s)/n*100:0,l=s<=p;return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:a,children:jsxRuntime.jsxs(o?recharts.AreaChart:recharts.LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(Zu,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsxRuntime.jsx(recharts.Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxRuntime.jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:s})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Status"}),jsxRuntime.jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ig={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},bd=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function lg({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:n}){let s=r+(o-r)*.5,p=e+s*Math.cos(-a*(Math.PI/180)),m=t+s*Math.sin(-a*(Math.PI/180));return n<.05?null:jsxRuntime.jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(n*100).toFixed(0)}%`})}function yd({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxRuntime.jsxs("div",{className:"chart-tooltip",children:[jsxRuntime.jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsxRuntime.jsx("strong",{children:a.value})]}),jsxRuntime.jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxRuntime.jsxs("strong",{children:[o,"%"]})]})]})}function Is({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let n=e.reduce((m,l)=>m+l.value,0),s=e.map(m=>({...m,totalValue:n,color:m.color||ig[m.name]||bd[e.indexOf(m)%bd.length]})),p=s.map(m=>m.color);return jsxRuntime.jsxs("div",{className:"chart-container",children:[t&&jsxRuntime.jsx("h3",{className:"chart-title",children:t}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxRuntime.jsxs(recharts.PieChart,{children:[jsxRuntime.jsx(recharts.Pie,{data:s,cx:"50%",cy:"50%",labelLine:false,label:o?lg:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:s.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:p[l]},`cell-${l}`))}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,l)=>{let u=l.payload,c=n>0?(u.value/n*100).toFixed(0):"0";return `${m} (${u.value} - ${c}%)`}})]}):jsxRuntime.jsxs(recharts.BarChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsxRuntime.jsx(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsxRuntime.jsx(recharts.Tooltip,{content:jsxRuntime.jsx(yd,{})}),jsxRuntime.jsx(recharts.Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsxRuntime.jsx(recharts.Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:s.map((m,l)=>jsxRuntime.jsx(recharts.Cell,{fill:p[l]},`cell-${l}`))})]})}),jsxRuntime.jsxs("div",{className:"chart-stats",children:[jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:n})]}),jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Categories"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxRuntime.jsxs("div",{className:"chart-stat",children:[jsxRuntime.jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsxRuntime.jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,l)=>l.value>m.value?l:m).name})]})]})]})}var nn=react.memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:n=[]})=>{let[s,p]=react.useState(false),[m,l]=react.useState(false),[u,c]=react.useState(false),[d,i]=react.useState(false);if(e.length===0)return null;let w=e.map(x=>x.id),g=x=>{r.onBulkUpdate?.(w,{priority:x}),p(false);},b=x=>{r.onBulkMove?.(w,x),l(false),a();},h=x=>{r.onBulkUpdate?.(w,{assignedUserIds:x}),c(false);},v=x=>{let T=new Set;e.forEach(I=>{I.labels?.forEach(k=>T.add(k));});let D=Array.from(new Set([...T,...x]));r.onBulkUpdate?.(w,{labels:D}),i(false);},f=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(w),a());};return jsxRuntime.jsx("div",{className:"asakaa-bulk-toolbar",children:jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxRuntime.jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!s),title:"Update priority",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Priority"})}),s&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x),children:[jsxRuntime.jsx("span",{className:y("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Move to column",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Move"})}),m&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(x.id),children:x.title},x.id))})]}),t.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!u),title:"Assign users",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxRuntime.jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x.id]),children:[jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),n.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Add labels",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsxRuntime.jsx("div",{className:"asakaa-bulk-menu",children:n.map(x=>jsxRuntime.jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>v([x]),children:x},x))})]}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:f,title:"Delete selected cards",children:jsxRuntime.jsx("span",{className:"text-sm",children:"Delete"})}),jsxRuntime.jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsxRuntime.jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});nn.displayName="BulkOperationsToolbar";function ug(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let n,s,p,m,l;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(i=>{let w=a?.find(g=>g.id===i);s=`assignee-${i}`,p=w?.name||`User ${i}`,m=w?.color,l=w?.avatar,r.has(s)||r.set(s,{id:s,title:p,groupValue:i,cardIds:[],color:m,icon:l}),r.get(s).cardIds.push(o.id);}):(s="assignee-unassigned",p="Unassigned",m="#6b7280",l="\u{1F464}",r.has(s)||r.set(s,{id:s,title:p,groupValue:null,cardIds:[],color:m,icon:l}),r.get(s).cardIds.push(o.id));break;case "priority":n=o.priority||"NONE",s=`priority-${n}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[n];p=d.title,m=d.color,r.has(s)||r.set(s,{id:s,title:p,groupValue:n,cardIds:[],color:m}),r.get(s).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(i=>{s=`label-${i}`,p=i,m="#6b7280",r.has(s)||r.set(s,{id:s,title:p,groupValue:i,cardIds:[],color:m}),r.get(s).cardIds.push(o.id);}):(s="label-none",p="No Labels",m="#6b7280",r.has(s)||r.set(s,{id:s,title:p,groupValue:null,cardIds:[],color:m}),r.get(s).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,n)=>o.title.localeCompare(n.title))}function Fs({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[n,s]=react.useState(new Set),p=react.useMemo(()=>ug(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=react.useCallback(l=>{s(u=>{let c=new Set(u);return c.has(l)?c.delete(l):c.add(l),c});},[]);return t.groupBy==="none"||p.length===0?jsxRuntime.jsx(fr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxRuntime.jsxs("div",{className:y("asakaa-swimlane-view",o),children:[p.map(l=>{let u=n.has(l.id),c=e.cards.filter(i=>l.cardIds.includes(i.id)),d={...e,cards:c};return jsxRuntime.jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxRuntime.jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsxRuntime.jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsxRuntime.jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxRuntime.jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsxRuntime.jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsxRuntime.jsx("div",{className:"asakaa-swimlane-content p-4",children:jsxRuntime.jsx(fr,{board:d,callbacks:r,availableUsers:a})})]},l.id)}),p.length===0&&jsxRuntime.jsxs("div",{className:"text-center py-12 text-white/50",children:[jsxRuntime.jsx("p",{className:"text-lg",children:"No cards to display"}),jsxRuntime.jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Ls=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Bs({value:e,onChange:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),s=react.useRef(null),p=Ls.find(l=>l.value===e)||Ls[0];react.useEffect(()=>{function l(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let m=l=>{t(l),o(false);};return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:p.icon}),jsxRuntime.jsx("span",{children:p.label}),jsxRuntime.jsx("svg",{className:y("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:n,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsxRuntime.jsx("div",{className:"py-1",children:Ls.map(l=>jsxRuntime.jsxs("button",{onClick:()=>m(l.value),className:y("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsxRuntime.jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsxRuntime.jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Do=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function hg(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},n=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,s=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return n&&s&&p&&m}function Cd(e={}){let{shortcuts:t=Do,enabled:a=true,preventDefault:r=true}=e,o=react.useRef(t),n=react.useRef(a);react.useEffect(()=>{o.current=t,n.current=a;},[t,a]);let s=react.useCallback(m=>{o.current=[...o.current,m];},[]),p=react.useCallback(m=>{o.current=o.current.filter(l=>l.action!==m);},[]);return react.useEffect(()=>{function m(l){if(!n.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let c of o.current)if(hg(l,c)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:c.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:s,unregisterShortcut:p,isEnabled:a}}function yg(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function vg(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function xg(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=vg(e),r=t?yg(t):"";return a?`${a} + ${r}`:r}function kg(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Rs({shortcuts:e=Do,isOpen:t,onClose:a,className:r}){let[o,n]=react.useState(false);if(react.useEffect(()=>{n(true);},[]),react.useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let s=kg(e);return jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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-3xl w-full mx-4 max-h-[80vh] overflow-hidden",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:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),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.jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(s).map(([p,m])=>m.length===0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsxRuntime.jsx("div",{className:"space-y-3",children:m.map(l=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsxRuntime.jsx("span",{className:"text-sm text-white/80",children:l.description}),jsxRuntime.jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:xg(l)})]},l.action))})]},p))})}),jsxRuntime.jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Os=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
72
72
|
1.
|
|
73
73
|
|
|
74
74
|
**Expected behavior:**
|
|
@@ -108,48 +108,48 @@
|
|
|
108
108
|
1.
|
|
109
109
|
|
|
110
110
|
**Action items:**
|
|
111
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=react.useRef(null);react.useEffect(()=>{function d(l){n.current&&!n.current.contains(l.target)&&i.current&&!i.current.contains(l.target)&&o(false);}if(r)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let m=d=>{t(d),o(false);},p=e.reduce((d,l)=>{let s=l.category||"Other";return d[s]||(d[s]=[]),d[s].push(l),d},{});return jsxRuntime.jsxs("div",{className:b("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:i,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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",d.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",d.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:b("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:n,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([d,l])=>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:d})}),jsxRuntime.jsx("div",{children:l.map(s=>jsxRuntime.jsxs("button",{onClick:()=>m(s),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:s.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:s.name}),s.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:s.description})]})]},s.id))})]},d)),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 Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[i,m]=react.useState("export"),[p,d]=react.useState("json"),[l,s]=react.useState(null),g=react.useRef(null);if(!t)return null;let f=async()=>{let w=o?.current||void 0,h=await yl(e,p,w);vl(h,p);},c=async w=>{let h=w.target.files?.[0];if(h){try{let k=await wl(h),u=h.name.endsWith(".json")?"json":"csv",y=kl(k,u);s(y),y.success&&r&&r(y,k);}catch(k){s({success:false,errors:[`Failed to read file: ${k instanceof Error?k.message:"Unknown error"}`]});}g.current&&(g.current.value="");}};return jsxRuntime.jsxs("div",{className:b("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>m("export"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",i==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>m("import"),className:b("flex-1 px-6 py-4 font-semibold transition-colors",i==="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:[i==="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(w=>jsxRuntime.jsxs("button",{onClick:()=>d(w),className:b("p-4 rounded-lg border-2 transition-all text-center",p===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:f,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),i==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:g,type:"file",accept:".json,.csv",onChange:c,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>g.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),l&&jsxRuntime.jsxs("div",{className:b("p-4 rounded-lg",l.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:b("font-semibold mb-2",l.success?"text-green-400":"text-red-400"),children:l.success?"\u2713 Import Successful":"\u2717 Import Failed"}),l.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",l.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",l.columnsImported]})]}),l.errors&&l.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:l.errors.map((w,h)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},h))})]})]})]})]})]})}var kg=["URGENT","HIGH","MEDIUM","LOW"],wg=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Cg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:i,onFilterHighPriority:m,availableUsers:p=[],availableLabels:d=[],availableColumns:l=[],showQuickFilters:s=true,compact:g=false,groupBy:f="none",onGroupByChange:c}){let[w,h]=react.useState(true),k=react.useCallback(T=>{a({search:T.target.value});},[a]),u=react.useCallback(T=>{a({dateFilter:T.target.value});},[a]),y=react.useCallback(T=>{r({by:T.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${g?"filter-bar--compact":""} ${w?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>h(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.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:w?"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)"]})]}),!w&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[s&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),i&&jsxRuntime.jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),m&&jsxRuntime.jsx("button",{onClick:m,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:k,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:u,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:T=>{let M=T.target.value;a({priorities:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),kg.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),p.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let M=T.target.value;a({assignees:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),p.map(T=>jsxRuntime.jsx("option",{value:T.id,children:T.name},T.id))]})}),d.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let M=T.target.value;a({labels:M==="all"?[]:[M]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),d.map(T=>jsxRuntime.jsx("option",{value:T,children:T},T))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:y,className:"filter-bar__select filter-bar__select--sm",children:wg.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),c&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:f,onChange:T=>c(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Cg.map(T=>jsxRuntime.jsx("option",{value:T.value,children:T.label},T.value))})}),D&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:i,onExportGanttPNG:m,onExportGanttCSV:p}){let[d,l]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{let f=c=>{s.current&&!s.current.contains(c.target)&&l(false);};return d&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[d]);let g=f=>{f(),l(false);};return jsxRuntime.jsxs("div",{className:b("relative",r),ref:s,children:[jsxRuntime.jsxs("button",{onClick:()=>l(!d),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":d,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"})]}),d&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>g(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>g(async()=>await m?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>g(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>g(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>g(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Gs={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"}},_s={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"}},Vs={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"}},Mr={dark:Gs,light:_s,neutral:Vs},ln="dark";var dn=react.createContext(void 0),Fg="asakaa-theme";function Nd({children:e,defaultTheme:t=ln,storageKey:a=Fg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let m=localStorage.getItem(a);if(m&&(m==="dark"||m==="light"||m==="neutral"))return m}return t}),n=react.useCallback(m=>{o(m),typeof window<"u"&&localStorage.setItem(a,m);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let m=document.documentElement,p=Mr[r];Object.entries(p.colors).forEach(([l,s])=>{s&&m.style.setProperty(`--theme-${Lg(l)}`,s);}),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(([l,s])=>{let g=p.colors[l];g&&m.style.setProperty(s,g);}),m.setAttribute("data-theme",r),m.classList.remove("theme-dark","theme-light","theme-neutral"),m.classList.add(`theme-${r}`);},[r]);let i={theme:r,setTheme:n,themes:Mr};return jsxRuntime.jsx(dn.Provider,{value:i,children:e})}function ao(){let e=react.useContext(dn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Lg(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ao();return e?jsxRuntime.jsxs("div",{className:b("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(Mr).map(([n,i])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:b("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:i.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:i.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}function Sd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ve[e]||Ve.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,i)=>a.getPropertyValue(n).trim()||i;return {bgPrimary:r("--theme-bg-primary",Ve[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ve[e].bgSecondary),bgGrid:r("--theme-bg-card",Ve[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ve[e].bgWeekend),border:r("--theme-border-primary",Ve[e].border),borderLight:r("--theme-border-subtle",Ve[e].borderLight),textPrimary:r("--theme-text-primary",Ve[e].textPrimary),textSecondary:r("--theme-text-secondary",Ve[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ve[e].textTertiary),accent:r("--theme-accent-primary",Ve[e].accent),accentHover:r("--theme-accent-hover",Ve[e].accentHover),accentLight:r("--theme-accent-primary",Ve[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ve[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ve[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ve[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ve[e].dependency),dependencyHover:r("--theme-border-secondary",Ve[e].dependencyHover),criticalPath:r("--theme-error",Ve[e].criticalPath),criticalPathLight:r("--theme-error",Ve[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ve[e].today):e==="neutral"?r("--theme-text-primary",Ve[e].today):r("--theme-error",Ve[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ve[e].todayLight):e==="neutral"?r("--theme-text-primary",Ve[e].todayLight):r("--theme-error",Ve[e].todayLight),milestone:r("--theme-warning",Ve[e].milestone),milestoneLight:r("--theme-warning",Ve[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ve[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ve[e].statusInProgress),statusCompleted:r("--theme-success",Ve[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ve[e].hoverBg),focusRing:r("--theme-accent-primary",Ve[e].focusRing)}}var cn={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"}},Ed={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"}},Ks={en:cn,es:Ed};function Pd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Pd(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 oo=react.createContext(cn);function No(){return react.useContext(oo)}function Jg({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:i}){let[m,p]=react.useState(false),[d,l]=react.useState(null),s=react.useRef(null),g=No();if(react.useEffect(()=>{let h=k=>{s.current&&!s.current.contains(k.target)&&p(false);};return m&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]),!(t||a||r||o||n||i))return null;let c=[{id:"png",label:"PNG",description:"Image",icon:jsxRuntime.jsx(lucideReact.FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsxRuntime.jsx(lucideReact.FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsxRuntime.jsx(lucideReact.FileJson,{className:"w-4 h-4"}),handler:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:i}].filter(h=>h.handler),w=async(h,k)=>{if(k){l(h);try{await k();}catch(u){console.error(`Export ${h} failed:`,u);}finally{l(null),p(false);}}};return jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>p(!m),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?e.accent:e.bgSecondary,border:`1px solid ${m?e.accent:e.borderLight}`,color:m?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:g.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:m&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:c.map((h,k)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>w(h.id,h.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:k<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.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:d===h.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"})}):h.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:h.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})})]})}function Zg({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(n=>{let i=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:i?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:i?600:500,zIndex:i?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[i&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:i?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function Qg({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 ef({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),i=No();react.useEffect(()=>{let d=l=>{n.current&&!n.current.contains(l.target)&&o(false);};return r&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r]);let m=[{value:"compact",label:i.toolbar.compact||"Compact"},{value:"comfortable",label:i.toolbar.normal||"Normal"},{value:"spacious",label:i.toolbar.spacious||"Spacious"}],p=m.find(d=>d.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${i.toolbar.density||"Density"}: ${p}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:m.map((d,l)=>{let s=t===d.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(d.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:s?e.accentLight:"transparent",borderBottom:l<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:s?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:l*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:s?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},children:d.label}),s&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},d.value)})})})})]})}function mn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:i,rowDensity:m,onRowDensityChange:p,showThemeSelector:d=false,showCreateTaskButton:l=false,createTaskLabel:s,onCreateTask:g,onExportPNG:f,onExportPDF:c,onExportExcel:w,onExportCSV:h,onExportJSON:k,onExportMSProject:u}){let y=No(),x=f||c||w||h||k||u,D=[{value:"day",label:y.toolbar.day},{value:"week",label:y.toolbar.week},{value:"month",label:y.toolbar.month}],T=[{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(Qg,{options:D,value:t,onChange:M=>a(M),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(ef,{theme:e,value:m,onChange:p})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[l&&g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:g,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:s||y.toolbar.createTask})]}),(x||d)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jg,{theme:e,onExportPNG:f,onExportPDF:c,onExportExcel:w,onExportCSV:h,onExportJSON:k,onExportMSProject:u}),d&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),d&&jsxRuntime.jsx(Zg,{options:T,value:n,onChange:M=>i(M),theme:e})]})]})}function pn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,i]=react.useState({x:0,y:0}),m=react.useRef(null),p=react.useRef(null);react.useEffect(()=>{if(!r)return;let l=s=>{m.current&&!m.current.contains(s.target)&&o(false);};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let d=e.filter(l=>l.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let l=p.current.getBoundingClientRect();i({x:l.left,y:l.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(nt,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:m,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.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"}),d.map(l=>jsxRuntime.jsxs("button",{onClick:()=>{t(l.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:s=>{s.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:l.label}),l.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},l.id))]})})})})]})}function no({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let i=react.useRef(null),[m,p]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let l=200,s=r.length*36+8,g=8,f=window.innerWidth,c=window.innerHeight,w=t,h=a;t+l+g>f&&(w=t-l,w<g&&(w=g)),a+s+g>c&&(h=c-s-g,h<g&&(h=g)),p({x:w,y:h});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let l=g=>{i.current&&!i.current.contains(g.target)&&o();},s=g=>{g.key==="Escape"&&o();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",s);}},[e,o]),!e)return null;let d=l=>l.startsWith("#")&&(l.length===7||l.length===4)?l:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:i,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${m.x}px`,top:`${m.y}px`,backgroundColor:d(n.bgSecondary),border:`1px solid ${n.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(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),o());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:s=>{l.disabled||(s.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:s=>{s.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},l.id))})})})}var St={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 Hd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:i,onTaskIndent:m,onTaskOutdent:p,onTaskRename:d,onTaskToggleExpand:l,onOpenTaskModal:s,enableKeyboard:g=true}){let f=react.useRef(false),c=react.useCallback(y=>{f.current=y;},[]),w=react.useCallback(y=>{let x=[],D=T=>{for(let M of T)x.push(M),M.subtasks&&M.subtasks.length>0&&M.isExpanded&&D(M.subtasks);};return D(y),x},[]),h=react.useCallback(()=>{let y=w(e);for(let x of y)if(t.has(x.id))return x;return null},[e,t,w]),k=react.useCallback((y,x)=>{let D=w(e);if(D.length===0)return;let T=h();if(!T){a(D[0].id,false);return}let M=D.findIndex(S=>S.id===T.id);if(M===-1)return;let v=y==="up"?M-1:M+1;if(v<0||v>=D.length)return;let B=D[v];a(B.id,x);},[e,h,w,a]),u=react.useCallback(y=>{if(!g)return;let x=y.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){y.key==="Escape"&&(x.blur(),f.current=false);return}let M=navigator.platform.toUpperCase().indexOf("MAC")>=0?y.metaKey:y.ctrlKey,v=Array.from(t),B=h();if(y.key==="ArrowUp"){y.preventDefault(),k("up",y.shiftKey);return}if(y.key==="ArrowDown"){y.preventDefault(),k("down",y.shiftKey);return}if(B&&(y.key==="ArrowRight"||y.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(y.preventDefault(),(y.key==="ArrowRight"&&!B.isExpanded||y.key==="ArrowLeft"&&B.isExpanded)&&l(B.id));return}if(y.altKey&&(y.key==="ArrowUp"||y.key==="ArrowDown")){v.length>0&&(y.preventDefault(),i(v,y.key==="ArrowUp"?"up":"down"));return}if(y.key==="Tab"&&!y.shiftKey){v.length>0&&(y.preventDefault(),m(v));return}if(y.key==="Tab"&&y.shiftKey){v.length>0&&(y.preventDefault(),p(v));return}if(y.key==="Enter"&&!y.shiftKey&&!M){B&&(y.preventDefault(),r(B.id,"below"));return}if(y.key==="Enter"&&y.shiftKey&&!M){B&&(y.preventDefault(),r(B.id,"above"));return}if(y.key==="Enter"&&M){B&&(y.preventDefault(),s(B.id));return}if(y.key==="F2"){B&&(y.preventDefault(),d(B.id));return}if(y.key==="Delete"||y.key==="Backspace"&&M){v.length>0&&(y.preventDefault(),o(v));return}if(y.key==="d"&&M&&!y.shiftKey){v.length>0&&(y.preventDefault(),n(v));return}},[g,t,h,k,r,o,n,i,m,p,d,l,s]);return react.useEffect(()=>{if(g)return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u);}},[g,u]),{setIsEditing:c}}function _d(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(s=>{t(new Set([s])),r(s);},[]),n=react.useCallback(s=>{t(g=>{let f=new Set(g);return f.has(s)?f.delete(s):f.add(s),f}),r(s);},[]),i=react.useCallback((s,g)=>{if(!a){o(s);return}let f=g.indexOf(a),c=g.indexOf(s);if(f===-1||c===-1){o(s);return}let w=Math.min(f,c),h=Math.max(f,c),k=g.slice(w,h+1);t(new Set(k)),r(s);},[a,o]),m=react.useCallback((s,g,f,c)=>{c?i(s,g):f?n(s):o(s);},[o,n,i]),p=react.useCallback((s,g)=>{g?t(f=>{let c=new Set(f);return c.add(s),c}):o(s);},[o]),d=react.useCallback(()=>{t(new Set),r(null);},[]),l=react.useCallback(s=>e.has(s),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:i,handleTaskClick:m,handleKeyboardSelection:p,clearSelection:d,isTaskSelected:l}}function so(e){let t=[],a=(r,o,n=0)=>{for(let i=0;i<r.length;i++){let m={...r[i],parentId:o,level:n,position:i};t.push(m),m.subtasks&&m.subtasks.length>0&&m.isExpanded&&a(m.subtasks,m.id,n+1);}};return a(e),t}function Vd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Vd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=so(e),r=t[0],o=a.findIndex(s=>s.id===r);if(o<=0)return e;let n=a[o-1],i=(s,g)=>{let f=[];return {tasks:s.filter(w=>{if(g.has(w.id))return f.push(w),false;if(w.subtasks){let h=i(w.subtasks,g);w.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},m=(s,g,f)=>s.map(c=>c.id===g?{...c,subtasks:[...c.subtasks||[],...f],isExpanded:true}:c.subtasks?{...c,subtasks:m(c.subtasks,g,f)}:c),p=new Set(t),{tasks:d,removed:l}=i(e,p);return m(d,n.id,l)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let n=Js(a,o.id),i=(d,l,s)=>{for(let g=0;g<d.length;g++){let f=d[g];if(f.id===l&&f.subtasks){let c=f.subtasks.findIndex(w=>w.id===s);if(c!==-1){let[w]=f.subtasks.splice(c,1);return w}}if(f.subtasks){let c=i(f.subtasks,l,s);if(c)return c}}return null},m=(d,l,s)=>{let g=d.findIndex(f=>f.id===l);if(g!==-1)return d.splice(g+1,0,s),d;for(let f of d)f.subtasks&&m(f.subtasks,l,s);return d},p=i(a,o.id,r);p&&(n&&n.subtasks?m(n.subtasks,o.id,p):m(a,o.id,p));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(i,m,p)=>{let d=i.findIndex(s=>s.id===m);if(d===-1){for(let s of i)if(s.subtasks&&n(s.subtasks,m,p))return true;return false}let l=p==="up"?d-1:d+1;return l<0||l>=i.length?false:([i[d],i[l]]=[i[l],i[d]],true)};return n(r,o,a),r}function ti(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function ai(e,t){let a=[...e];for(let r of t){let o=i=>{let m=i.findIndex(l=>l.id===r);if(m===-1){for(let l of i)if(l.subtasks&&o(l.subtasks))return true;return false}let p=i[m],d={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?n(p.subtasks):void 0};return i.splice(m+1,0,d),true},n=i=>i.map(m=>({...m,id:`${m.id}-copy-${Date.now()}`,subtasks:m.subtasks?n(m.subtasks):void 0}));o(a);}return a}function jd(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},m=p=>{let d=p.findIndex(s=>s.id===t);if(d===-1){for(let s of p)if(s.subtasks&&m(s.subtasks))return true;return false}let l=a==="above"?d:d+1;return p.splice(l,0,i),true};return m(r),{tasks:r,newTask:i}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=l=>{for(let s of l){if(s.id===t)return s;if(s.subtasks){let g=a(s.subtasks);if(g)return g}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let i=r?.startDate||o,m=r?.endDate||n,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(i),endDate:new Date(m),color:r?.color||"#3B82F6"},d=l=>l.map(s=>{if(s.id===t){let g=s.subtasks||[];return {...s,subtasks:[...g,p],isExpanded:true}}return s.subtasks?{...s,subtasks:d(s.subtasks)}:s});return {tasks:d(e),newTask:p}}function Kd(e,t,a,r){if(t===a)return e;let o=Vd(e,t);if(!o)return e;if(a){let m=(p,d)=>{if(!p.subtasks)return false;for(let l of p.subtasks)if(l.id===d||m(l,d))return true;return false};if(m(o,a))return e}let n=m=>m.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:n(p.subtasks)}:p),i=n(e);if(a===null){let m=r!==void 0?r:i.length;i.splice(m,0,{...o,parentId:void 0});}else {let m=p=>p.map(d=>{if(d.id===a){let l=d.subtasks||[],s=r!==void 0?r:l.length,g=[...l];return g.splice(s,0,{...o,parentId:a}),{...d,subtasks:g,isExpanded:true}}return d.subtasks&&d.subtasks.length>0?{...d,subtasks:m(d.subtasks)}:d});i=m(i);}return i}function fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:i,onTaskContextMenu:m,onTaskToggle:p,scrollTop:d,columns:l,onToggleColumn:s,onColumnResize:g,onTaskUpdate:f,onTaskIndent:c,onTaskOutdent:w,onTaskMove:h,onMultiTaskDelete:k,onTaskDuplicate:u,onTaskCreate:y,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:T,onDeleteRequest:M,onTaskReparent:v}){let B=react.useContext(oo),[S,C]=react.useState(null),[$,L]=react.useState(null),[q,j]=react.useState(""),me=react.useRef(null),[he,W]=react.useState(null),[te,F]=react.useState(0),[I,R]=react.useState(0),[P,X]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ee,z]=react.useState(null),[ye,Se]=react.useState(null),[We,Te]=react.useState(null),Xe=react.useRef(0),ze=5,Qe=react.useRef(false),[yt,pt]=react.useState(null),[dt,O]=react.useState(false),[oe,ue]=react.useState(null),[Ee,Ae]=react.useState(false),rt=react.useRef(null);react.useEffect(()=>{function _(J){rt.current&&!rt.current.contains(J.target)&&Ae(false);}if(Ee)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[Ee]),react.useEffect(()=>{$&&me.current&&(me.current.focus(),me.current.select());},[$]),react.useEffect(()=>{if(!he)return;let _=De=>{let _e=De.clientX-te,Ue=I+_e;g?.(he,Ue);},J=()=>{W(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",J),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",J),document.body.style.cursor="",document.body.style.userSelect="";}},[he,te,I,g]);let{selectedTaskIds:wt,handleTaskClick:Be,isTaskSelected:ke}=_d(),{setIsEditing:Pe}=Hd({tasks:e,selectedTaskIds:wt,onTaskSelect:(_,J)=>{let _e=so(e).map(Ue=>Ue.id);Be(_,_e,J||false,false);},onTaskCreate:y||(()=>{}),onTaskDelete:k||(()=>{}),onTaskDuplicate:u||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:c||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:_=>{let J=so(e).find(De=>De.id===_);J&&be(J);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:_=>{let J=so(e).find(De=>De.id===_);J&&T&&T(J);},enableKeyboard:true}),qt=(_,J=0)=>{let De=[];for(let _e of _)De.push({task:_e,level:J}),_e.subtasks&&_e.subtasks.length>0&&_e.isExpanded&&De.push(...qt(_e.subtasks,J+1));return De},it=qt(e),ta=48,H=Math.max(it.length*a,600-ta),re=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,be=_=>{L(_.id),j(_.name),Pe(true);},tt=_=>{q.trim()&&q!==e.find(J=>J.id===_)?.name&&x?.(_,q.trim()),L(null),j(""),Pe(false);},ie=()=>{L(null),j(""),Pe(false);},K=(_,J)=>{J.stopPropagation(),D?.(_.id);},ae=(_,J)=>{J.preventDefault(),Xe.current=J.clientY,z(_),Qe.current=false,O(false),pt({x:J.clientX,y:J.clientY});},Me=_=>{if(!ee||(Math.abs(_.clientY-Xe.current)>ze&&!Qe.current&&(Qe.current=true,O(true)),pt({x:_.clientX,y:_.clientY}),!Qe.current))return;let De=document.querySelectorAll("[data-task-row]"),_e=null,Ue=null;De.forEach(U=>{let Z=U.getBoundingClientRect(),Fe=U.getAttribute("data-task-row");if(Fe&&Fe!==ee&&_.clientY>=Z.top&&_.clientY<=Z.bottom){_e=Fe;let kt=_.clientY-Z.top,ot=Z.height;kt<ot*.25?Ue="above":kt>ot*.75?Ue="below":Ue="child";}}),Se(_e),Te(Ue);},le=()=>{if(Qe.current&&ee&&ye&&We){if(We==="child")v?.(ee,ye);else if(We==="above"||We==="below"){let _=(_e,Ue,U=null)=>{for(let Z of _e){if(Z.id===Ue)return U;if(Z.subtasks){let Fe=_(Z.subtasks,Ue,Z.id);if(Fe!==void 0)return Fe}}},J=_(e,ye,null),De=(_e,Ue)=>{let U=_e.findIndex(Z=>Z.id===Ue);return We==="below"?U+1:U};if(J===null){let _e=De(e,ye);v?.(ee,null,_e);}else {let _e=it.find(Ue=>Ue.task.id===J)?.task;if(_e?.subtasks){let Ue=De(_e.subtasks,ye);v?.(ee,J,Ue);}}}}z(null),Se(null),Te(null),pt(null),Qe.current=false,O(false);};react.useEffect(()=>{if(ee)return document.addEventListener("mousemove",Me),document.addEventListener("mouseup",le),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",le),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,ye,We]);let Je=(_,J,De)=>{switch(_.id){case "name":let _e=$===J.id,Ue=S===J.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${De*20}px`},children:[v&&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:Ue?1:.3},onMouseDown:ge=>ae(J.id,ge),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),J.subtasks&&J.subtasks.length>0?jsxRuntime.jsx("button",{onClick:ge=>{ge.stopPropagation(),p?.(J.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:J.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:J.color||"#3B82F6",opacity:J.parentId?.6:1,borderColor:J.isMilestone?t.accent:"transparent",borderWidth:J.isMilestone?"2px":"0px"},title:J.isMilestone?"Milestone":J.parentId?"Subtask":"Task"})}),_e?jsxRuntime.jsx("input",{ref:me,type:"text",value:q,onChange:ge=>j(ge.target.value),onKeyDown:ge=>{ge.key==="Enter"?tt(J.id):ge.key==="Escape"&&ie();},onBlur:()=>tt(J.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:ge=>ge.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:J.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:J.parentId?"13px":"14px",fontWeight:J.isMilestone?600:J.parentId?400:600,letterSpacing:J.parentId?"0":"-0.01em"},title:J.name,children:J.name}),Ue&&!_e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ge=>ge.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:ge=>K(J,ge),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:ge=>{ge.stopPropagation(),be(J);},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 Z=_.id==="startDate"?"startDate":"endDate",Fe=J[Z],kt=oe?.taskId===J.id&&oe?.field===Z,ot=ge=>ge?(typeof ge=="string"?new Date(ge):ge).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:ge=>ge.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:ge=>{if(kt)ue(null);else {let Pt=ge.currentTarget.getBoundingClientRect();ue({taskId:J.id,field:Z,month:Fe?typeof Fe=="string"?new Date(Fe):Fe:new Date,position:{top:Pt.bottom+4,left:Pt.left}});}},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsxRuntime.jsx("span",{children:ot(Fe)})]}),kt&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ue(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:oe?.position.top,left:oe?.position.left},onClick:ge=>ge.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ge=new Date,Pt=new Date(ge);Pt.setDate(ge.getDate()+1);let Qt=new Date(ge);Qt.setDate(ge.getDate()+7);let Hr=new Date(ge);return Hr.setDate(ge.getDate()+14),[{label:"Hoy",date:ge},{label:"Ma\xF1ana",date:Pt},{label:"Pr\xF3xima semana",date:Qt},{label:"2 semanas",date:Hr}].map((er,Ka)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:yr=>yr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:yr=>yr.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(J.id,{[Z]:er.date}),ue(null);},children:er.label},Ka))})(),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:ge=>ge.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ge=>ge.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(J.id,{[Z]:void 0}),ue(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:()=>ue(ge=>ge?{...ge,month:new Date(ge.month.getFullYear(),ge.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:oe?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ue(ge=>ge?{...ge,month:new Date(ge.month.getFullYear(),ge.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((ge,Pt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ge},Pt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ge=oe?.month||new Date,Pt=ge.getFullYear(),Qt=ge.getMonth(),Hr=new Date(Pt,Qt,1).getDay(),Ho=new Date(Pt,Qt+1,0).getDate(),er=new Date,Ka=[];for(let zt=Hr-1;zt>=0;zt--)Ka.push({day:new Date(Pt,Qt,-zt).getDate(),date:new Date(Pt,Qt-1,new Date(Pt,Qt,-zt).getDate()),isCurrentMonth:false});for(let zt=1;zt<=Ho;zt++)Ka.push({day:zt,date:new Date(Pt,Qt,zt),isCurrentMonth:true});let yr=42-Ka.length;for(let zt=1;zt<=yr;zt++)Ka.push({day:zt,date:new Date(Pt,Qt+1,zt),isCurrentMonth:false});return Ka.map((zt,uo)=>{let jn=zt.date.toDateString()===er.toDateString(),go=(Fe?typeof Fe=="string"?new Date(Fe):Fe:null)?.toDateString()===zt.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:zt.isCurrentMonth?go?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:go?"#3B82F6":"transparent",boxShadow:jn&&!go?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(J.id,{[Z]:zt.date}),ue(null);},children:zt.day},uo)})})()})]})]})]}),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:re(J)})});case "assignees":let ja=r.filter(ge=>J.assignees?.some(Pt=>Pt.name===ge.name||Pt.initials===ge.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Tr,{assignedUsers:ja,availableUsers:r,onChange:ge=>{let Pt=ge.map(Qt=>({id:Qt.id,name:Qt.name,initials:Qt.initials,color:Qt.color}));f?.(J.id,{assignees:Pt.length>0?Pt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:J.status||"todo",onChange:ge=>{f?.(J.id,{status:ge,progress:ge==="completed"?100:J.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:`${J.progress}%`,backgroundColor:J.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:[J.progress,"%"]})]});case "priority":let br={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Qa={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},po=br[J.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:ge=>ge.stopPropagation(),children:jsxRuntime.jsx(wr,{priority:po,onChange:ge=>{ge&&f?.(J.id,{priority:Qa[ge]||"medium"});}})});default:return null}},$e=_=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>s(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],Re=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(_.id,_.name):k?.([_.id]);}}]:[{id:"edit",label:B?.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{i?.(_);}},{id:"addSubtask",label:B?.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{D?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:B?.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{f?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:B?.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{f?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:B?.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{f?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:B?.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:B?.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{M?M(_.id,_.name):k?.([_.id]);}}],Le=l.filter(_=>_.visible),Ne=Le.reduce((_,J)=>_+J.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:Ne},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${ta}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:Le.map((_,J)=>{let De=J===Le.length-1,_e=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_e?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(_e?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:De?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ue=>{Ue.preventDefault(),X({isOpen:true,x:Ue.clientX,y:Ue.clientY,type:"header",columnId:_.id});},onMouseEnter:Ue=>{Ue.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ue=>{Ue.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:he===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ue=>{Ue.preventDefault(),Ue.stopPropagation(),W(_.id),F(Ue.clientX),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"}})})]},_.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(pn,{columns:l,onToggleColumn:s,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ae(!Ee),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),Ee&&jsxRuntime.jsxs("div",{ref:rt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>Ae(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:H},children:it.map(({task:_,level:J},De)=>{let _e=ke(_.id),Ue=ye===_.id,U=Ue&&We==="above",Z=Ue&&We==="below",Fe=Ue&&We==="child",kt={};return Fe&&(kt.backgroundColor=`${t.accent}15`,kt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${ee===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_e?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_e?t.accentLight:Fe?`${t.accent}15`:De%2===0?t.bgPrimary:t.bgGrid,...kt},onMouseEnter:()=>C(_.id),onMouseLeave:()=>C(null),onClick:ot=>{let br=so(e).map(ge=>ge.id),po=navigator.platform.toUpperCase().indexOf("MAC")>=0?ot.metaKey:ot.ctrlKey;Be(_.id,br,po,ot.shiftKey),n?.(_);},onDoubleClick:ot=>{ot.stopPropagation(),i?.(_);},onContextMenu:ot=>{ot.preventDefault(),X({isOpen:true,x:ot.clientX,y:ot.clientY,type:"task",task:_}),m?.(_,ot);},whileHover:{backgroundColor:_e?t.accentLight:t.hoverBg},children:[U&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Z&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((ot,ja)=>{let br=ja===Le.length-1,Qa=ot.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${Qa?"justify-start":"justify-center"}`,style:{width:`${ot.width}px`,minWidth:`${ot.minWidth??(Qa?200:60)}px`,maxWidth:`${ot.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:br?"none":`1px solid ${S===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Je(ot,_,Qa?J:0)},`${_.id}-${ot.id}`)})]},_.id)})}),jsxRuntime.jsx(no,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?$e(P.columnId):P.type==="task"&&P.task?Re(P.task):[],onClose:()=>X({...P,isOpen:false}),theme:t}),dt&&yt&&ee&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:yt.x+12,top:yt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=it.find(J=>J.task.id===ee)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function Zd(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[i,m]=react.useState(e),[p,d]=react.useState(t),[l,s]=react.useState(null),[g,f]=react.useState(null),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(0),[x,D]=react.useState(0),[T,M]=react.useState(null),[v,B]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:i,setGhostX:m,ghostWidth:p,setGhostWidth:d,connectionLine:l,setConnectionLine:s,hoveredTaskId:g,setHoveredTaskId:f,activeZone:c,setActiveZone:w,draggedSegmentIndex:h,setDraggedSegmentIndex:k,draggedSegmentStartX:u,setDraggedSegmentStartX:y,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:T,setHoveredSegmentIndex:M,isHovered:v,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(q,j)=>{r("none"),s(null),f(null),m(q),d(j),D(0),k(null),y(0);}}}function hn({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:i,templates:m,onClick:p,onDoubleClick:d,onContextMenu:l,onDateChange:s,onDependencyCreate:g,allTaskPositions:f=[],onDragMove:c,onHoverChange:w}){let h=Zd(t,r),k=react.useRef(null),{dragMode:u,setDragMode:y,dragOffset:x,setDragOffset:D,ghostX:T,setGhostX:M,ghostWidth:v,setGhostWidth:B,connectionLine:S,setConnectionLine:C,hoveredTaskId:$,setHoveredTaskId:L,activeZone:q,setActiveZone:j,draggedSegmentIndex:me,setDraggedSegmentIndex:he,draggedSegmentStartX:W,setDraggedSegmentStartX:te,segmentDragOffsetX:F,setSegmentDragOffsetX:I,hoveredSegmentIndex:R,setHoveredSegmentIndex:P,isHovered:X,setIsHovered:ee,isDragging:z,isResizing:ye,isConnecting:Se,resetDragState:We}=h,Te=32,Xe=8,ze=e.endDate&&e.endDate<new Date&&e.progress<100,Qe=e.isCriticalPath,yt=o.name==="neutral"||o.today==="#1C1917",pt=e.status==="completed"||e.progress===100,dt={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},oe=e.isCriticalPath||ze?"#DC2626":e.color?e.color:e.priority&&dt[e.priority]?dt[e.priority]:o.taskBarPrimary,Ee=(ie=>ie>=80?20:ie>=60?15:ie>=50?12:10)(r),Ae=r<50,rt=r<40;react.useEffect(()=>{if(w)if(X&&!z&&!e.segments){let ie=a<100;w({task:e,x:t,y:a,width:r,height:Te,showBelow:ie});}else w(null);},[X,z,e,t,a,r,Te,w]);let wt=ie=>ie.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Be=()=>{let ie=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ie} day${ie!==1?"s":""}`},ke=ie=>Math.round(ie/n)*n,Pe=ie=>{let K=Math.round(ie/n),ae=new Date(i);return ae.setDate(ae.getDate()+K),ae},qt=(ie,K)=>{for(let ae of f){if(ae.id===e.id)continue;let Me=5;if(ie>=ae.x-Me&&ie<=ae.x+ae.width+Me&&K>=ae.y-Me&&K<=ae.y+ae.height+Me)return ae.id}return null},it=react.useCallback((ie,K,ae)=>{ie.preventDefault(),ie.stopPropagation();let Me=k.current?.ownerSVGElement;if(!Me)return;let le=Me.createSVGPoint();le.x=ie.clientX,le.y=ie.clientY;let Je=le.matrixTransform(Me.getScreenCTM()?.inverse()),$e=ae!==void 0?ae:t,Re=K;if(!Re){let Le=Je.x-$e;ie.shiftKey?(Re="connect",C({x:t+r,y:a+Te/2})):ie.ctrlKey||ie.metaKey?Re="move":ie.altKey?Re=Le<r/2?"resize-start":"resize-end":rt?Le<r/2?Re="move":Re="resize-end":Ae?Le<=Ee/2?Re="resize-start":Le>=r-Ee/2?Re="resize-end":Re="move":Le<=Ee?Re="resize-start":Le>=r-Ee?Re="resize-end":Re="move";}y(Re),ee(false),j(null),Re==="move"?D(Je.x-$e):Re==="connect"?C({x:t+r,y:a+Te/2}):D(0),M($e),B(r);},[t,r,a,Te]),ta=react.useCallback(ie=>{if(u==="none")return;let K=k.current?.ownerSVGElement;if(!K)return;let ae=K.createSVGPoint();ae.x=ie.clientX,ae.y=ie.clientY;let Me=ae.matrixTransform(K.getScreenCTM()?.inverse());if(u==="connect"){C({x:Me.x,y:Me.y});let le=qt(Me.x,Me.y);L(le);}else if(u==="move"){let le=Me.x-x,Je=ke(le);M(Je),B(r);let $e=Math.round((Je-t)/n);if(c?.(e.id,$e,true),e.segments&&e.segments.length>0&&me!==null){let Re=Je-W;I(Re);}}else if(u==="resize-start"){let le=Me.x,Je=ke(le),$e=t+r-Je;$e>=n&&(M(Je),B($e));}else if(u==="resize-end"){let le=Me.x,$e=ke(le)-t;$e>=n&&B($e);}},[u,t,r,n,x,e,ke,me,W,qt,L,C,M,B,I,c]),H=react.useCallback(()=>{if(u!=="none"){if(u==="connect")$&&g&&g(e,$),C(null),L(null);else {let ie=e.endDate.getTime()-e.startDate.getTime(),K,ae,Me=true;if(u==="move"){if(K=Pe(T),ae=new Date(K.getTime()+ie),e.segments&&e.segments.length>0&&me!==null){let le=Math.round(F/n),Je=e.segments.map((Ne,_)=>{if(_===me){let J=new Date(Ne.startDate),De=new Date(Ne.endDate);return J.setDate(J.getDate()+le),De.setDate(De.getDate()+le),{startDate:J,endDate:De}}return Ne}),$e=Je.flatMap(Ne=>[Ne.startDate,Ne.endDate]),Re=new Date(Math.min(...$e.map(Ne=>Ne.getTime()))),Le=new Date(Math.max(...$e.map(Ne=>Ne.getTime())));s?.({...e,segments:Je},Re,Le),We(t,r);return}}else u==="resize-start"?(K=Pe(T),ae=e.endDate,K>ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),Me=false)):u==="resize-end"?(K=e.startDate,ae=Pe(T+v),ae<K&&(console.warn("Invalid date range: end date must be after or equal to start date"),Me=false)):Me=false;Me&&K&&ae&&(ae.getTime()<K.getTime()?console.warn("Invalid date range: end date cannot be before start date"):s?.(e,K,ae));}c?.(e.id,0,false),We(t,r);}},[u,T,v,e,s,$,g,t,r,n,Pe,F,me,We,c]);react.useEffect(()=>{if(u==="none")return;let ie=ae=>{ta(ae);},K=()=>{H();};return window.addEventListener("mousemove",ie),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",ie),window.removeEventListener("mouseup",K);}},[u,ta,H]);let re=z&&!Se?T:t,be=z&&!Se?v:r,tt=m.taskClass(e);return jsxRuntime.jsxs("g",{ref:k,onMouseEnter:()=>!z&&ee(true),onMouseLeave:()=>{z||(ee(false),j(null));},onClick:()=>!z&&p?.(e),onDoubleClick:ie=>{z||(ie.stopPropagation(),d?.(e));},onContextMenu:ie=>{ie.preventDefault(),l?.(e,ie);},children:[X&&!z&&!Ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:Ee,height:Te,fill:q==="resize-start"?o.accent:"transparent",opacity:q==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-start"),onMouseDown:ie=>it(ie,"resize-start")}),jsxRuntime.jsx("rect",{x:t+Ee,y:a,width:r-Ee*2,height:Te,fill:q==="move"?o.accent:"transparent",opacity:q==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:ie=>it(ie,"move")}),jsxRuntime.jsx("rect",{x:t+r-Ee,y:a,width:Ee,height:Te,fill:q==="resize-end"?o.accent:"transparent",opacity:q==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:ie=>it(ie,"resize-end")})]}),X&&!z&&rt&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:q==="move"?o.accent:"transparent",opacity:q==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>j("move"),onMouseDown:ie=>it(ie,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:q==="resize-end"?o.accent:"transparent",opacity:q==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>j("resize-end"),onMouseDown:ie=>it(ie,"resize-end")}),X&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),z&&!Se&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:T,y:a,width:v,height:Te,rx:Xe,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:re,y:a,width:be,height:Te,rx:Xe,fill:oe,"data-task-class":tt,initial:{opacity:0,scale:.95},animate:{opacity:z&&!Se?.15:e.parentId?.6:X?.9:.8,scale:X&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ie=>it(ie),style:{cursor:z?Se?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:re,y:a,width:be*(e.progress/100),height:Te,rx:Xe,fill:oe,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ie,K)=>{let ae=(ie.startDate.getTime()-i.getTime())/864e5*n,le=(ie.endDate.getTime()-i.getTime())/(1e3*60*60*24)*n-ae+n,Je=z&&u==="move"&&me===K,$e=R===K,Re=Je?ae+F:ae;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!z&&P(K),onMouseLeave:()=>!z&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Re,y:a,width:le,height:Te,rx:Xe,fill:oe,initial:{opacity:0,scale:.95},animate:{opacity:Je||e.parentId?.6:$e?.9:.8,scale:$e&&!z?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Le=>{Le.stopPropagation(),he(K),te(ae),it(Le,void 0,ae);},style:{cursor:z?Se?"crosshair":ye?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Re,y:a,width:le*(e.progress/100),height:Te,rx:Xe,fill:oe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${K}`)}),yt&&(ze||Qe)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Qe&&!ze&&jsxRuntime.jsx("rect",{x:re,y:a,width:be,height:Te,rx:Xe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ze&&jsxRuntime.jsx("rect",{x:re,y:a,width:be,height:Te,rx:Xe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),be>60&&!e.segments&&(()=>{let ie=m.taskLabel(e),K=typeof ie=="string"?ie:e.name,ae=K.length>Math.floor(be/8)?`${K.substring(0,Math.floor(be/8))}...`:K;return jsxRuntime.jsx("text",{x:re+12,y:a+Te/2,dominantBaseline:"middle",fill:pt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pt?"line-through":"none"},children:ae})})(),be>100&&e.progress>0&&e.progress<100&&!z&&!e.segments&&jsxRuntime.jsxs("text",{x:re+be-12,y:a+Te/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&&be>80&&!z&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:re+be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:re+be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(X||ye)&&!Se&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ae?re-15:re-10,y:a-5,width:Ae?25:20,height:Te+10,fill:"transparent",onMouseDown:ie=>it(ie,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?re-8:re-3,y:a+6,width:Ae?8:6,height:Ae?Te-12:Te-16,rx:3,fill:u==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="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:re+be-10,y:a-5,width:Ae?25:20,height:Te+10,fill:"transparent",onMouseDown:ie=>it(ie,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?re+be:re+be-3,y:a+6,width:Ae?8:6,height:Ae?Te-12:Te-16,rx:3,fill:u==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:u==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!z&&!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+Te/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:ie=>{ie.stopPropagation(),it(ie,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+Te/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Se&&S&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+Te/2,x2:S.x,y2:S.y,stroke:$?o.statusCompleted:o.accent,strokeWidth:$?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:$?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:S.x,cy:S.y,r:$?8:6,fill:$?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),$&&jsxRuntime.jsx(framerMotion.motion.text,{x:S.x+15,y:S.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:S.x+10},animate:{opacity:1,x:S.x+15},transition:{duration:.2},children:"Connect"})]}),(X||z)&&!Se&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:re-2,y:a-2,width:be+4,height:Te+4,rx:Xe+2,fill:"none",stroke:z?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:z?.6:.4,initial:{opacity:0},animate:{opacity:z?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ye&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:T,y1:0,x2:T,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:T+v,y1:0,x2:T+v,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&!z&&!e.segments&&!w&&(()=>{let ae=a<100,Me=ae?a+Te+13:a-82-13,le=ae?`M ${re+be/2-6} ${a+Te+3} L ${re+be/2} ${a+Te+13} L ${re+be/2+6} ${a+Te+3}`:`M ${re+be/2-6} ${a-13} L ${re+be/2} ${a-3} L ${re+be/2+6} ${a-13}`,Je=Me+22,$e=Me+40,Re=Me+55,Le=Me+70,Ne=ae?Me+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:le,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:re+be/2-120,y:Me,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:re+be/2,y:Je,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:re+be/2-110,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:re+be/2-70,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:wt(e.startDate)}),jsxRuntime.jsx("text",{x:re+be/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:re+be/2-70,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:wt(e.endDate)}),jsxRuntime.jsx("text",{x:re+be/2+10,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:re+be/2+65,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Be()}),jsxRuntime.jsx("text",{x:re+be/2+10,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:re+be/2+65,y:Re,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:re+be/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:re+be/2-50,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!ae&&jsxRuntime.jsx("text",{x:re+be/2,y:Ne,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:rt?"Left: move \u2022 Right: resize":Ae?"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 tc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:n,height:i,showBelow:m}=e,p=82,d=13,l=m?o+i+d:o-p-d,s=m?`M ${r+n/2-6} ${o+i+3} L ${r+n/2} ${o+i+13} L ${r+n/2+6} ${o+i+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,g=l+22,f=l+40,c=l+55,w=l+70,h=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:s,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+n/2-120,y:l,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+n/2,y:g,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsxRuntime.jsx("text",{x:r+n/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?h(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?h(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:k()}),jsxRuntime.jsx("text",{x:r+n/2+10,y:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:r+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:i}){let[m,p]=react.useState(false),d=a-e,l=r-t,s=e+d/2,g=`M ${e} ${t} C ${s} ${t}, ${s} ${r}, ${a} ${r}`,f=6,c=Math.atan2(l,d),w=a-f*Math.cos(c-Math.PI/6),h=r-f*Math.sin(c-Math.PI/6),k=a-f*Math.cos(c+Math.PI/6),u=r-f*Math.sin(c+Math.PI/6),y=o.dependency;react.useEffect(()=>{i&&n&&i(m?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[m,e,t,a,r,n,i]);let x=!n&&!i;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!x&&p(true),onMouseLeave:()=>!x&&p(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsxRuntime.jsx("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d:g,fill:"none",stroke:y,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:m&&i?0:m?1:.8,strokeWidth:m?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${w} ${h} M ${a} ${r} L ${k} ${u}`,fill:"none",stroke:y,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:m&&i?0:m?1:.8,scale:m?1.1:1,strokeWidth:m?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:y,initial:{scale:0},animate:{scale:m&&i?0:m?1.3:1,opacity:m&&i?0:m?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),m&&n&&!i&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:D=>{D.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:s,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:s-4,y1:(t+r)/2-4,x2:s+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:s+4,y1:(t+r)/2-4,x2:s-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function kn({task:e,x:t,y:a,theme:r,onClick:o}){let[n,i]=react.useState(false),m=16,p=d=>d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:m+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-m/2,y:a+16-m/2,width:m,height:m,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(m+4)/2,y:a+16-(m+4)/2,width:m+4,height:m+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsxRuntime.jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var pe={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=d=>{d.forEach(l=>{l.dependencies&&r.set(l.id,l.dependencies),l.subtasks&&o(l.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let i=new Set,m=new Set,p=d=>{if(!i.has(d)){i.add(d),m.add(d);let l=r.get(d)||[];for(let s of l){if(!i.has(s)&&p(s))return true;if(m.has(s))return true}}return m.delete(d),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=pe.findTaskById(e,o);if(n)a.unshift(n),o=n.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=pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.join(","));}),r.join(`
|
|
112
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=pe.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=pe.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)=>pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=pe.findTaskById(e,t);return !a||!a.dependencies?[]:pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>pe.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=pe.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>pe.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,n=pe.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let
|
|
111
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function zs({templates:e,onSelectTemplate:t,className:a}){let[r,o]=react.useState(false),n=react.useRef(null),s=react.useRef(null);react.useEffect(()=>{function l(u){n.current&&!n.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=l=>{t(l),o(false);},m=e.reduce((l,u)=>{let c=u.category||"Other";return l[c]||(l[c]=[]),l[c].push(u),l},{});return jsxRuntime.jsxs("div",{className:y("relative inline-block",a),children:[jsxRuntime.jsxs("button",{ref:s,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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:y("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:n,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(([l,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsxRuntime.jsx("div",{children:u.map(c=>jsxRuntime.jsxs("button",{onClick:()=>p(c),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:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:c.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:c.name}),c.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:c.description})]})]},c.id))})]},l)),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 Us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:n}){let[s,p]=react.useState("export"),[m,l]=react.useState("json"),[u,c]=react.useState(null),d=react.useRef(null);if(!t)return null;let i=async()=>{let g=o?.current||void 0,b=await yl(e,m,g);vl(b,m);},w=async g=>{let b=g.target.files?.[0];if(b){try{let h=await wl(b),v=b.name.endsWith(".json")?"json":"csv",f=kl(h,v);c(f),f.success&&r&&r(f,h);}catch(h){c({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxRuntime.jsxs("div",{className:y("fixed inset-0 z-[9999] flex items-center justify-center",n),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>p("export"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>p("import"),className:y("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[s==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(g=>jsxRuntime.jsxs("button",{onClick:()=>l(g),className:y("p-4 rounded-lg border-2 transition-all text-center",m===g?"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:[g==="json"&&"\u{1F4C4}",g==="csv"&&"\u{1F4CA}",g==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:g})]},g))})]}),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:i,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:w,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:y("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsxRuntime.jsx("h3",{className:y("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((g,b)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",g]},b))})]})]})]})]})]})}var Ng=["URGENT","HIGH","MEDIUM","LOW"],Sg=[{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"}],Eg=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ws({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:n,onFilterOverdue:s,onFilterHighPriority:p,availableUsers:m=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:c=true,compact:d=false,groupBy:i="none",onGroupByChange:w}){let[g,b]=react.useState(true),h=react.useCallback(D=>{a({search:D.target.value});},[a]),v=react.useCallback(D=>{a({dateFilter:D.target.value});},[a]),f=react.useCallback(D=>{r({by:D.target.value});},[r]),x=react.useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=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 ${d?"filter-bar--compact":""} ${g?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>b(!g),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:g?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.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:g?"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"}),T&&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)"]})]}),!g&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[c&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),n&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsxRuntime.jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let I=D.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Ng.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let I=D.target.value;a({assignees:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsxRuntime.jsx("option",{value:D.id,children:D.name},D.id))]})}),l.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let I=D.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),l.map(D=>jsxRuntime.jsx("option",{value:D,children:D},D))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:f,className:"filter-bar__select filter-bar__select--sm",children:Sg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),w&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:i,onChange:D=>w(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Eg.map(D=>jsxRuntime.jsx("option",{value:D.value,children:D.label},D.value))})}),T&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Hs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:n,onExportGanttExcel:s,onExportGanttPNG:p,onExportGanttCSV:m}){let[l,u]=react.useState(false),c=react.useRef(null);react.useEffect(()=>{let i=w=>{c.current&&!c.current.contains(w.target)&&u(false);};return l&&document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i);}},[l]);let d=i=>{i(),u(false);};return jsxRuntime.jsxs("div",{className:y("relative",r),ref:c,children:[jsxRuntime.jsxs("button",{onClick:()=>u(!l),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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&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:()=>d(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(()=>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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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:()=>d(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.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 Gs={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"}},_s={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"}},Vs={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:Gs,light:_s,neutral:Vs},ln="dark";var dn=react.createContext(void 0),zg="asakaa-theme";function Nd({children:e,defaultTheme:t=ln,storageKey:a=zg}){let[r,o]=react.useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),n=react.useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);react.useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=Lr[r];Object.entries(m.colors).forEach(([u,c])=>{c&&p.style.setProperty(`--theme-${$g(u)}`,c);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,c])=>{let d=m.colors[u];d&&p.style.setProperty(c,d);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let s={theme:r,setTheme:n,themes:Lr};return jsxRuntime.jsx(dn.Provider,{value:s,children:e})}function ro(){let e=react.useContext(dn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function $g(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function js({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=ro();return e?jsxRuntime.jsxs("div",{className:y("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(([n,s])=>jsxRuntime.jsxs("button",{onClick:()=>{o(n),t();},className:y("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===n?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===n?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[n==="dark"&&"Default dark theme with Linear-inspired colors",n==="light"&&"Clean light theme with high contrast",n==="neutral"&&"Monochrome zen theme"]})]}),r===n&&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"})})]},n))})]})]}):null}function Sd(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Ve[e]||Ve.dark;let t=document.documentElement,a=getComputedStyle(t),r=(n,s)=>a.getPropertyValue(n).trim()||s;return {bgPrimary:r("--theme-bg-primary",Ve[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Ve[e].bgSecondary),bgGrid:r("--theme-bg-card",Ve[e].bgGrid),bgWeekend:r("--theme-bg-hover",Ve[e].bgWeekend),border:r("--theme-border-primary",Ve[e].border),borderLight:r("--theme-border-subtle",Ve[e].borderLight),textPrimary:r("--theme-text-primary",Ve[e].textPrimary),textSecondary:r("--theme-text-secondary",Ve[e].textSecondary),textTertiary:r("--theme-text-tertiary",Ve[e].textTertiary),accent:r("--theme-accent-primary",Ve[e].accent),accentHover:r("--theme-accent-hover",Ve[e].accentHover),accentLight:r("--theme-accent-primary",Ve[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Ve[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Ve[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Ve[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Ve[e].dependency),dependencyHover:r("--theme-border-secondary",Ve[e].dependencyHover),criticalPath:r("--theme-error",Ve[e].criticalPath),criticalPathLight:r("--theme-error",Ve[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Ve[e].today):e==="neutral"?r("--theme-text-primary",Ve[e].today):r("--theme-error",Ve[e].today),todayLight:e==="light"?r("--theme-accent-primary",Ve[e].todayLight):e==="neutral"?r("--theme-text-primary",Ve[e].todayLight):r("--theme-error",Ve[e].todayLight),milestone:r("--theme-warning",Ve[e].milestone),milestoneLight:r("--theme-warning",Ve[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Ve[e].statusTodo),statusInProgress:r("--theme-accent-primary",Ve[e].statusInProgress),statusCompleted:r("--theme-success",Ve[e].statusCompleted),hoverBg:r("--theme-bg-hover",Ve[e].hoverBg),focusRing:r("--theme-accent-primary",Ve[e].focusRing)}}var cn={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"}},Ed={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"}},Ks={en:cn,es:Ed};function Pd(e){return Ks[e]||Ks.en}function Ys(e,t){let a=Pd(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 no=react.createContext(cn);function No(){return react.useContext(no)}function af({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:n,onExportMSProject:s}){let[p,m]=react.useState(false),[l,u]=react.useState(null),c=react.useRef(null),d=No();if(react.useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&m(false);};return p&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[p]),!(t||a||r||o||n||s))return null;let w=[{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:n},{id:"msproject",label:"MS Project",description:"XML",icon:jsxRuntime.jsx(lucideReact.FolderKanban,{className:"w-4 h-4"}),handler:s}].filter(b=>b.handler),g=async(b,h)=>{if(h){u(b);try{await h();}catch(v){console.error(`Export ${b} failed:`,v);}finally{u(null),m(false);}}};return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Download,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:d.toolbar.export}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:p&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:w.map((b,h)=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>g(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<w.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.id?jsxRuntime.jsx(framerMotion.motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsxRuntime.jsx(lucideReact.Download,{className:"w-4 h-4"})}):b.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsxRuntime.jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})})]})}function rf({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(n=>{let s=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:s?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500,zIndex:s?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[s&&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}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:s?"#FFFFFF":r.textTertiary},children:n.label})]},n.value)})})}function of({options:e,value:t,onChange:a,theme:r}){return jsxRuntime.jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let n=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:n?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500},whileHover:{color:n?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsxRuntime.jsx("span",{children:o.label}),n&&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 nf({theme:e,value:t,onChange:a}){let[r,o]=react.useState(false),n=react.useRef(null),s=No();react.useEffect(()=>{let l=u=>{n.current&&!n.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=[{value:"compact",label:s.toolbar.compact||"Compact"},{value:"comfortable",label:s.toolbar.normal||"Normal"},{value:"spacious",label:s.toolbar.spacious||"Spacious"}],m=p.find(l=>l.value===t)?.label||"Normal";return jsxRuntime.jsxs("div",{ref:n,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:`${s.toolbar.density||"Density"}: ${m}`,children:jsxRuntime.jsx(lucideReact.Rows3,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxRuntime.jsx("div",{className:"py-1",children:p.map((l,u)=>{let c=t===l.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{a(l.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:c?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:c?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:c?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:c?600:500},children:l.label}),c&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},l.value)})})})})]})}function pn({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:n,onThemeChange:s,rowDensity:p,onRowDensityChange:m,showThemeSelector:l=false,showCreateTaskButton:u=false,createTaskLabel:c,onCreateTask:d,onExportPNG:i,onExportPDF:w,onExportExcel:g,onExportCSV:b,onExportJSON:h,onExportMSProject:v}){let f=No(),x=i||w||g||b||h||v,T=[{value:"day",label:f.toolbar.day},{value:"week",label:f.toolbar.week},{value:"month",label:f.toolbar.month}],D=[{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(of,{options:T,value:t,onChange:I=>a(I),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(nf,{theme:e,value:p,onChange:m})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[u&&d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.button,{onClick:d,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:c||f.toolbar.createTask})]}),(x||l)&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),x&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(af,{theme:e,onExportPNG:i,onExportPDF:w,onExportExcel:g,onExportCSV:b,onExportJSON:h,onExportMSProject:v}),l&&jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),l&&jsxRuntime.jsx(rf,{options:D,value:n,onChange:I=>s(I),theme:e})]})]})}function mn({columns:e,onToggleColumn:t,theme:a}){let[r,o]=react.useState(false),[n,s]=react.useState({x:0,y:0}),p=react.useRef(null),m=react.useRef(null);react.useEffect(()=>{if(!r)return;let u=c=>{p.current&&!p.current.contains(c.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let l=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:r&&jsxRuntime.jsx(it,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${n.x}px`,top:`${n.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"}),l.map(u=>jsxRuntime.jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function so({isOpen:e,x:t,y:a,items:r,onClose:o,theme:n}){let s=react.useRef(null),[p,m]=react.useState({x:t,y:a});if(react.useEffect(()=>{if(!e)return;let u=200,c=r.length*36+8,d=8,i=window.innerWidth,w=window.innerHeight,g=t,b=a;t+u+d>i&&(g=t-u,g<d&&(g=d)),a+c+d>w&&(b=w-c-d,b<d&&(b=d)),m({x:g,y:b});},[e,t,a,r.length]),react.useEffect(()=>{if(!e)return;let u=d=>{s.current&&!s.current.contains(d.target)&&o();},c=d=>{d.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",c);}},[e,o]),!e)return null;let l=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:n.bgPrimary?.includes("1")||n.bgPrimary?.includes("2")||n.textPrimary?.toLowerCase().includes("fff")||n.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:l(n.bgSecondary),border:`1px solid ${n.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsxRuntime.jsx("div",{className:"py-1",children:r.map(u=>jsxRuntime.jsxs("div",{children:[u.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:n.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?n.textTertiary:n.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:c=>{u.disabled||(c.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsxRuntime.jsx("span",{style:{color:n.textSecondary},children:u.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:n.textTertiary}})]})]},u.id))})})})}var Et={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 Hd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:n,onTaskMove:s,onTaskIndent:p,onTaskOutdent:m,onTaskRename:l,onTaskToggleExpand:u,onOpenTaskModal:c,enableKeyboard:d=true}){let i=react.useRef(false),w=react.useCallback(f=>{i.current=f;},[]),g=react.useCallback(f=>{let x=[],T=D=>{for(let I of D)x.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&T(I.subtasks);};return T(f),x},[]),b=react.useCallback(()=>{let f=g(e);for(let x of f)if(t.has(x.id))return x;return null},[e,t,g]),h=react.useCallback((f,x)=>{let T=g(e);if(T.length===0)return;let D=b();if(!D){a(T[0].id,false);return}let I=T.findIndex(N=>N.id===D.id);if(I===-1)return;let k=f==="up"?I-1:I+1;if(k<0||k>=T.length)return;let L=T[k];a(L.id,x);},[e,b,g,a]),v=react.useCallback(f=>{if(!d)return;let x=f.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||i.current){f.key==="Escape"&&(x.blur(),i.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?f.metaKey:f.ctrlKey,k=Array.from(t),L=b();if(f.key==="ArrowUp"){f.preventDefault(),h("up",f.shiftKey);return}if(f.key==="ArrowDown"){f.preventDefault(),h("down",f.shiftKey);return}if(L&&(f.key==="ArrowRight"||f.key==="ArrowLeft")){L.subtasks&&L.subtasks.length>0&&(f.preventDefault(),(f.key==="ArrowRight"&&!L.isExpanded||f.key==="ArrowLeft"&&L.isExpanded)&&u(L.id));return}if(f.altKey&&(f.key==="ArrowUp"||f.key==="ArrowDown")){k.length>0&&(f.preventDefault(),s(k,f.key==="ArrowUp"?"up":"down"));return}if(f.key==="Tab"&&!f.shiftKey){k.length>0&&(f.preventDefault(),p(k));return}if(f.key==="Tab"&&f.shiftKey){k.length>0&&(f.preventDefault(),m(k));return}if(f.key==="Enter"&&!f.shiftKey&&!I){L&&(f.preventDefault(),r(L.id,"below"));return}if(f.key==="Enter"&&f.shiftKey&&!I){L&&(f.preventDefault(),r(L.id,"above"));return}if(f.key==="Enter"&&I){L&&(f.preventDefault(),c(L.id));return}if(f.key==="F2"){L&&(f.preventDefault(),l(L.id));return}if(f.key==="Delete"||f.key==="Backspace"&&I){k.length>0&&(f.preventDefault(),o(k));return}if(f.key==="d"&&I&&!f.shiftKey){k.length>0&&(f.preventDefault(),n(k));return}},[d,t,b,h,r,o,n,s,p,m,l,u,c]);return react.useEffect(()=>{if(d)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[d,v]),{setIsEditing:w}}function _d(){let[e,t]=react.useState(new Set),[a,r]=react.useState(null),o=react.useCallback(c=>{t(new Set([c])),r(c);},[]),n=react.useCallback(c=>{t(d=>{let i=new Set(d);return i.has(c)?i.delete(c):i.add(c),i}),r(c);},[]),s=react.useCallback((c,d)=>{if(!a){o(c);return}let i=d.indexOf(a),w=d.indexOf(c);if(i===-1||w===-1){o(c);return}let g=Math.min(i,w),b=Math.max(i,w),h=d.slice(g,b+1);t(new Set(h)),r(c);},[a,o]),p=react.useCallback((c,d,i,w)=>{w?s(c,d):i?n(c):o(c);},[o,n,s]),m=react.useCallback((c,d)=>{d?t(i=>{let w=new Set(i);return w.add(c),w}):o(c);},[o]),l=react.useCallback(()=>{t(new Set),r(null);},[]),u=react.useCallback(c=>e.has(c),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:n,selectTaskRange:s,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:l,isTaskSelected:u}}function io(e){let t=[],a=(r,o,n=0)=>{for(let s=0;s<r.length;s++){let p={...r[s],parentId:o,level:n,position:s};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,n+1);}};return a(e),t}function Vd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Vd(a.subtasks,t);if(r)return r}}return null}function Js(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Js(a.subtasks,t);if(r)return r}return null}function Zs(e,t){if(t.length===0)return e;let a=io(e),r=t[0],o=a.findIndex(c=>c.id===r);if(o<=0)return e;let n=a[o-1],s=(c,d)=>{let i=[];return {tasks:c.filter(g=>{if(d.has(g.id))return i.push(g),false;if(g.subtasks){let b=s(g.subtasks,d);g.subtasks=b.tasks,i.push(...b.removed);}return true}),removed:i}},p=(c,d,i)=>c.map(w=>w.id===d?{...w,subtasks:[...w.subtasks||[],...i],isExpanded:true}:w.subtasks?{...w,subtasks:p(w.subtasks,d,i)}:w),m=new Set(t),{tasks:l,removed:u}=s(e,m);return p(l,n.id,u)}function Qs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Js(a,r);if(!o)continue;let n=Js(a,o.id),s=(l,u,c)=>{for(let d=0;d<l.length;d++){let i=l[d];if(i.id===u&&i.subtasks){let w=i.subtasks.findIndex(g=>g.id===c);if(w!==-1){let[g]=i.subtasks.splice(w,1);return g}}if(i.subtasks){let w=s(i.subtasks,u,c);if(w)return w}}return null},p=(l,u,c)=>{let d=l.findIndex(i=>i.id===u);if(d!==-1)return l.splice(d+1,0,c),l;for(let i of l)i.subtasks&&p(i.subtasks,u,c);return l},m=s(a,o.id,r);m&&(n&&n.subtasks?p(n.subtasks,o.id,m):p(a,o.id,m));}return a}function ei(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],n=(s,p,m)=>{let l=s.findIndex(c=>c.id===p);if(l===-1){for(let c of s)if(c.subtasks&&n(c.subtasks,p,m))return true;return false}let u=m==="up"?l-1:l+1;return u<0||u>=s.length?false:([s[l],s[u]]=[s[u],s[l]],true)};return n(r,o,a),r}function ti(e,t){let a=new Set(t),r=o=>o.filter(n=>!a.has(n.id)).map(n=>n.subtasks?{...n,subtasks:r(n.subtasks)}:n);return r(e)}function ai(e,t){let a=[...e];for(let r of t){let o=s=>{let p=s.findIndex(u=>u.id===r);if(p===-1){for(let u of s)if(u.subtasks&&o(u.subtasks))return true;return false}let m=s[p],l={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?n(m.subtasks):void 0};return s.splice(p+1,0,l),true},n=s=>s.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?n(p.subtasks):void 0}));o(a);}return a}function jd(e,t,a){let r=[...e],o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:n,color:"#6366F1"},p=m=>{let l=m.findIndex(c=>c.id===t);if(l===-1){for(let c of m)if(c.subtasks&&p(c.subtasks))return true;return false}let u=a==="above"?l:l+1;return m.splice(u,0,s),true};return p(r),{tasks:r,newTask:s}}function ri(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ri(r.subtasks,t,a)}:r)}function oi(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:oi(a.subtasks,t)}:a)}function ni(e,t){let a=u=>{for(let c of u){if(c.id===t)return c;if(c.subtasks){let d=a(c.subtasks);if(d)return d}}return null},r=a(e),o=new Date,n=new Date(o);n.setDate(n.getDate()+7);let s=r?.startDate||o,p=r?.endDate||n,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(s),endDate:new Date(p),color:r?.color||"#3B82F6"},l=u=>u.map(c=>{if(c.id===t){let d=c.subtasks||[];return {...c,subtasks:[...d,m],isExpanded:true}}return c.subtasks?{...c,subtasks:l(c.subtasks)}:c});return {tasks:l(e),newTask:m}}function Kd(e,t,a,r){if(t===a)return e;let o=Vd(e,t);if(!o)return e;if(a){let p=(m,l)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===l||p(u,l))return true;return false};if(p(o,a))return e}let n=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:n(m.subtasks)}:m),s=n(e);if(a===null){let p=r!==void 0?r:s.length;s.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(l=>{if(l.id===a){let u=l.subtasks||[],c=r!==void 0?r:u.length,d=[...u];return d.splice(c,0,{...o,parentId:a}),{...l,subtasks:d,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:p(l.subtasks)}:l});s=p(s);}return s}function fn({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:n,onTaskDblClick:s,onTaskContextMenu:p,onTaskToggle:m,scrollTop:l,columns:u,onToggleColumn:c,onColumnResize:d,onTaskUpdate:i,onTaskIndent:w,onTaskOutdent:g,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:f,onTaskRename:x,onCreateSubtask:T,onOpenTaskModal:D,onDeleteRequest:I,onTaskReparent:k}){let L=react.useContext(no),[N,C]=react.useState(null),[G,F]=react.useState(null),[J,K]=react.useState(""),de=react.useRef(null),[ge,Te]=react.useState(null),[Ce,z]=react.useState(0),[B,$]=react.useState(0),[P,Q]=react.useState({isOpen:false,x:0,y:0,type:"header"}),[ee,H]=react.useState(null),[De,Ee]=react.useState(null),[Be,xe]=react.useState(null),U=react.useRef(0),ae=5,Me=react.useRef(false),[_e,qe]=react.useState(null),[Ke,O]=react.useState(false),[re,ce]=react.useState(null),[fe,Ae]=react.useState(false),ot=react.useRef(null);react.useEffect(()=>{function _(Z){ot.current&&!ot.current.contains(Z.target)&&Ae(false);}if(fe)return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[fe]),react.useEffect(()=>{G&&de.current&&(de.current.focus(),de.current.select());},[G]),react.useEffect(()=>{if(!ge)return;let _=ve=>{let Y=ve.clientX-Ce,ne=B+Y;d?.(ge,ne);},Z=()=>{Te(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",Z),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",Z),document.body.style.cursor="",document.body.style.userSelect="";}},[ge,Ce,B,d]);let{selectedTaskIds:kt,handleTaskClick:Le,isTaskSelected:ke}=_d(),{setIsEditing:Ie}=Hd({tasks:e,selectedTaskIds:kt,onTaskSelect:(_,Z)=>{let Y=io(e).map(ne=>ne.id);Le(_,Y,Z||false,false);},onTaskCreate:f||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:w||(()=>{}),onTaskOutdent:g||(()=>{}),onTaskRename:_=>{let Z=io(e).find(ve=>ve.id===_);Z&&Ue(Z);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:_=>{let Z=io(e).find(ve=>ve.id===_);Z&&D&&D(Z);},enableKeyboard:true}),Zt=(_,Z=0)=>{let ve=[];for(let Y of _)ve.push({task:Y,level:Z}),Y.subtasks&&Y.subtasks.length>0&&Y.isExpanded&&ve.push(...Zt(Y.subtasks,Z+1));return ve},vt=Zt(e),sa=48,Na=Math.max(vt.length*a,600-sa),Oe=_=>!_.startDate||!_.endDate?"-":`${Math.ceil((_.endDate.getTime()-_.startDate.getTime())/(1e3*60*60*24))}d`,Ue=_=>{F(_.id),K(_.name),Ie(true);},qt=_=>{J.trim()&&J!==e.find(Z=>Z.id===_)?.name&&x?.(_,J.trim()),F(null),K(""),Ie(false);},he=()=>{F(null),K(""),Ie(false);},Ge=(_,Z)=>{Z.stopPropagation(),T?.(_.id);},Fe=(_,Z)=>{Z.preventDefault(),U.current=Z.clientY,H(_),Me.current=false,O(false),qe({x:Z.clientX,y:Z.clientY});},tt=_=>{if(!ee||(Math.abs(_.clientY-U.current)>ae&&!Me.current&&(Me.current=true,O(true)),qe({x:_.clientX,y:_.clientY}),!Me.current))return;let ve=document.querySelectorAll("[data-task-row]"),Y=null,ne=null;ve.forEach(R=>{let W=R.getBoundingClientRect(),Ne=R.getAttribute("data-task-row");if(Ne&&Ne!==ee&&_.clientY>=W.top&&_.clientY<=W.bottom){Y=Ne;let et=_.clientY-W.top,$e=W.height;et<$e*.25?ne="above":et>$e*.75?ne="below":ne="child";}}),Ee(Y),xe(ne);},Xe=()=>{if(Me.current&&ee&&De&&Be){if(Be==="child")k?.(ee,De);else if(Be==="above"||Be==="below"){let _=(Y,ne,R=null)=>{for(let W of Y){if(W.id===ne)return R;if(W.subtasks){let Ne=_(W.subtasks,ne,W.id);if(Ne!==void 0)return Ne}}},Z=_(e,De,null),ve=(Y,ne)=>{let R=Y.findIndex(W=>W.id===ne);return Be==="below"?R+1:R};if(Z===null){let Y=ve(e,De);k?.(ee,null,Y);}else {let Y=vt.find(ne=>ne.task.id===Z)?.task;if(Y?.subtasks){let ne=ve(Y.subtasks,De);k?.(ee,Z,ne);}}}}H(null),Ee(null),xe(null),qe(null),Me.current=false,O(false);};react.useEffect(()=>{if(ee)return document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Xe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Xe),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,De,Be]);let wt=(_,Z,ve)=>{switch(_.id){case "name":let Y=G===Z.id,ne=N===Z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ve*20}px`},children:[k&&jsxRuntime.jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ne?1:.3},onMouseDown:se=>Fe(Z.id,se),title:"Arrastrar para mover tarea",children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-4 h-4"})}),Z.subtasks&&Z.subtasks.length>0?jsxRuntime.jsx("button",{onClick:se=>{se.stopPropagation(),m?.(Z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:Z.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}):jsxRuntime.jsx("div",{className:"w-5 h-5 flex-shrink-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:Z.color||"#3B82F6",opacity:Z.parentId?.6:1,borderColor:Z.isMilestone?t.accent:"transparent",borderWidth:Z.isMilestone?"2px":"0px"},title:Z.isMilestone?"Milestone":Z.parentId?"Subtask":"Task"})}),Y?jsxRuntime.jsx("input",{ref:de,type:"text",value:J,onChange:se=>K(se.target.value),onKeyDown:se=>{se.key==="Enter"?qt(Z.id):se.key==="Escape"&&he();},onBlur:()=>qt(Z.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:se=>se.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"flex-1",style:{color:Z.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Z.parentId?"13px":"14px",fontWeight:Z.isMilestone?600:Z.parentId?400:600,letterSpacing:Z.parentId?"0":"-0.01em"},title:Z.name,children:Z.name}),ne&&!Y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:se=>Ge(Z,se),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:se=>{se.stopPropagation(),Ue(Z);},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 W=_.id==="startDate"?"startDate":"endDate",Ne=Z[W],et=re?.taskId===Z.id&&re?.field===W,$e=se=>se?(typeof se=="string"?new Date(se):se).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:se=>se.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:se=>{if(et)ce(null);else {let Mt=se.currentTarget.getBoundingClientRect();ce({taskId:Z.id,field:W,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:$e(Ne)})]}),et&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ce(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:re?.position.top,left:re?.position.left},onClick:se=>se.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,Mt=new Date(se);Mt.setDate(se.getDate()+1);let aa=new Date(se);aa.setDate(se.getDate()+7);let _r=new Date(se);return _r.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:Mt},{label:"Pr\xF3xima semana",date:aa},{label:"2 semanas",date:_r}].map((ir,Qa)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Tr=>Tr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Tr=>Tr.currentTarget.style.backgroundColor="transparent",onClick:()=>{i?.(Z.id,{[W]:ir.date}),ce(null);},children:ir.label},Qa))})(),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:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{i?.(Z.id,{[W]:void 0}),ce(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:()=>ce(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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:re?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>ce(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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((se,Mt)=>jsxRuntime.jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},Mt))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=re?.month||new Date,Mt=se.getFullYear(),aa=se.getMonth(),_r=new Date(Mt,aa,1).getDay(),Ho=new Date(Mt,aa+1,0).getDate(),ir=new Date,Qa=[];for(let Ut=_r-1;Ut>=0;Ut--)Qa.push({day:new Date(Mt,aa,-Ut).getDate(),date:new Date(Mt,aa-1,new Date(Mt,aa,-Ut).getDate()),isCurrentMonth:false});for(let Ut=1;Ut<=Ho;Ut++)Qa.push({day:Ut,date:new Date(Mt,aa,Ut),isCurrentMonth:true});let Tr=42-Qa.length;for(let Ut=1;Ut<=Tr;Ut++)Qa.push({day:Ut,date:new Date(Mt,aa+1,Ut),isCurrentMonth:false});return Qa.map((Ut,uo)=>{let jn=Ut.date.toDateString()===ir.toDateString(),go=(Ne?typeof Ne=="string"?new Date(Ne):Ne:null)?.toDateString()===Ut.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:Ut.isCurrentMonth?go?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:go?"#3B82F6":"transparent",boxShadow:jn&&!go?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{i?.(Z.id,{[W]:Ut.date}),ce(null);},children:Ut.day},uo)})})()})]})]})]}),document.body)]});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Oe(Z)})});case "assignees":let mt=r.filter(se=>Z.assignees?.some(Mt=>Mt.name===se.name||Mt.initials===se.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Mr,{assignedUsers:mt,availableUsers:r,onChange:se=>{let Mt=se.map(aa=>({id:aa.id,name:aa.name,initials:aa.initials,color:aa.color}));i?.(Z.id,{assignees:Mt.length>0?Mt:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Wl,{status:Z.status||"todo",onChange:se=>{i?.(Z.id,{status:se,progress:se==="completed"?100:Z.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:`${Z.progress}%`,backgroundColor:Z.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:[Z.progress,"%"]})]});case "priority":let Re={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ut={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},$t=Re[Z.priority||"medium"]||"MEDIUM";return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsxRuntime.jsx(Er,{priority:$t,onChange:se=>{se&&i?.(Z.id,{priority:ut[se]||"medium"});}})});default:return null}},st=_=>[{id:"hide",label:"Hide Column",icon:Et.Hide,onClick:()=>c(_),disabled:_==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Et.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Et.SortDesc,onClick:()=>{}}],Qe=_=>_.subtasks&&_.subtasks.length>0?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{I?I(_.id,_.name):h?.([_.id]);}}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:Et.Pencil,onClick:()=>{s?.(_);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{T?.(_.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:L?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Et.MarkIncomplete,onClick:()=>{i?.(_.id,{status:"todo",progress:0});},disabled:_.status==="todo"},{id:"setInProgress",label:L?.contextMenu?.setInProgress||"Set In Progress",icon:Et.SetInProgress,onClick:()=>{i?.(_.id,{status:"in-progress"});},disabled:_.status==="in-progress"},{id:"markComplete",label:L?.contextMenu?.markComplete||"Mark Complete",icon:Et.MarkComplete,onClick:()=>{i?.(_.id,{status:"completed",progress:100});},disabled:_.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:Et.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:L?.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{I?I(_.id,_.name):h?.([_.id]);}}],A=u.filter(_=>_.visible),ue=A.reduce((_,Z)=>_+Z.width,0);return jsxRuntime.jsxs("div",{className:"h-full",style:{backgroundColor:t.bgPrimary,minWidth:ue},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${sa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsxRuntime.jsx("div",{className:"flex items-center flex-1 min-w-0",children:A.map((_,Z)=>{let ve=Z===A.length-1,Y=_.id==="name";return jsxRuntime.jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Y?"":"justify-center"}`,style:{width:`${_.width}px`,minWidth:`${_.minWidth??(Y?200:60)}px`,maxWidth:`${_.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ve?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ne=>{ne.preventDefault(),Q({isOpen:true,x:ne.clientX,y:ne.clientY,type:"header",columnId:_.id});},onMouseEnter:ne=>{ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ne=>{ne.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:_.label,children:_.label}),_.resizable&&jsxRuntime.jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ge===_.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ne=>{ne.preventDefault(),ne.stopPropagation(),Te(_.id),z(ne.clientX),$(_.width);},title:"Drag to resize column",children:jsxRuntime.jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},_.id)})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsxRuntime.jsx(mn,{columns:u,onToggleColumn:c,theme:t}),jsxRuntime.jsx("button",{onClick:()=>Ae(!fe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"})}),fe&&jsxRuntime.jsxs("div",{ref:ot,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:_=>_.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>Ae(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxRuntime.jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Na},children:vt.map(({task:_,level:Z},ve)=>{let Y=ke(_.id),ne=De===_.id,R=ne&&Be==="above",W=ne&&Be==="below",Ne=ne&&Be==="child",et={};return Ne&&(et.backgroundColor=`${t.accent}15`,et.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxRuntime.jsxs(framerMotion.motion.div,{"data-task-row":_.id,className:`flex items-center cursor-pointer group ${ee===_.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Y?t.accentLight:Ne?`${t.accent}15`:ve%2===0?t.bgPrimary:t.bgGrid,...et},onMouseEnter:()=>C(_.id),onMouseLeave:()=>C(null),onClick:$e=>{let Re=io(e).map(se=>se.id),$t=navigator.platform.toUpperCase().indexOf("MAC")>=0?$e.metaKey:$e.ctrlKey;Le(_.id,Re,$t,$e.shiftKey),n?.(_);},onDoubleClick:$e=>{$e.stopPropagation(),s?.(_);},onContextMenu:$e=>{$e.preventDefault(),Q({isOpen:true,x:$e.clientX,y:$e.clientY,type:"task",task:_}),p?.(_,$e);},whileHover:{backgroundColor:Y?t.accentLight:t.hoverBg},children:[R&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),W&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),A.map(($e,mt)=>{let Re=mt===A.length-1,ut=$e.id==="name";return jsxRuntime.jsx("div",{className:`px-4 flex items-center ${ut?"justify-start":"justify-center"}`,style:{width:`${$e.width}px`,minWidth:`${$e.minWidth??(ut?200:60)}px`,maxWidth:`${$e.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Re?"none":`1px solid ${N===_.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:wt($e,_,ut?Z:0)},`${_.id}-${$e.id}`)})]},_.id)})}),jsxRuntime.jsx(so,{isOpen:P.isOpen,x:P.x,y:P.y,items:P.type==="header"&&P.columnId?st(P.columnId):P.type==="task"&&P.task?Qe(P.task):[],onClose:()=>Q({...P,isOpen:false}),theme:t}),Ke&&_e&&ee&&typeof document<"u"&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:_e.x+12,top:_e.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=vt.find(Z=>Z.task.id===ee)?.task;return _?jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:_.name})}):null})()}),document.body)]})}function Zd(e,t){let[a,r]=react.useState("none"),[o,n]=react.useState(0),[s,p]=react.useState(e),[m,l]=react.useState(t),[u,c]=react.useState(null),[d,i]=react.useState(null),[w,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(0),[x,T]=react.useState(0),[D,I]=react.useState(null),[k,L]=react.useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:n,ghostX:s,setGhostX:p,ghostWidth:m,setGhostWidth:l,connectionLine:u,setConnectionLine:c,hoveredTaskId:d,setHoveredTaskId:i,activeZone:w,setActiveZone:g,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:v,setDraggedSegmentStartX:f,segmentDragOffsetX:x,setSegmentDragOffsetX:T,hoveredSegmentIndex:D,setHoveredSegmentIndex:I,isHovered:k,setIsHovered:L,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,K)=>{r("none"),c(null),i(null),p(J),l(K),T(0),h(null),f(0);}}}function hn({task:e,x:t,y:a,width:r,theme:o,dayWidth:n,startDate:s,templates:p,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:c,onDependencyCreate:d,allTaskPositions:i=[],onDragMove:w,onHoverChange:g}){let b=Zd(t,r),h=react.useRef(null),{dragMode:v,setDragMode:f,dragOffset:x,setDragOffset:T,ghostX:D,setGhostX:I,ghostWidth:k,setGhostWidth:L,connectionLine:N,setConnectionLine:C,hoveredTaskId:G,setHoveredTaskId:F,activeZone:J,setActiveZone:K,draggedSegmentIndex:de,setDraggedSegmentIndex:ge,draggedSegmentStartX:Te,setDraggedSegmentStartX:Ce,segmentDragOffsetX:z,setSegmentDragOffsetX:B,hoveredSegmentIndex:$,setHoveredSegmentIndex:P,isHovered:Q,setIsHovered:ee,isDragging:H,isResizing:De,isConnecting:Ee,resetDragState:Be}=b,xe=32,U=8,ae=e.endDate&&e.endDate<new Date&&e.progress<100,Me=e.isCriticalPath,_e=o.name==="neutral"||o.today==="#1C1917",qe=e.status==="completed"||e.progress===100,Ke={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},re=e.isCriticalPath||ae?"#DC2626":e.color?e.color:e.priority&&Ke[e.priority]?Ke[e.priority]:o.taskBarPrimary,fe=(he=>he>=80?20:he>=60?15:he>=50?12:10)(r),Ae=r<50,ot=r<40;react.useEffect(()=>{if(g)if(Q&&!H&&!e.segments){let he=a<100;g({task:e,x:t,y:a,width:r,height:xe,showBelow:he});}else g(null);},[Q,H,e,t,a,r,xe,g]);let kt=he=>he.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Le=()=>{let he=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${he} day${he!==1?"s":""}`},ke=he=>Math.round(he/n)*n,Ie=he=>{let Ge=Math.round(he/n),Fe=new Date(s);return Fe.setDate(Fe.getDate()+Ge),Fe},Zt=(he,Ge)=>{for(let Fe of i){if(Fe.id===e.id)continue;let tt=5;if(he>=Fe.x-tt&&he<=Fe.x+Fe.width+tt&&Ge>=Fe.y-tt&&Ge<=Fe.y+Fe.height+tt)return Fe.id}return null},vt=react.useCallback((he,Ge,Fe)=>{he.preventDefault(),he.stopPropagation();let tt=h.current?.ownerSVGElement;if(!tt)return;let Xe=tt.createSVGPoint();Xe.x=he.clientX,Xe.y=he.clientY;let wt=Xe.matrixTransform(tt.getScreenCTM()?.inverse()),st=Fe!==void 0?Fe:t,Qe=Ge;if(!Qe){let A=wt.x-st;he.shiftKey?(Qe="connect",C({x:t+r,y:a+xe/2})):he.ctrlKey||he.metaKey?Qe="move":he.altKey?Qe=A<r/2?"resize-start":"resize-end":ot?A<r/2?Qe="move":Qe="resize-end":Ae?A<=fe/2?Qe="resize-start":A>=r-fe/2?Qe="resize-end":Qe="move":A<=fe?Qe="resize-start":A>=r-fe?Qe="resize-end":Qe="move";}f(Qe),ee(false),K(null),Qe==="move"?T(wt.x-st):Qe==="connect"?C({x:t+r,y:a+xe/2}):T(0),I(st),L(r);},[t,r,a,xe]),sa=react.useCallback(he=>{if(v==="none")return;let Ge=h.current?.ownerSVGElement;if(!Ge)return;let Fe=Ge.createSVGPoint();Fe.x=he.clientX,Fe.y=he.clientY;let tt=Fe.matrixTransform(Ge.getScreenCTM()?.inverse());if(v==="connect"){C({x:tt.x,y:tt.y});let Xe=Zt(tt.x,tt.y);F(Xe);}else if(v==="move"){let Xe=tt.x-x,wt=ke(Xe);I(wt),L(r);let st=Math.round((wt-t)/n);if(w?.(e.id,st,true),e.segments&&e.segments.length>0&&de!==null){let Qe=wt-Te;B(Qe);}}else if(v==="resize-start"){let Xe=tt.x,wt=ke(Xe),st=t+r-wt;st>=n&&(I(wt),L(st));}else if(v==="resize-end"){let Xe=tt.x,st=ke(Xe)-t;st>=n&&L(st);}},[v,t,r,n,x,e,ke,de,Te,Zt,F,C,I,L,B,w]),Na=react.useCallback(()=>{if(v!=="none"){if(v==="connect")G&&d&&d(e,G),C(null),F(null);else {let he=e.endDate.getTime()-e.startDate.getTime(),Ge,Fe,tt=true;if(v==="move"){if(Ge=Ie(D),Fe=new Date(Ge.getTime()+he),e.segments&&e.segments.length>0&&de!==null){let Xe=Math.round(z/n),wt=e.segments.map((ue,_)=>{if(_===de){let Z=new Date(ue.startDate),ve=new Date(ue.endDate);return Z.setDate(Z.getDate()+Xe),ve.setDate(ve.getDate()+Xe),{startDate:Z,endDate:ve}}return ue}),st=wt.flatMap(ue=>[ue.startDate,ue.endDate]),Qe=new Date(Math.min(...st.map(ue=>ue.getTime()))),A=new Date(Math.max(...st.map(ue=>ue.getTime())));c?.({...e,segments:wt},Qe,A),Be(t,r);return}}else v==="resize-start"?(Ge=Ie(D),Fe=e.endDate,Ge>Fe&&(console.warn("Invalid date range: start date must be before or equal to end date"),tt=false)):v==="resize-end"?(Ge=e.startDate,Fe=Ie(D+k),Fe<Ge&&(console.warn("Invalid date range: end date must be after or equal to start date"),tt=false)):tt=false;tt&&Ge&&Fe&&(Fe.getTime()<Ge.getTime()?console.warn("Invalid date range: end date cannot be before start date"):c?.(e,Ge,Fe));}w?.(e.id,0,false),Be(t,r);}},[v,D,k,e,c,G,d,t,r,n,Ie,z,de,Be,w]);react.useEffect(()=>{if(v==="none")return;let he=Fe=>{sa(Fe);},Ge=()=>{Na();};return window.addEventListener("mousemove",he),window.addEventListener("mouseup",Ge),()=>{window.removeEventListener("mousemove",he),window.removeEventListener("mouseup",Ge);}},[v,sa,Na]);let Oe=H&&!Ee?D:t,Ue=H&&!Ee?k:r,qt=p.taskClass(e);return jsxRuntime.jsxs("g",{ref:h,onMouseEnter:()=>!H&&ee(true),onMouseLeave:()=>{H||(ee(false),K(null));},onClick:()=>!H&&m?.(e),onDoubleClick:he=>{H||(he.stopPropagation(),l?.(e));},onContextMenu:he=>{he.preventDefault(),u?.(e,he);},children:[Q&&!H&&!Ae&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:fe,height:xe,fill:J==="resize-start"?o.accent:"transparent",opacity:J==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-start"),onMouseDown:he=>vt(he,"resize-start")}),jsxRuntime.jsx("rect",{x:t+fe,y:a,width:r-fe*2,height:xe,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:he=>vt(he,"move")}),jsxRuntime.jsx("rect",{x:t+r-fe,y:a,width:fe,height:xe,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:he=>vt(he,"resize-end")})]}),Q&&!H&&ot&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:J==="move"?o.accent:"transparent",opacity:J==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>K("move"),onMouseDown:he=>vt(he,"move")}),jsxRuntime.jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:J==="resize-end"?o.accent:"transparent",opacity:J==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>K("resize-end"),onMouseDown:he=>vt(he,"resize-end")}),Q&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),H&&!Ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:D,y:a,width:k,height:xe,rx:U,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe,y:a,width:Ue,height:xe,rx:U,fill:re,"data-task-class":qt,initial:{opacity:0,scale:.95},animate:{opacity:H&&!Ee?.15:e.parentId?.6:Q?.9:.8,scale:Q&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:he=>vt(he),style:{cursor:H?Ee?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:Oe,y:a,width:Ue*(e.progress/100),height:xe,rx:U,fill:re,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((he,Ge)=>{let Fe=(he.startDate.getTime()-s.getTime())/864e5*n,Xe=(he.endDate.getTime()-s.getTime())/(1e3*60*60*24)*n-Fe+n,wt=H&&v==="move"&&de===Ge,st=$===Ge,Qe=wt?Fe+z:Fe;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!H&&P(Ge),onMouseLeave:()=>!H&&P(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Qe,y:a,width:Xe,height:xe,rx:U,fill:re,initial:{opacity:0,scale:.95},animate:{opacity:wt||e.parentId?.6:st?.9:.8,scale:st&&!H?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:A=>{A.stopPropagation(),ge(Ge),Ce(Fe),vt(A,void 0,Fe);},style:{cursor:H?Ee?"crosshair":De?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Qe,y:a,width:Xe*(e.progress/100),height:xe,rx:U,fill:re,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ge}`)}),_e&&(ae||Me)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Me&&!ae&&jsxRuntime.jsx("rect",{x:Oe,y:a,width:Ue,height:xe,rx:U,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ae&&jsxRuntime.jsx("rect",{x:Oe,y:a,width:Ue,height:xe,rx:U,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ue>60&&!e.segments&&(()=>{let he=p.taskLabel(e),Ge=typeof he=="string"?he:e.name,Fe=Ge.length>Math.floor(Ue/8)?`${Ge.substring(0,Math.floor(Ue/8))}...`:Ge;return jsxRuntime.jsx("text",{x:Oe+12,y:a+xe/2,dominantBaseline:"middle",fill:qe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:qe?"line-through":"none"},children:Fe})})(),Ue>100&&e.progress>0&&e.progress<100&&!H&&!e.segments&&jsxRuntime.jsxs("text",{x:Oe+Ue-12,y:a+xe/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Ue>80&&!H&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:Oe+Ue-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:Oe+Ue-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Q||De)&&!Ee&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:Ae?Oe-15:Oe-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:he=>vt(he,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?Oe-8:Oe-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:v==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="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:Oe+Ue-10,y:a-5,width:Ae?25:20,height:xe+10,fill:"transparent",onMouseDown:he=>vt(he,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:Ae?Oe+Ue:Oe+Ue-3,y:a+6,width:Ae?8:6,height:Ae?xe-12:xe-16,rx:3,fill:v==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:v==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!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+xe/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:he=>{he.stopPropagation(),vt(he,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+r+20,y:a+xe/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),Ee&&N&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+r,y1:a+xe/2,x2:N.x,y2:N.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:N.x,cy:N.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:N.x+15,y:N.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:N.x+10},animate:{opacity:1,x:N.x+15},transition:{duration:.2},children:"Connect"})]}),(Q||H)&&!Ee&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:Oe-2,y:a-2,width:Ue+4,height:xe+4,rx:U+2,fill:"none",stroke:H?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:H?.6:.4,initial:{opacity:0},animate:{opacity:H?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),De&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:D,y1:0,x2:D,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:D+k,y1:0,x2:D+k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Q&&!H&&!e.segments&&!g&&(()=>{let Fe=a<100,tt=Fe?a+xe+13:a-82-13,Xe=Fe?`M ${Oe+Ue/2-6} ${a+xe+3} L ${Oe+Ue/2} ${a+xe+13} L ${Oe+Ue/2+6} ${a+xe+3}`:`M ${Oe+Ue/2-6} ${a-13} L ${Oe+Ue/2} ${a-3} L ${Oe+Ue/2+6} ${a-13}`,wt=tt+22,st=tt+40,Qe=tt+55,A=tt+70,ue=Fe?tt+82-5:a-18;return jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:Fe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Fe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:Xe,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:Oe+Ue/2-120,y:tt,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:Oe+Ue/2,y:wt,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:Oe+Ue/2-110,y:st,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:Oe+Ue/2-70,y:st,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.startDate)}),jsxRuntime.jsx("text",{x:Oe+Ue/2-110,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:Oe+Ue/2-70,y:Qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:kt(e.endDate)}),jsxRuntime.jsx("text",{x:Oe+Ue/2+10,y:st,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:Oe+Ue/2+65,y:st,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Le()}),jsxRuntime.jsx("text",{x:Oe+Ue/2+10,y:Qe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:Oe+Ue/2+65,y:Qe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:Oe+Ue/2-110,y:A,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:Oe+Ue/2-50,y:A,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(_=>_.name).join(", ").substring(0,30),e.assignees.map(_=>_.name).join(", ").length>30?"...":""]})]}),!Fe&&jsxRuntime.jsx("text",{x:Oe+Ue/2,y:ue,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ot?"Left: move \u2022 Right: resize":Ae?"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 tc({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:n,height:s,showBelow:p}=e,m=82,l=13,u=p?o+s+l:o-m-l,c=p?`M ${r+n/2-6} ${o+s+3} L ${r+n/2} ${o+s+13} L ${r+n/2+6} ${o+s+3}`:`M ${r+n/2-6} ${o-13} L ${r+n/2} ${o-3} L ${r+n/2+6} ${o-13}`,d=u+22,i=u+40,w=u+55,g=u+70,b=x=>x.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),h=()=>{if(!a.startDate||!a.endDate)return "N/A";let x=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${x} day${x!==1?"s":""}`};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("path",{d:c,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:r+n/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("text",{x:r+n/2,y:d,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+n/2-110,y:i,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:i,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?b(a.startDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:r+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?b(a.endDate):"N/A"}),jsxRuntime.jsx("text",{x:r+n/2+10,y:i,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:r+n/2+65,y:i,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:h()}),jsxRuntime.jsx("text",{x:r+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:r+n/2+65,y:w,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+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:r+n/2-50,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(x=>x.name).join(", ").substring(0,30),a.assignees.map(x=>x.name).join(", ").length>30?"...":""]})]})]})})}function vn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:n,onHoverChange:s}){let[p,m]=react.useState(false),l=a-e,u=r-t,c=e+l/2,d=`M ${e} ${t} C ${c} ${t}, ${c} ${r}, ${a} ${r}`,i=6,w=Math.atan2(u,l),g=a-i*Math.cos(w-Math.PI/6),b=r-i*Math.sin(w-Math.PI/6),h=a-i*Math.cos(w+Math.PI/6),v=r-i*Math.sin(w+Math.PI/6),f=o.dependency;react.useEffect(()=>{s&&n&&s(p?{x1:e,y1:t,x2:a,y2:r,onDelete:n}:null);},[p,e,t,a,r,n,s]);let x=!n&&!s;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!x&&m(true),onMouseLeave:()=>!x&&m(false),style:{pointerEvents:x?"none":"auto"},children:[!x&&jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&s?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${a} ${r} L ${g} ${b} M ${a} ${r} L ${h} ${v}`,fill:"none",stroke:f,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&s?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:a,cy:r,r:3,fill:f,initial:{scale:0},animate:{scale:p&&s?0:p?1.3:1,opacity:p&&s?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&n&&!s&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),n();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:c,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:c-4,y1:(t+r)/2-4,x2:c+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:c+4,y1:(t+r)/2-4,x2:c-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function kn({task:e,x:t,y:a,theme:r,onClick:o}){let[n,s]=react.useState(false),p=16,m=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:n?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:n?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),n&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:n&&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 pe={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=l=>{l.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,p=new Set,m=l=>{if(!s.has(l)){s.add(l),p.add(l);let u=r.get(l)||[];for(let c of u){if(!s.has(c)&&m(c))return true;if(p.has(c))return true}}return p.delete(l),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=pe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=pe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let n=pe.findTaskById(e,o);if(n)a.unshift(n),o=n.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=pe.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let n=[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(n.join(","));}),r.join(`
|
|
112
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=pe.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=pe.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)=>pe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=pe.findTaskById(e,t);return !a||!a.dependencies?[]:pe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>pe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>pe.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=pe.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 n=t[o];if(!a||n===void 0||n>=a.length||(r=a[n],!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=>pe.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,n=pe.flattenTasks(e);if(n.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=n.map(m=>{let l=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?pe.formatDate(m.startDate):"N/A",m.endDate?pe.formatDate(m.endDate):"N/A",l>0?`${l} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:s,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=pe.flattenTasks(e).map(m=>{let l=m.startDate&&m.endDate?pe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?pe.formatDate(m.startDate):"","End Date":m.endDate?pe.formatDate(m.endDate):"","Duration (days)":l>0?l:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),n=a.utils.json_to_sheet(o),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];n["!cols"]=s;let p=a.utils.book_new();a.utils.book_append_sheet(p,n,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=pe.flattenTasks(e),o=new Map;r.forEach((d,i)=>{o.set(d.id,i+1);});let n=d=>d.toISOString().replace("Z",""),s=pe.getEarliestStartDate(e)||new Date,p=pe.getLatestEndDate(e)||new Date,m=r.map((d,i)=>{let w=o.get(d.id),g=d.startDate&&d.endDate?pe.calculateDuration(d.startDate,d.endDate):0,b=(d.dependencies||[]).filter(h=>o.has(h)).map(h=>`
|
|
113
113
|
<PredecessorLink>
|
|
114
|
-
<PredecessorUID>${o.get(
|
|
114
|
+
<PredecessorUID>${o.get(h)}</PredecessorUID>
|
|
115
115
|
<Type>1</Type>
|
|
116
116
|
<CrossProject>0</CrossProject>
|
|
117
117
|
<LinkLag>0</LinkLag>
|
|
118
118
|
<LagFormat>7</LagFormat>
|
|
119
119
|
</PredecessorLink>`).join("");return `
|
|
120
120
|
<Task>
|
|
121
|
-
<UID>${
|
|
122
|
-
<ID>${
|
|
123
|
-
<Name>${
|
|
121
|
+
<UID>${w}</UID>
|
|
122
|
+
<ID>${i+1}</ID>
|
|
123
|
+
<Name>${d.name.replace(/[<>&'"]/g,h=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[h]||h)}</Name>
|
|
124
124
|
<Type>0</Type>
|
|
125
125
|
<IsNull>0</IsNull>
|
|
126
126
|
<CreateDate>${n(new Date)}</CreateDate>
|
|
127
|
-
<WBS>${
|
|
128
|
-
<OutlineNumber>${
|
|
129
|
-
<OutlineLevel>${
|
|
127
|
+
<WBS>${i+1}</WBS>
|
|
128
|
+
<OutlineNumber>${i+1}</OutlineNumber>
|
|
129
|
+
<OutlineLevel>${d.level||0}</OutlineLevel>
|
|
130
130
|
<Priority>500</Priority>
|
|
131
|
-
<Start>${
|
|
132
|
-
<Finish>${
|
|
133
|
-
<Duration>PT${
|
|
131
|
+
<Start>${d.startDate?n(d.startDate):""}</Start>
|
|
132
|
+
<Finish>${d.endDate?n(d.endDate):""}</Finish>
|
|
133
|
+
<Duration>PT${g*8}H0M0S</Duration>
|
|
134
134
|
<DurationFormat>7</DurationFormat>
|
|
135
|
-
<Work>PT${
|
|
136
|
-
<Stop>${
|
|
137
|
-
<Resume>${
|
|
135
|
+
<Work>PT${g*8}H0M0S</Work>
|
|
136
|
+
<Stop>${d.endDate?n(d.endDate):""}</Stop>
|
|
137
|
+
<Resume>${d.startDate?n(d.startDate):""}</Resume>
|
|
138
138
|
<ResumeValid>0</ResumeValid>
|
|
139
139
|
<EffortDriven>1</EffortDriven>
|
|
140
140
|
<Recurring>0</Recurring>
|
|
141
141
|
<OverAllocated>0</OverAllocated>
|
|
142
142
|
<Estimated>0</Estimated>
|
|
143
|
-
<Milestone>${
|
|
144
|
-
<Summary>${
|
|
145
|
-
<Critical>${
|
|
143
|
+
<Milestone>${d.isMilestone?"1":"0"}</Milestone>
|
|
144
|
+
<Summary>${d.subtasks&&d.subtasks.length>0?"1":"0"}</Summary>
|
|
145
|
+
<Critical>${d.isCriticalPath?"1":"0"}</Critical>
|
|
146
146
|
<IsSubproject>0</IsSubproject>
|
|
147
147
|
<IsSubprojectReadOnly>0</IsSubprojectReadOnly>
|
|
148
148
|
<ExternalTask>0</ExternalTask>
|
|
149
|
-
<EarlyStart>${
|
|
150
|
-
<EarlyFinish>${
|
|
151
|
-
<LateStart>${
|
|
152
|
-
<LateFinish>${
|
|
149
|
+
<EarlyStart>${d.startDate?n(d.startDate):""}</EarlyStart>
|
|
150
|
+
<EarlyFinish>${d.endDate?n(d.endDate):""}</EarlyFinish>
|
|
151
|
+
<LateStart>${d.startDate?n(d.startDate):""}</LateStart>
|
|
152
|
+
<LateFinish>${d.endDate?n(d.endDate):""}</LateFinish>
|
|
153
153
|
<StartVariance>0</StartVariance>
|
|
154
154
|
<FinishVariance>0</FinishVariance>
|
|
155
155
|
<WorkVariance>0</WorkVariance>
|
|
@@ -157,22 +157,22 @@
|
|
|
157
157
|
<TotalSlack>0</TotalSlack>
|
|
158
158
|
<FixedCost>0</FixedCost>
|
|
159
159
|
<FixedCostAccrual>3</FixedCostAccrual>
|
|
160
|
-
<PercentComplete>${
|
|
161
|
-
<PercentWorkComplete>${
|
|
160
|
+
<PercentComplete>${d.progress}</PercentComplete>
|
|
161
|
+
<PercentWorkComplete>${d.progress}</PercentWorkComplete>
|
|
162
162
|
<Cost>0</Cost>
|
|
163
163
|
<OvertimeCost>0</OvertimeCost>
|
|
164
164
|
<OvertimeWork>PT0H0M0S</OvertimeWork>
|
|
165
|
-
<ActualStart>${
|
|
166
|
-
<ActualFinish>${
|
|
167
|
-
<ActualDuration>PT${Math.round(
|
|
165
|
+
<ActualStart>${d.progress>0&&d.startDate?n(d.startDate):""}</ActualStart>
|
|
166
|
+
<ActualFinish>${d.progress===100&&d.endDate?n(d.endDate):""}</ActualFinish>
|
|
167
|
+
<ActualDuration>PT${Math.round(g*d.progress/100)*8}H0M0S</ActualDuration>
|
|
168
168
|
<ActualCost>0</ActualCost>
|
|
169
169
|
<ActualOvertimeCost>0</ActualOvertimeCost>
|
|
170
|
-
<ActualWork>PT${Math.round(
|
|
170
|
+
<ActualWork>PT${Math.round(g*d.progress/100)*8}H0M0S</ActualWork>
|
|
171
171
|
<ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
|
|
172
|
-
<RegularWork>PT${
|
|
173
|
-
<RemainingDuration>PT${Math.round(
|
|
172
|
+
<RegularWork>PT${g*8}H0M0S</RegularWork>
|
|
173
|
+
<RemainingDuration>PT${Math.round(g*(100-d.progress)/100)*8}H0M0S</RemainingDuration>
|
|
174
174
|
<RemainingCost>0</RemainingCost>
|
|
175
|
-
<RemainingWork>PT${Math.round(
|
|
175
|
+
<RemainingWork>PT${Math.round(g*(100-d.progress)/100)*8}H0M0S</RemainingWork>
|
|
176
176
|
<RemainingOvertimeCost>0</RemainingOvertimeCost>
|
|
177
177
|
<RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
|
|
178
178
|
<ACWP>0</ACWP>
|
|
@@ -191,17 +191,17 @@
|
|
|
191
191
|
<PhysicalPercentComplete>0</PhysicalPercentComplete>
|
|
192
192
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
193
193
|
<IsPublished>1</IsPublished>
|
|
194
|
-
<CommitmentType>0</CommitmentType>${
|
|
195
|
-
</Task>`}).join(""),
|
|
194
|
+
<CommitmentType>0</CommitmentType>${b}
|
|
195
|
+
</Task>`}).join(""),l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
196
196
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
197
197
|
<SaveVersion>14</SaveVersion>
|
|
198
|
-
<Name>${t.replace(/[<>&'"]/g,
|
|
199
|
-
<Title>${t.replace(/[<>&'"]/g,
|
|
198
|
+
<Name>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Name>
|
|
199
|
+
<Title>${t.replace(/[<>&'"]/g,d=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[d]||d)}</Title>
|
|
200
200
|
<CreationDate>${n(new Date)}</CreationDate>
|
|
201
201
|
<LastSaved>${n(new Date)}</LastSaved>
|
|
202
202
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
203
|
-
<StartDate>${n(
|
|
204
|
-
<FinishDate>${n(
|
|
203
|
+
<StartDate>${n(s)}</StartDate>
|
|
204
|
+
<FinishDate>${n(p)}</FinishDate>
|
|
205
205
|
<FYStartDate>1</FYStartDate>
|
|
206
206
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
207
207
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -337,11 +337,11 @@
|
|
|
337
337
|
</WeekDays>
|
|
338
338
|
</Calendar>
|
|
339
339
|
</Calendars>
|
|
340
|
-
<Tasks>${
|
|
340
|
+
<Tasks>${m}
|
|
341
341
|
</Tasks>
|
|
342
|
-
</Project>`,l=new Blob([d],{type:"application/xml;charset=utf-8;"}),s=document.createElement("a");s.href=URL.createObjectURL(l),s.download=a,s.click(),URL.revokeObjectURL(s.href);},calculateCriticalPath:e=>{let t=pe.flattenTasks(e),a=t.filter(d=>d.startDate&&d.endDate);if(a.length===0)return [];let r=new Map,o=d=>{if(r.has(d.id))return;let l=d.startDate&&d.endDate?pe.calculateDuration(d.startDate,d.endDate):0,s=0;if(d.dependencies&&d.dependencies.length>0)for(let f of d.dependencies){let c=t.find(w=>w.id===f);if(c){o(c);let w=r.get(f)?.ef||0;s=Math.max(s,w);}}let g=s+l;r.set(d.id,{es:s,ef:g});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(d=>d.ef)),i=new Map,m=d=>{if(i.has(d.id))return;let l=d.startDate&&d.endDate?pe.calculateDuration(d.startDate,d.endDate):0,s=t.filter(c=>c.dependencies&&c.dependencies.includes(d.id)),g=n;if(s.length>0)for(let c of s){m(c);let w=i.get(c.id)?.ls||0;g=Math.min(g,w);}let f=g-l;i.set(d.id,{ls:f,lf:g});};a.forEach(m);let p=[];for(let d of a){let l=r.get(d.id),s=i.get(d.id);if(l&&s){let g=s.ls-l.es;Math.abs(g)<.01&&p.push(d.id);}}return p},calculateSlack:(e,t)=>{let a=pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(pe.calculateCriticalPath(e).includes(t))return 0;let o=pe.getDependentTasks(e,t);if(o.length===0){let m=pe.getLatestEndDate(e);if(!m)return null;let p=pe.calculateDuration(a.endDate,m);return Math.max(0,p)}let n=o.filter(m=>m.startDate).map(m=>m.startDate.getTime()).sort((m,p)=>m-p)[0];if(!n)return null;let i=pe.calculateDuration(a.endDate,new Date(n));return Math.max(0,i)},isOnCriticalPath:(e,t)=>pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=pe.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let i of o){if(!i.startDate||!i.endDate)continue;let m=pe.calculateDuration(i.startDate,i.endDate),p;a!==void 0?(p=new Date(i.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let d=pe.calculateEndDate(p,m),l=s=>s.map(g=>g.id===i.id?{...g,startDate:p,endDate:d}:g.subtasks?{...g,subtasks:l(g.subtasks)}:g);n=l(n),n=pe.autoScheduleDependents(n,i.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,i,m)=>{if(a===0)return [];let p=[],d=o.getTime(),l=1e3*60*60*24,s=pe.findTaskById(e,t);if(!s||!s.endDate)return [];let g=(f,c,w=new Set)=>{if(w.has(f))return;w.add(f);let h=pe.getDependentTasks(e,f);for(let k of h){if(!k.startDate||!k.endDate)continue;let u=r.findIndex(C=>C.id===k.id);if(u===-1)continue;let y=k.startDate.getTime(),D=(k.endDate.getTime()-y)/l,M=(y-d)/l*n,v=M+c*n,B=Math.max(D*n,n),S=m+u*i+12;p.push({taskId:k.id,taskName:k.name,originalX:M,previewX:v,width:B,y:S,rowIndex:u,daysDelta:c,color:k.color}),g(k.id,c,w);}};return g(t,a),p},splitTask:(e,t,a,r=3)=>{let o=pe.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 n=new Date(a);n.setDate(n.getDate()-1);let i=new Date(a);i.setDate(i.getDate()+r);let m=new Date(o.endDate);m.setDate(m.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:n},{startDate:i,endDate:m}],d=l=>l.map(s=>s.id===o.id?{...s,endDate:m,segments:p}:s.subtasks?{...s,subtasks:d(s.subtasks)}:s);return d(e)}};function Cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:i,templates:m,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:l,onTaskDateChange:s,onDependencyCreate:g,onDependencyDelete:f}){let[w,h]=react.useState([]),[k,u]=react.useState(null),[y,x]=react.useState(null),D=react.useCallback(F=>{u(F);},[]),T=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),M=r==="day"?60:r==="week"?20:8,v=T*M*i,B=F=>{let I=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate())),R=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-R);let P=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-P.getTime())/864e5+1)/7)},S=F=>{let I=F.getDay();return I===0||I===6},C=react.useCallback(F=>{let I=Math.round(F/(M*i)),R=new Date(o);return R.setDate(R.getDate()+I),R},[o,M,i]),$=react.useCallback((F,I)=>{if(I.startDate&&I.endDate)return;let R=F.currentTarget.ownerSVGElement;if(!R)return;let P=R.createSVGPoint();P.x=F.clientX,P.y=F.clientY;let X=P.matrixTransform(R.getScreenCTM()?.inverse()),ee=C(X.x),z=new Date(ee);z.setDate(z.getDate()+1),s?.(I,ee,z);},[C,s]),L=react.useMemo(()=>{let F=X=>X.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let z=F(ee.subtasks),ye=z.filter(Se=>Se.startDate&&Se.endDate);if(ye.length>0){let Se=ye.map(ze=>ze.startDate.getTime()),We=ye.map(ze=>ze.endDate.getTime()),Te=new Date(Math.min(...Se)),Xe=new Date(Math.max(...We));return {...ee,subtasks:z,startDate:Te,endDate:Xe}}return {...ee,subtasks:z}}return ee}),I=(X,ee=[])=>{for(let z of X)ee.push(z),z.subtasks&&z.subtasks.length>0&&(z.isExpanded===void 0||z.isExpanded)&&I(z.subtasks,ee);return ee},R=F(e);return I(R)},[e]),q=react.useCallback(F=>{if(!F.startDate||!F.endDate)return {x:0,width:0};let I=F.startDate.getTime(),R=F.endDate.getTime(),P=o.getTime(),X=(I-P)/(1e3*60*60*24),ee=(R-I)/(1e3*60*60*24),z=X*M*i,ye=Math.max(M*i,40),Se=Math.max(ee*M*i,ye);return {x:z,width:Se}},[o,M,i]),j=react.useMemo(()=>L.filter(F=>F.startDate&&F.endDate).map(F=>{let{x:I,width:R}=q(F),X=L.findIndex(ee=>ee.id===F.id)*a+12;return {id:F.id,x:I,y:X,width:R,height:32}}),[L,q]),me=react.useCallback((F,I,R)=>{if(!R||I===0){h([]);return}let P=pe.calculateCascadePreview(e,F,I,L,o,M*i,a,48);h(P);},[e,L,o,M,i,a,48]),he=react.useMemo(()=>{let F=[],I=new Date(o);for(;I<=n;){let X=(I.getTime()-o.getTime())/864e5*M*i;if(r==="day")F.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:X}),I.setDate(I.getDate()+1);else if(r==="week"){let ee=B(I);F.push({date:new Date(I),label:`Week ${ee}`,x:X}),I.setDate(I.getDate()+7);}else F.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:X}),I.setMonth(I.getMonth()+1);}return F},[o,n,r,M,i]),W=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*M*i,[o,M,i]),te=Math.max(L.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(v,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(v,1e3),height:48,fill:t.bgGrid}),he.map((F,I)=>jsxRuntime.jsxs("g",{children:[I>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:F.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:F.label})]},`header-${I}`)),W>=0&&W<=v&&jsxRuntime.jsx("circle",{cx:W,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(v,1e3),height:te,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(v,1e3),height:te,fill:t.bgPrimary}),he.map((F,I)=>{let R=he[I+1]?.x||v,P=S(F.date);return jsxRuntime.jsxs("g",{children:[P&&jsxRuntime.jsx("rect",{x:F.x,y:0,width:R-F.x,height:L.length*a,fill:t.bgWeekend,opacity:1}),I>0&&jsxRuntime.jsx("line",{x1:F.x,y1:0,x2:F.x,y2:L.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},I)}),L.map((F,I)=>{let R=F.startDate&&F.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:v,height:a,fill:I%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${F.id}`),!R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:I*a,width:v,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>$(P,F),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${F.id}`),jsxRuntime.jsx("text",{x:W>0?W:100,y:I*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-${F.id}`)]})]},`row-group-${F.id}`)}),L.map((F,I)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(R=>{let P=L.find(ye=>ye.id===R);if(!P||!P.startDate||!P.endDate)return null;let X=L.findIndex(ye=>ye.id===R),ee=q(P),z=q(F);return jsxRuntime.jsx(vn,{x1:ee.x+ee.width,y1:X*a+a/2,x2:z.x,y2:I*a+a/2,theme:t},`dep-${R}-${F.id}`)})),L.map((F,I)=>{if(!F.startDate||!F.endDate)return null;let{x:R,width:P}=q(F),X=I*a+12,ee=F.subtasks&&F.subtasks.length>0&&!F.isMilestone;return F.isMilestone?jsxRuntime.jsx(kn,{task:F,x:R+P/2,y:X+16,theme:t,onClick:p},F.id):ee?jsxRuntime.jsxs("g",{onClick:()=>p?.(F),onContextMenu:z=>{z.preventDefault(),z.stopPropagation(),l?.(F,z);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:R,y:X,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:R,y1:X,x2:R+P,y2:X,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:X,x2:R,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R+P,y1:X,x2:R+P,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:X+32,x2:R+P,y2:X+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsxRuntime.jsx("text",{x:R+12,y:X+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:F.name})]},F.id):jsxRuntime.jsx(hn,{task:F,x:R,y:X,width:P,theme:t,dayWidth:M*i,startDate:o,templates:m,onClick:p,onDoubleClick:d,onContextMenu:l,onDateChange:s,onDependencyCreate:g,allTaskPositions:j,onDragMove:me,onHoverChange:D},F.id)}),L.map((F,I)=>!F.dependencies||F.dependencies.length===0||!F.startDate||!F.endDate?null:F.dependencies.map(R=>{let P=L.find(ue=>ue.id===R);if(!P||!P.startDate||!P.endDate)return null;let X=L.findIndex(ue=>ue.id===R),ee=q(P),z=q(F),ye=ee.x+ee.width,Se=X*a+a/2,We=z.x,Te=I*a+a/2,Xe=We-ye,ze=ye+Xe/2,Qe=ue=>{let Ee=1-ue,Ae=Ee*Ee,rt=Ae*Ee,wt=ue*ue,Be=wt*ue,ke=rt*ye+3*Ae*ue*ze+3*Ee*wt*ze+Be*We,Pe=rt*Se+3*Ae*ue*Se+3*Ee*wt*Te+Be*Te;return {x:ke,y:Pe}},yt=20,pt=[];for(let ue=0;ue<=yt;ue++){let Ee=.1+ue/yt*.8;pt.push(Qe(Ee));}let dt=pt[0],O=`M ${dt.x} ${dt.y} `+pt.slice(1).map(ue=>`L ${ue.x} ${ue.y}`).join(" ");return y&&y.x1===ye&&y.y1===Se&&y.x2===We&&y.y2===Te?null:jsxRuntime.jsx("path",{d:O,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:ye,y1:Se,x2:We,y2:Te,onDelete:()=>f?.(F.id,R)});}},`dep-hover-${R}-${F.id}`)})),w.map(F=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:F.previewX,y:F.y-48,width:F.width,height:32,rx:8,fill:F.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(F.daysDelta)>0&&jsxRuntime.jsx("text",{x:F.previewX+F.width/2,y:F.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:F.daysDelta>0?`+${F.daysDelta}d`:`${F.daysDelta}d`})]},`cascade-preview-${F.taskId}`)),y&&(()=>{let{x1:F,y1:I,x2:R,y2:P,onDelete:X}=y,ee=R-F,z=P-I,ye=F+ee/2,Se=(I+P)/2,We=`M ${F} ${I} C ${ye} ${I}, ${ye} ${P}, ${R} ${P}`,Te=6,Xe=Math.atan2(z,ee),ze=R-Te*Math.cos(Xe-Math.PI/6),Qe=P-Te*Math.sin(Xe-Math.PI/6),yt=R-Te*Math.cos(Xe+Math.PI/6),pt=P-Te*Math.sin(Xe+Math.PI/6),dt=t.dependency,O="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>x(null),children:[jsxRuntime.jsx("path",{d:We,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:ye,cy:Se,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:We,fill:"none",stroke:dt,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:We,fill:"none",stroke:dt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${R} ${P} L ${ze} ${Qe} M ${R} ${P} L ${yt} ${pt}`,fill:"none",stroke:dt,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:R,cy:P,r:4,fill:dt,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ue=>{ue.stopPropagation(),x(null),X();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:ye,cy:Se,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:O,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:ye-3,y1:Se-3,x2:ye+3,y2:Se+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:ye+3,y1:Se-3,x2:ye-3,y2:Se+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),W>=0&&W<=v&&jsxRuntime.jsx("line",{x1:W,y1:0,x2:W,y2:te,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),k&&jsxRuntime.jsx(tc,{tooltipData:k,theme:t})]})]})}var Tn=[{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 ci=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],mi=[{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 Dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:i=false,mode:m=a?"edit":"create",theme:p="dark",customStatuses:d=[],availableTags:l=[],onCreateTag:s,attachments:g=[],onUploadAttachments:f,onDeleteAttachment:c}){let w=[...ci,...d.filter(O=>!ci.some(oe=>oe.id===O.id))],h=Ve[p]||Ve.dark,[k,u]=react.useState(false),[y,x]=react.useState(false),[D,T]=react.useState(false),[M,v]=react.useState(false),[B,S]=react.useState({top:0,left:0}),[C,$]=react.useState(null),[L,q]=react.useState(new Date),[j,me]=react.useState({top:0,left:0}),[he,W]=react.useState(false),[te,F]=react.useState([]),I=react.useRef(null),R=react.useRef(null),P=react.useRef(null),X=react.useRef(null),ee=react.useRef(null),[z,ye]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Se,We]=react.useState({});react.useEffect(()=>{a?(ye({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&W(true)):(ye({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),W(false),F([]));},[a,e]),react.useEffect(()=>{let O=oe=>{I.current&&!I.current.contains(oe.target)&&u(false),R.current&&!R.current.contains(oe.target)&&x(false),P.current&&!P.current.contains(oe.target)&&T(false),X.current&&!X.current.contains(oe.target)&&v(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let Te=()=>{let O={};return z.name.trim()||(O.name="El nombre es requerido"),z.startDate&&z.endDate&&z.startDate>z.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),We(O),Object.keys(O).length===0},Xe=async O=>{if(O.preventDefault(),!!Te())try{let oe=m==="create"&&te.length>0?{...z,pendingFiles:te}:z;await n(oe),F([]),t();}catch(oe){console.error("Error submitting task:",oe);}},ze=(O,oe)=>{ye(ue=>{let Ee={...ue,[O]:oe};if(O==="status"){let Ae=oe;Ae==="todo"?Ee.progress=0:Ae==="in-progress"?(ue.progress===0||ue.progress===100)&&(Ee.progress=50):Ae==="completed"||Ae==="closed"?Ee.progress=100:(Ae==="in-review"||Ae==="review")&&(Ee.progress=75);}if(O==="progress"){let Ae=typeof oe=="number"?oe:parseInt(oe,10);Ae===100&&ue.status!=="completed"?Ee.status="completed":Ae>0&&Ae<100&&ue.status==="todo"?Ee.status="in-progress":Ae===0&&ue.status!=="todo"&&(Ee.status="todo");}return Ee}),Se[O]&&We(ue=>{let Ee={...ue};return delete Ee[O],Ee});},Qe=w.find(O=>O.id===z.status)??ci[0],yt=mi.find(O=>O.id===z.priority)??mi[1],pt=Tn.find(O=>O.value===z.color)??Tn[0],dt={backgroundColor:h.bgSecondary,border:`1px solid ${h.borderLight}`,color:h.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${h.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Qe.color||h.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textSecondary},children:m==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:h.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=h.hoverBg,O.currentTarget.style.color=h.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=h.textTertiary;},disabled:i,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:Xe,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:z.name,onChange:O=>ze("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:h.textPrimary},placeholder:"Nombre de la tarea",disabled:i,autoFocus:true}),Se.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"}),Se.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:z.description||"",onChange:O=>ze("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:h.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:i})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:I,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!i&&u(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...dt,borderColor:Qe.color,backgroundColor:`${Qe.color}15`},disabled:i,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Qe.color}}),jsxRuntime.jsx("span",{style:{color:Qe.color},children:Qe.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Qe.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:k&&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:h.bgPrimary,border:`1px solid ${h.border}`},children:w.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("status",O.id),u(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,z.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:R,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!i&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:i,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:yt.color}}),jsxRuntime.jsx("span",{children:yt.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:mi.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:oe=>oe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:oe=>oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,z.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:P,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!i&&T(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:i,children:[z.assignees&&z.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:z.assignees.slice(0,3).map((O,oe)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||h.accent,borderColor:h.bgSecondary},children:O.initials},oe))}),z.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:h.textTertiary},children:["+",z.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:D&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},children:o.map(O=>{let oe=z.assignees?.some(ue=>ue.name===O.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:ue=>ue.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ue=oe?(z.assignees||[]).filter(Ee=>Ee.name!==O.name):[...z.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(Ee=>Ee[0]).join("").toUpperCase().slice(0,2),color:h.accent}];ze("assignees",ue);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:h.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:oe&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:X,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!i)if(M)v(false);else {if(X.current){let O=X.current.getBoundingClientRect(),oe=window.innerHeight,ue=120,Ae=oe-O.bottom<ue?O.top-ue-8:O.bottom+8;S({top:Ae,left:O.left});}v(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:i,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:z.color}}),jsxRuntime.jsx("span",{children:pt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:M&&jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>v(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Tn.slice(0,18).map(O=>{let oe=z.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),ze("color",O.value),v(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:oe?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),l.length>0||s?jsxRuntime.jsx($a,{selectedTags:z.tags||[],availableTags:l,onChange:O=>ze("tags",O),onCreateTag:s,theme:h,disabled:i}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:h.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!i&&!z.isMilestone)if(C==="start")$(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),oe=window.innerHeight,ue=320,Ae=oe-O.bottom<ue?O.top-ue-8:O.bottom+8;me({top:Ae,left:O.left});}$("start"),q(z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:i||z.isMilestone,children:z.startDate?z.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!i&&!z.isMilestone)if(C==="end")$(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),oe=window.innerHeight,ue=320,Ae=oe-O.bottom<ue?O.top-ue-8:O.bottom+8;me({top:Ae,left:O.left});}$("end"),q(z.endDate||z.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:z.isMilestone?.5:1,cursor:z.isMilestone?"not-allowed":"pointer"},disabled:i||z.isMilestone,children:z.endDate?z.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${j.top}px`,left:`${j.left}px`,zIndex:99999,backgroundColor:h.bgPrimary,border:`1px solid ${h.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${h.border}`},children:[(()=>{let O=new Date,oe=new Date(O);oe.setDate(O.getDate()+1);let ue=new Date(O);ue.setDate(O.getDate()+7);let Ee=new Date(O);return Ee.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:ue},{label:"2 semanas",date:Ee}].map((rt,wt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:Be=>Be.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:Be=>Be.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(ze("startDate",rt.date),(!z.endDate||rt.date>z.endDate)&&ze("endDate",rt.date),$("end")):(ze("endDate",rt.date),(!z.startDate||rt.date<z.startDate)&&ze("startDate",rt.date),$(null));},children:rt.label},wt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${h.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{ze("startDate",void 0),ze("endDate",void 0),$(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:()=>q(new Date(L.getFullYear(),L.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary},children:L.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>q(new Date(L.getFullYear(),L.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,oe)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:O},oe))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=L.getFullYear(),oe=L.getMonth(),ue=new Date(O,oe,1).getDay(),Ee=new Date(O,oe+1,0).getDate(),Ae=new Date,rt=[];for(let Be=ue-1;Be>=0;Be--)rt.push({day:new Date(O,oe,-Be).getDate(),date:new Date(O,oe-1,new Date(O,oe,-Be).getDate()),isCurrentMonth:false});for(let Be=1;Be<=Ee;Be++)rt.push({day:Be,date:new Date(O,oe,Be),isCurrentMonth:true});let wt=42-rt.length;for(let Be=1;Be<=wt;Be++)rt.push({day:Be,date:new Date(O,oe+1,Be),isCurrentMonth:false});return rt.map((Be,ke)=>{let Pe=Be.date.toDateString()===Ae.toDateString(),qt=z.startDate?.toDateString()===Be.date.toDateString(),it=z.endDate?.toDateString()===Be.date.toDateString(),ta=z.startDate&&z.endDate&&Be.date>=z.startDate&&Be.date<=z.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:Be.isCurrentMonth?qt||it?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:qt?"#3B82F6":it?"#7C3AED":ta?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Pe&&!qt&&!it?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(ze("startDate",Be.date),z.endDate&&Be.date>z.endDate&&ze("endDate",Be.date),$("end")):(ze("endDate",Be.date),z.startDate&&Be.date<z.startDate&&ze("startDate",Be.date),$(null));},children:Be.day},ke)})})()})]})]})]})})]}),Se.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Se.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:h.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:z.progress,onChange:O=>ze("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,accentColor:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},disabled:i}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"}20`,color:z.progress<30?"#EF4444":z.progress<70?"#F59E0B":"#10B981"},children:[z.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>W(!he),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:h.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${he?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:he&&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:[(f||g.length>0||m==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:h.textTertiary},children:["Adjuntos ",m==="create"?te.length>0&&`(${te.length})`:g.length>0&&`(${g.length})`]})]}),m==="create"?jsxRuntime.jsx(Ha,{cardId:"pending",attachments:te.map((O,oe)=>({id:`pending-${oe}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>F(oe=>[...oe,...O]),onDelete:O=>{let oe=parseInt(O.replace("pending-",""),10);F(ue=>ue.filter((Ee,Ae)=>Ae!==oe));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(Ha,{cardId:a?.id||"new",attachments:g,onUpload:f&&a?.id?O=>f(a.id,O):void 0,onDelete:c,maxSizeMB:10,maxFiles:20}),m==="create"&&te.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[te.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:z.isMilestone,onChange:O=>ze("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:i}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:h.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:h.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:h.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let oe=z.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ue=oe?(z.dependencies||[]).filter(Ee=>Ee!==O.id):[...z.dependencies||[],O.id];ze("dependencies",ue);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:oe?`${h.accent}30`:h.bgPrimary,color:oe?h.accent:h.textSecondary,border:`1px solid ${oe?h.accent:h.borderLight}`},disabled:i,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${h.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:h.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:i,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:i,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:h.accent,color:"#FFF"},onMouseEnter:O=>!i&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!i&&(O.currentTarget.style.opacity="1"),children:i?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:m==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var o0=['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"'],sc=()=>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"})]}),n0=()=>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"})}),s0=()=>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"})}),i0=()=>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"})}),l0=()=>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 Nn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:i,onDependencyCreate:m,onDependencyDelete:p}){let[d,l]=react.useState(false),[s,g]=react.useState(false),[f,c]=react.useState([]),[w,h]=react.useState(""),[k,u]=react.useState(false),[y,x]=react.useState(true),D=react.useRef(null),T=react.useRef(null),M=react.useRef(null),{enabled:v=true,placeholder:B='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:S="bottom-right",onCommand:C,suggestions:$=o0,maxHistory:L=50,persistHistory:q}=a,j=q?.storageKey||"gantt-ai-history",me=q?.maxMessages??5;react.useEffect(()=>{if(q?.enabled)try{let R=localStorage.getItem(j);if(R){let X=JSON.parse(R).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));c(X.slice(-me));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[q?.enabled,j,me]),react.useEffect(()=>{if(q?.enabled&&f.length>0)try{let R=f.filter(P=>!P.isLoading).slice(-me);localStorage.setItem(j,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[f,q?.enabled,j,me]),react.useEffect(()=>{T.current&&T.current.scrollIntoView({behavior:"smooth"});},[f]),react.useEffect(()=>{d&&!s&&D.current&&setTimeout(()=>D.current?.focus(),100);},[d,s]);let he=react.useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&n?.(R.newTask);break;case "delete_task":R.taskId&&i?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&m?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,n,i,m,p]),W=react.useCallback(async R=>{if(!R.trim()||k)return;let P={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};c(ee=>[...ee.slice(-(L-1)),P]),h(""),x(false),u(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};c(ee=>[...ee,X]);try{if(C){let ee=await C(R,e);c(z=>{let ye=z.filter(We=>!We.isLoading),Se={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...ye,Se]}),he(ee);}else c(ee=>[...ee.filter(ye=>!ye.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(ee){c(z=>[...z.filter(Se=>!Se.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{u(false);}},[k,L,C,e,he]),te=R=>{R.preventDefault(),W(w);},F=R=>{h(R),D.current?.focus();};if(react.useEffect(()=>{let R=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),l(X=>!X),d||g(false)),P.key==="Escape"&&d&&l(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[d]),react.useEffect(()=>{if(!d)return;let R=X=>{let ee=X.target;M.current&&!M.current.contains(ee)&&l(false);},P=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",R);}},[d]),!v)return null;let I={"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(nt,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&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 ${I[S]} 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:()=>l(true),children:[jsxRuntime.jsx(sc,{}),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:d&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:s?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${I[S]} 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(sc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>g(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(i0,{})}),jsxRuntime.jsx("button",{onClick:()=>l(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(s0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!s&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[f.length===0&&y&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:$.slice(0,4).map((R,P)=>jsxRuntime.jsx("button",{onClick:()=>F(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},P))})]}),f.map(R=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsxRuntime.jsx(l0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsxRuntime.jsx("div",{ref:T})]}),jsxRuntime.jsxs("form",{onSubmit:te,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:w,onChange:R=>h(R.target.value),placeholder:B,disabled:k,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!w.trim()||k,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(n0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function ic(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((d,l=true)=>{r(s=>{let g=typeof d=="function"?d(s.present):d;if(o.current)return {...s,present:g};if(!l)return {...s,present:g};let f=[...s.past,s.present];return f.length>t&&f.shift(),{past:f,present:g,future:[]}});},[t]),i=react.useCallback(()=>{r(d=>{if(d.past.length===0)return d;let l=d.past[d.past.length-1],s=d.past.slice(0,d.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:s,present:l,future:[d.present,...d.future]}});},[]),m=react.useCallback(()=>{r(d=>{if(d.future.length===0)return d;let l=d.future[0],s=d.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...d.past,d.present],present:l,future:s}});},[]),p=react.useCallback(()=>{r(d=>({past:[],present:d.present,future:[]}));},[]);return {state:a.present,setState:n,undo:i,redo:m,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=i=>{let m=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=m?i.metaKey:i.ctrlKey;if(p&&i.key==="z"&&!i.shiftKey&&a){i.preventDefault(),e();return}if(r){if(!m&&p&&i.key==="y"){i.preventDefault(),t();return}if(m&&p&&i.shiftKey&&i.key==="z"){i.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var p0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${pe.formatDate(e.startDate)} - ${pe.formatDate(e.endDate)}`);let a=pe.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=>pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dc(e){return {...p0,...e}}var v0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},pc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:i="week",rowDensity:m="comfortable",showThemeSelector:p=true,showExportButton:d=true,availableUsers:l=[],templates:s,enableAutoCriticalPath:g=true,persistExpandedState:f,aiAssistant:c,locale:w="en",customTranslations:h,showCreateTaskButton:k=false,createTaskLabel:u,onCreateTask:y,onThemeChange:x,onTaskClick:D,onTaskDblClick:T,onTaskContextMenu:M,onTaskUpdate:v,onProgressChange:B,onTaskEdit:S,onTaskAddSubtask:C,onTaskMarkIncomplete:$,onTaskSetInProgress:L,onDependencyCreate:q,onDependencyDelete:j,onBeforeTaskAdd:me,onAfterTaskAdd:he,onBeforeTaskUpdate:W,onAfterTaskUpdate:te,onBeforeTaskDelete:F,onAfterTaskDelete:I}=a,P=react.useContext(dn)?.theme,[X,ee]=react.useState(P||n||"dark"),[z,ye]=react.useState(i),[Se,We]=react.useState(m),[Te,Xe]=react.useState(1),[ze,Qe]=react.useState(0),[yt,pt]=react.useState(false),[dt,O]=react.useState(null),[oe,ue]=react.useState({isOpen:false,x:0,y:0,task:null}),[Ee,Ae]=react.useState(null),[rt,wt]=react.useState(null);react.useEffect(()=>{P&&P!==X&&ee(P);},[P]),react.useEffect(()=>{n&&n!==X&&ee(n);},[n]);let Be=react.useCallback(N=>{ee(N),x?.(N);},[x]),{state:ke,setState:Pe,undo:qt,redo:it,canUndo:ta,canRedo:H,clearHistory:re}=ic(t,50),be=react.useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),tt=react.useRef(new Map),ie=react.useRef(false);if(!ie.current&&f){ie.current=true;let N=typeof f=="string"?f:"gantt-expanded-tasks";try{let E=localStorage.getItem(N);if(E){let G=JSON.parse(E);Array.isArray(G)&&(tt.current=new Map(G));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let K=react.useCallback(()=>{let N=be();if(N)try{let E=Array.from(tt.current.entries());localStorage.setItem(N,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[be]);react.useEffect(()=>{let N=E=>E.map(G=>{let se=tt.current.get(G.id),fe=se!==void 0?{...G,isExpanded:se}:G;return fe.subtasks?.length?{...fe,subtasks:N(fe.subtasks)}:fe});tt.current.size>0?Pe(N(t)):Pe(t);},[t,Pe]);let ae=react.useRef(t),Me=react.useRef(true);react.useEffect(()=>{if(Me.current){Me.current=false,ae.current=ke;return}if(!r)return;let N=JSON.stringify(ae.current),E=JSON.stringify(ke);N!==E&&(ae.current=ke,r(ke));},[ke,r]);let le=react.useMemo(()=>Ys(w,h),[w,h]),Je=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}],[]),[$e,Re]=react.useState(()=>Je(le));react.useEffect(()=>{Re(N=>N.map(E=>({...E,label:le.columns[E.id==="name"?"taskName":E.id]||E.label})));},[le]);let Le=react.useMemo(()=>$e.filter(E=>E.visible).reduce((E,G)=>E+G.width,0),[$e]),Ne=react.useRef($e.filter(N=>N.visible).map(N=>N.id).join(","));react.useEffect(()=>{let N=$e.filter(se=>se.visible),E=N.map(se=>se.id).join(","),G=Ne.current;if(E!==G){let se=N.some(Ce=>Ce.id!=="name"),fe=G.includes(",");se?!fe&&se&&O(null):O(null),Ne.current=E;}},[$e]);let _=60,J=.6,De=react.useMemo(()=>{let E=Le+_,G=typeof window<"u"?window.innerWidth*J:800,se=Math.max(E,G);return dt!==null?Math.max(200,Math.min(dt,se)):Math.max(200,E)},[dt,Le]),_e=react.useRef(null),Ue=react.useRef(null),U=react.useRef(null),Z=react.useMemo(()=>Sd(X),[X]),Fe=react.useMemo(()=>({theme:Z,themeName:X}),[Z,X]),kt=react.useMemo(()=>dc(s),[s]),ot=react.useMemo(()=>{if(!g)return ke;let N=pe.calculateCriticalPath(ke),E=G=>G.map(se=>({...se,isCriticalPath:N.includes(se.id),subtasks:se.subtasks?E(se.subtasks):void 0}));return E(ke)},[ke,g]),ja=v0(Se);lc({undo:qt,redo:it,canUndo:ta,canRedo:H,enabled:true}),react.useImperativeHandle(o,()=>({getTask:N=>pe.findTaskById(ke,N),addTask:(N,E)=>{Pe(G=>{if(!E)return [...G,{...N,level:0}];let se=fe=>fe.map(Ce=>Ce.id===E?{...Ce,subtasks:[...Ce.subtasks||[],{...N,parentId:E,level:(Ce.level||0)+1}],isExpanded:true}:Ce.subtasks?{...Ce,subtasks:se(Ce.subtasks)}:Ce);return se(G)});},updateTask:(N,E)=>{Pe(G=>{let se=fe=>fe.map(Ce=>Ce.id===N?{...Ce,...E}:Ce.subtasks?{...Ce,subtasks:se(Ce.subtasks)}:Ce);return se(G)});},deleteTask:N=>{Pe(E=>{let G=se=>se.filter(fe=>fe.id===N?false:(fe.subtasks&&(fe.subtasks=G(fe.subtasks)),true));return G(E)});},deleteTasks:N=>{Pe(E=>ti(E,N));},duplicateTask:N=>{Pe(E=>ai(E,[N]));},splitTask:(N,E,G=3)=>{Pe(se=>pe.splitTask(se,N,E,G));},calculateEndDate:pe.calculateEndDate,calculateDuration:pe.calculateDuration,validateDependency:(N,E)=>!pe.validateDependencies(ke,N,E),getAllTasks:()=>pe.flattenTasks(ke),getTasksByStatus:N=>pe.flattenTasks(ke).filter(E=>E.status===N),getTasksByParent:N=>N?pe.findTaskById(ke,N)?.subtasks||[]:ke.filter(G=>!G.parentId),getCriticalPath:()=>pe.flattenTasks(ke).filter(N=>N.isCriticalPath),indentTask:N=>{Pe(E=>Zs(E,[N]));},outdentTask:N=>{Pe(E=>Qs(E,[N]));},moveTask:(N,E)=>{Pe(G=>ei(G,[N],E));},createSubtask:async N=>{let{tasks:E,newTask:G}=ni(ke,N);if(me){let se=me({...G,parentId:N});if((se instanceof Promise?await se:se)===false)return}Pe(E),he&&he({...G,parentId:N});},scrollToTask:N=>{let G=pe.flattenTasks(ke).findIndex(se=>se.id===N);if(G!==-1&&_e.current){let se=G*ja;_e.current.scrollTo({top:se,behavior:"smooth"}),Ue.current&&Ue.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(N,E=2e3)=>{},expandTask:N=>{Pe(E=>{let G=se=>se.map(fe=>fe.id===N?{...fe,isExpanded:true}:fe.subtasks?{...fe,subtasks:G(fe.subtasks)}:fe);return G(E)});},collapseTask:N=>{Pe(E=>{let G=se=>se.map(fe=>fe.id===N?{...fe,isExpanded:false}:fe.subtasks?{...fe,subtasks:G(fe.subtasks)}:fe);return G(E)});},expandAll:()=>{Pe(N=>{let E=G=>G.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?E(se.subtasks):void 0}));return E(N)});},collapseAll:()=>{Pe(N=>{let E=G=>G.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?E(se.subtasks):void 0}));return E(N)});},undo:qt,redo:it,canUndo:()=>ta,canRedo:()=>H,clearHistory:re,exportToPNG:async()=>{if(!U.current||!_e.current||!Ue.current)throw new Error("Gantt container not found");let N=U.current,E=_e.current.querySelector(".gantt-grid-scroll"),G=Ue.current,se=E?.scrollTop||0,fe=G.scrollTop,Ce=N.style.overflow,ut=N.style.height;try{let Ut=E?.querySelector(".gantt-taskgrid-content"),oa=G.querySelector("svg"),na=Ut?.scrollHeight||E?.scrollHeight||600,ga=oa?.getBoundingClientRect().height||G.scrollHeight,vr=(N.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(na,ga)+20;E&&(E.scrollTop=0),G.scrollTop=0,N.style.overflow="visible",N.style.height=`${vr}px`,await new Promise(rr=>setTimeout(rr,100));let ar=await mc__default.default(N,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:rr=>{let _r=window.getComputedStyle(rr),xr=parseInt(_r.zIndex,10);return !isNaN(xr)&&xr>=50||_r.position==="fixed"}});return new Promise((rr,_r)=>{ar.toBlob(xr=>{xr?rr(xr):_r(new Error("Failed to create blob from canvas"));},"image/png");})}finally{N.style.overflow=Ce,N.style.height=ut,E&&(E.scrollTop=se),G.scrollTop=fe;}},exportToPDF:async N=>{await pe.exportToPDF(ke,N);},exportToExcel:async N=>{await pe.exportToExcel(ke,N);},exportToJSON:()=>pe.exportToJSON(ke),exportToCSV:()=>pe.exportToCSV(ke),importFromJSON:N=>{let E=pe.importFromJSON(N);Pe(E);},getTasks:()=>ke,refresh:()=>{Pe(N=>[...N]);},clearAll:()=>{Pe([]);}}),[ke,qt,it,ta,H,re,Z,ja]);let br=react.useCallback(N=>{Re(E=>E.map(G=>G.id===N?{...G,visible:!G.visible}:G));},[]),Qa=react.useCallback((N,E)=>{Re(G=>G.map(se=>{if(se.id!==N)return se;let fe=se.minWidth??100,Ce=se.maxWidth??800,ut=Math.max(fe,Math.min(Ce,E));return {...se,width:ut}}));},[]),po=react.useCallback(N=>{Pe(E=>{let G=oi(E,N),se=fe=>{for(let Ce of fe){if(Ce.id===N){tt.current.set(N,Ce.isExpanded??true);return}Ce.subtasks?.length&&se(Ce.subtasks);}};return se(G),K(),G}),a.onTaskToggleExpand?.(N);},[a,K]),ge=react.useCallback((N,E)=>{if(W&&W(N,E)===false)return;let se=pe.findTaskById(ke,N)?.progress,fe=ut=>ut.map(Ut=>Ut.id===N?{...Ut,...E}:Ut.subtasks?{...Ut,subtasks:fe(Ut.subtasks)}:Ut);Pe(fe(ke));let Ce=pe.findTaskById(fe(ke),N);Ce&&(v?.(Ce),te?.(Ce),E.progress!==void 0&&se!==void 0&&E.progress!==se&&B?.(N,se,E.progress));},[ke,v,W,te,B]),Pt=react.useCallback(N=>{N.length!==0&&(Pe(E=>Zs(E,N)),a.onTaskIndent?.(N[0]));},[a]),Qt=react.useCallback(N=>{N.length!==0&&(Pe(E=>Qs(E,N)),a.onTaskOutdent?.(N[0]));},[a]),Hr=react.useCallback((N,E,G)=>{Pe(se=>Kd(se,N,E,G)),a.onTaskReparent?.(N,E,G);},[a]),Ho=react.useCallback((N,E)=>{N.length!==0&&(Pe(G=>ei(G,N,E)),a.onTaskMove?.(N[0],E));},[a]),er=react.useCallback(async N=>{let E=[];for(let G of N)F&&await Promise.resolve(F(G))===false||E.push(G);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Pe(G=>ti(G,E)),E.forEach(G=>a.onTaskDelete?.(G))),I&&E.forEach(G=>I(G)));},[a,F,I]),Ka=react.useCallback(N=>{Pe(E=>ai(E,N)),N.forEach(E=>a.onTaskDuplicate?.(E));},[a]),yr=react.useCallback((N,E)=>{Pe(G=>{let{tasks:se,newTask:fe}=jd(G,N,E);return me&&me(fe)===false?G:(a.onTaskCreate?.(fe.parentId,fe.position||0),he?.(fe),se)});},[a,me,he]),zt=react.useCallback((N,E)=>{Pe(G=>ri(G,N,E)),a.onTaskRename?.(N,E);},[a]),uo=react.useCallback(N=>{Pe(E=>{let{tasks:G}=ni(E,N);return a.onTaskCreate?.(N,0),G});},[a]),jn=react.useCallback((N,E,G)=>{let se=N.startDate?Math.round((E.getTime()-N.startDate.getTime())/864e5):0,fe=Ut=>Ut.map(oa=>oa.id===N.id?{...oa,startDate:E,endDate:G,...N.segments&&{segments:N.segments}}:oa.subtasks?{...oa,subtasks:fe(oa.subtasks)}:oa),Ce=fe(ke);Ce=pe.autoScheduleDependents(Ce,N.id,se),Pe(Ce);let ut={...N,startDate:E,endDate:G};v?.(ut);},[ke,v]),sl=react.useCallback((N,E)=>{M?.(N,E),ue({isOpen:true,x:E.clientX,y:E.clientY,task:N});},[M]),go=react.useCallback((N,E)=>{let G=pe.splitTask(ke,N.id,E);Pe(G),ue({isOpen:false,x:0,y:0,task:null});},[ke]),il=react.useCallback(N=>{let E=pe.findTaskById(ke,N.id)||N;T?.(E),S||Ae(E);},[ke,T,S]),ll=react.useCallback((N,E,G)=>{let se=new Map,fe=na=>{na.forEach(ga=>{ga.dependencies&&se.set(ga.id,ga.dependencies),ga.subtasks&&fe(ga.subtasks);});};fe(G);let Ce=se.get(E)||[];se.set(E,[...Ce,N]);let ut=new Set,Ut=new Set,oa=na=>{if(!ut.has(na)){ut.add(na),Ut.add(na);let ga=se.get(na)||[];for(let tr of ga){if(!ut.has(tr)&&oa(tr))return true;if(Ut.has(tr))return true}}return Ut.delete(na),false};return oa(E)},[]),dl=react.useCallback((N,E)=>{if(ll(N.id,E,ke)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
342
|
+
</Project>`,u=new Blob([l],{type:"application/xml;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(u),c.download=a,c.click(),URL.revokeObjectURL(c.href);},calculateCriticalPath:e=>{let t=pe.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let u=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,c=0;if(l.dependencies&&l.dependencies.length>0)for(let i of l.dependencies){let w=t.find(g=>g.id===i);if(w){o(w);let g=r.get(i)?.ef||0;c=Math.max(c,g);}}let d=c+u;r.set(l.id,{es:c,ef:d});};a.forEach(o);let n=Math.max(...Array.from(r.values()).map(l=>l.ef)),s=new Map,p=l=>{if(s.has(l.id))return;let u=l.startDate&&l.endDate?pe.calculateDuration(l.startDate,l.endDate):0,c=t.filter(w=>w.dependencies&&w.dependencies.includes(l.id)),d=n;if(c.length>0)for(let w of c){p(w);let g=s.get(w.id)?.ls||0;d=Math.min(d,g);}let i=d-u;s.set(l.id,{ls:i,lf:d});};a.forEach(p);let m=[];for(let l of a){let u=r.get(l.id),c=s.get(l.id);if(u&&c){let d=c.ls-u.es;Math.abs(d)<.01&&m.push(l.id);}}return m},calculateSlack:(e,t)=>{let a=pe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(pe.calculateCriticalPath(e).includes(t))return 0;let o=pe.getDependentTasks(e,t);if(o.length===0){let p=pe.getLatestEndDate(e);if(!p)return null;let m=pe.calculateDuration(a.endDate,p);return Math.max(0,m)}let n=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!n)return null;let s=pe.calculateDuration(a.endDate,new Date(n));return Math.max(0,s)},isOnCriticalPath:(e,t)=>pe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=pe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=pe.getDependentTasks(e,t);if(o.length===0)return e;let n=[...e];for(let s of o){if(!s.startDate||!s.endDate)continue;let p=pe.calculateDuration(s.startDate,s.endDate),m;a!==void 0?(m=new Date(s.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let l=pe.calculateEndDate(m,p),u=c=>c.map(d=>d.id===s.id?{...d,startDate:m,endDate:l}:d.subtasks?{...d,subtasks:u(d.subtasks)}:d);n=u(n),n=pe.autoScheduleDependents(n,s.id,a);}return n},calculateCascadePreview:(e,t,a,r,o,n,s,p)=>{if(a===0)return [];let m=[],l=o.getTime(),u=1e3*60*60*24,c=pe.findTaskById(e,t);if(!c||!c.endDate)return [];let d=(i,w,g=new Set)=>{if(g.has(i))return;g.add(i);let b=pe.getDependentTasks(e,i);for(let h of b){if(!h.startDate||!h.endDate)continue;let v=r.findIndex(C=>C.id===h.id);if(v===-1)continue;let f=h.startDate.getTime(),T=(h.endDate.getTime()-f)/u,I=(f-l)/u*n,k=I+w*n,L=Math.max(T*n,n),N=p+v*s+12;m.push({taskId:h.id,taskName:h.name,originalX:I,previewX:k,width:L,y:N,rowIndex:v,daysDelta:w,color:h.color}),d(h.id,w,g);}};return d(t,a),m},splitTask:(e,t,a,r=3)=>{let o=pe.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 n=new Date(a);n.setDate(n.getDate()-1);let s=new Date(a);s.setDate(s.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:n},{startDate:s,endDate:p}],l=u=>u.map(c=>c.id===o.id?{...c,endDate:p,segments:m}:c.subtasks?{...c,subtasks:l(c.subtasks)}:c);return l(e)}};function Cn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:n,zoom:s,templates:p,onTaskClick:m,onTaskDblClick:l,onTaskContextMenu:u,onTaskDateChange:c,onDependencyCreate:d,onDependencyDelete:i}){let[g,b]=react.useState([]),[h,v]=react.useState(null),[f,x]=react.useState(null),T=react.useCallback(z=>{v(z);},[]),D=Math.ceil((n.getTime()-o.getTime())/(1e3*60*60*24)),I=r==="day"?60:r==="week"?20:8,k=D*I*s,L=z=>{let B=new Date(Date.UTC(z.getFullYear(),z.getMonth(),z.getDate())),$=B.getUTCDay()||7;B.setUTCDate(B.getUTCDate()+4-$);let P=new Date(Date.UTC(B.getUTCFullYear(),0,1));return Math.ceil(((B.getTime()-P.getTime())/864e5+1)/7)},N=z=>{let B=z.getDay();return B===0||B===6},C=react.useCallback(z=>{let B=Math.round(z/(I*s)),$=new Date(o);return $.setDate($.getDate()+B),$},[o,I,s]),G=react.useCallback((z,B)=>{if(B.startDate&&B.endDate)return;let $=z.currentTarget.ownerSVGElement;if(!$)return;let P=$.createSVGPoint();P.x=z.clientX,P.y=z.clientY;let Q=P.matrixTransform($.getScreenCTM()?.inverse()),ee=C(Q.x),H=new Date(ee);H.setDate(H.getDate()+1),c?.(B,ee,H);},[C,c]),F=react.useMemo(()=>{let z=Q=>Q.map(ee=>{if(ee.subtasks&&ee.subtasks.length>0){let H=z(ee.subtasks),De=H.filter(Ee=>Ee.startDate&&Ee.endDate);if(De.length>0){let Ee=De.map(ae=>ae.startDate.getTime()),Be=De.map(ae=>ae.endDate.getTime()),xe=new Date(Math.min(...Ee)),U=new Date(Math.max(...Be));return {...ee,subtasks:H,startDate:xe,endDate:U}}return {...ee,subtasks:H}}return ee}),B=(Q,ee=[])=>{for(let H of Q)ee.push(H),H.subtasks&&H.subtasks.length>0&&(H.isExpanded===void 0||H.isExpanded)&&B(H.subtasks,ee);return ee},$=z(e);return B($)},[e]),J=react.useCallback(z=>{if(!z.startDate||!z.endDate)return {x:0,width:0};let B=z.startDate.getTime(),$=z.endDate.getTime(),P=o.getTime(),Q=(B-P)/(1e3*60*60*24),ee=($-B)/(1e3*60*60*24),H=Q*I*s,De=Math.max(I*s,40),Ee=Math.max(ee*I*s,De);return {x:H,width:Ee}},[o,I,s]),K=react.useMemo(()=>F.filter(z=>z.startDate&&z.endDate).map(z=>{let{x:B,width:$}=J(z),Q=F.findIndex(ee=>ee.id===z.id)*a+12;return {id:z.id,x:B,y:Q,width:$,height:32}}),[F,J]),de=react.useCallback((z,B,$)=>{if(!$||B===0){b([]);return}let P=pe.calculateCascadePreview(e,z,B,F,o,I*s,a,48);b(P);},[e,F,o,I,s,a,48]),ge=react.useMemo(()=>{let z=[],B=new Date(o);for(;B<=n;){let Q=(B.getTime()-o.getTime())/864e5*I*s;if(r==="day")z.push({date:new Date(B),label:B.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Q}),B.setDate(B.getDate()+1);else if(r==="week"){let ee=L(B);z.push({date:new Date(B),label:`Week ${ee}`,x:Q}),B.setDate(B.getDate()+7);}else z.push({date:new Date(B),label:B.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Q}),B.setMonth(B.getMonth()+1);}return z},[o,n,r,I,s]),Te=react.useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*I*s,[o,I,s]),Ce=Math.max(F.length*a,552);return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsxRuntime.jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxRuntime.jsxs("svg",{width:Math.max(k,1e3),height:47,style:{display:"block"},children:[jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(k,1e3),height:48,fill:t.bgGrid}),ge.map((z,B)=>jsxRuntime.jsxs("g",{children:[B>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:z.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:z.label})]},`header-${B}`)),Te>=0&&Te<=k&&jsxRuntime.jsx("circle",{cx:Te,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxRuntime.jsxs("svg",{width:Math.max(k,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(k,1e3),height:Ce,fill:t.bgPrimary}),ge.map((z,B)=>{let $=ge[B+1]?.x||k,P=N(z.date);return jsxRuntime.jsxs("g",{children:[P&&jsxRuntime.jsx("rect",{x:z.x,y:0,width:$-z.x,height:F.length*a,fill:t.bgWeekend,opacity:1}),B>0&&jsxRuntime.jsx("line",{x1:z.x,y1:0,x2:z.x,y2:F.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},B)}),F.map((z,B)=>{let $=z.startDate&&z.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:k,height:a,fill:B%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${z.id}`),!$&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:B*a,width:k,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>G(P,z),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${z.id}`),jsxRuntime.jsx("text",{x:Te>0?Te:100,y:B*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-${z.id}`)]})]},`row-group-${z.id}`)}),F.map((z,B)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map($=>{let P=F.find(De=>De.id===$);if(!P||!P.startDate||!P.endDate)return null;let Q=F.findIndex(De=>De.id===$),ee=J(P),H=J(z);return jsxRuntime.jsx(vn,{x1:ee.x+ee.width,y1:Q*a+a/2,x2:H.x,y2:B*a+a/2,theme:t},`dep-${$}-${z.id}`)})),F.map((z,B)=>{if(!z.startDate||!z.endDate)return null;let{x:$,width:P}=J(z),Q=B*a+12,ee=z.subtasks&&z.subtasks.length>0&&!z.isMilestone;return z.isMilestone?jsxRuntime.jsx(kn,{task:z,x:$+P/2,y:Q+16,theme:t,onClick:m},z.id):ee?jsxRuntime.jsxs("g",{onClick:()=>m?.(z),onContextMenu:H=>{H.preventDefault(),H.stopPropagation(),u?.(z,H);},style:{cursor:"default"},children:[jsxRuntime.jsx("rect",{x:$,y:Q,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:$,y1:Q,x2:$+P,y2:Q,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:Q,x2:$,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$+P,y1:Q,x2:$+P,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:$,y1:Q+32,x2:$+P,y2:Q+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsxRuntime.jsx("text",{x:$+12,y:Q+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:z.name})]},z.id):jsxRuntime.jsx(hn,{task:z,x:$,y:Q,width:P,theme:t,dayWidth:I*s,startDate:o,templates:p,onClick:m,onDoubleClick:l,onContextMenu:u,onDateChange:c,onDependencyCreate:d,allTaskPositions:K,onDragMove:de,onHoverChange:T},z.id)}),F.map((z,B)=>!z.dependencies||z.dependencies.length===0||!z.startDate||!z.endDate?null:z.dependencies.map($=>{let P=F.find(ce=>ce.id===$);if(!P||!P.startDate||!P.endDate)return null;let Q=F.findIndex(ce=>ce.id===$),ee=J(P),H=J(z),De=ee.x+ee.width,Ee=Q*a+a/2,Be=H.x,xe=B*a+a/2,U=Be-De,ae=De+U/2,Me=ce=>{let fe=1-ce,Ae=fe*fe,ot=Ae*fe,kt=ce*ce,Le=kt*ce,ke=ot*De+3*Ae*ce*ae+3*fe*kt*ae+Le*Be,Ie=ot*Ee+3*Ae*ce*Ee+3*fe*kt*xe+Le*xe;return {x:ke,y:Ie}},_e=20,qe=[];for(let ce=0;ce<=_e;ce++){let fe=.1+ce/_e*.8;qe.push(Me(fe));}let Ke=qe[0],O=`M ${Ke.x} ${Ke.y} `+qe.slice(1).map(ce=>`L ${ce.x} ${ce.y}`).join(" ");return f&&f.x1===De&&f.y1===Ee&&f.x2===Be&&f.y2===xe?null:jsxRuntime.jsx("path",{d:O,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{x({x1:De,y1:Ee,x2:Be,y2:xe,onDelete:()=>i?.(z.id,$)});}},`dep-hover-${$}-${z.id}`)})),g.map(z=>jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:z.previewX,y:z.y-48,width:z.width,height:32,rx:8,fill:z.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(z.daysDelta)>0&&jsxRuntime.jsx("text",{x:z.previewX+z.width/2,y:z.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:z.daysDelta>0?`+${z.daysDelta}d`:`${z.daysDelta}d`})]},`cascade-preview-${z.taskId}`)),f&&(()=>{let{x1:z,y1:B,x2:$,y2:P,onDelete:Q}=f,ee=$-z,H=P-B,De=z+ee/2,Ee=(B+P)/2,Be=`M ${z} ${B} C ${De} ${B}, ${De} ${P}, ${$} ${P}`,xe=6,U=Math.atan2(H,ee),ae=$-xe*Math.cos(U-Math.PI/6),Me=P-xe*Math.sin(U-Math.PI/6),_e=$-xe*Math.cos(U+Math.PI/6),qe=P-xe*Math.sin(U+Math.PI/6),Ke=t.dependency,O="#f87171";return jsxRuntime.jsxs("g",{onMouseLeave:()=>x(null),children:[jsxRuntime.jsx("path",{d:Be,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx("circle",{cx:De,cy:Ee,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsxRuntime.jsx("path",{d:Be,fill:"none",stroke:Ke,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsxRuntime.jsx("path",{d:Be,fill:"none",stroke:Ke,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("path",{d:`M ${$} ${P} L ${ae} ${Me} M ${$} ${P} L ${_e} ${qe}`,fill:"none",stroke:Ke,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsx("circle",{cx:$,cy:P,r:4,fill:Ke,opacity:.9,style:{pointerEvents:"none"}}),jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ce=>{ce.stopPropagation(),x(null),Q();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:De,cy:Ee,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:O,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsxRuntime.jsx("line",{x1:De-3,y1:Ee-3,x2:De+3,y2:Ee+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:De+3,y1:Ee-3,x2:De-3,y2:Ee+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),Te>=0&&Te<=k&&jsxRuntime.jsx("line",{x1:Te,y1:0,x2:Te,y2:Ce,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),h&&jsxRuntime.jsx(tc,{tooltipData:h,theme:t})]})]})}var Tn=[{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 ci=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],pi=[{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 Dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:n,isLoading:s=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:c,attachments:d=[],onUploadAttachments:i,onDeleteAttachment:w}){let g=[...ci,...l.filter(O=>!ci.some(re=>re.id===O.id))],b=Ve[m]||Ve.dark,[h,v]=react.useState(false),[f,x]=react.useState(false),[T,D]=react.useState(false),[I,k]=react.useState(false),[L,N]=react.useState({top:0,left:0}),[C,G]=react.useState(null),[F,J]=react.useState(new Date),[K,de]=react.useState({top:0,left:0}),[ge,Te]=react.useState(false),[Ce,z]=react.useState([]),B=react.useRef(null),$=react.useRef(null),P=react.useRef(null),Q=react.useRef(null),ee=react.useRef(null),[H,De]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ee,Be]=react.useState({});react.useEffect(()=>{a?(De({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Te(true)):(De({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Te(false),z([]));},[a,e]),react.useEffect(()=>{let O=re=>{B.current&&!B.current.contains(re.target)&&v(false),$.current&&!$.current.contains(re.target)&&x(false),P.current&&!P.current.contains(re.target)&&D(false),Q.current&&!Q.current.contains(re.target)&&k(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let xe=()=>{let O={};return H.name.trim()||(O.name="El nombre es requerido"),H.startDate&&H.endDate&&H.startDate>H.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Be(O),Object.keys(O).length===0},U=async O=>{if(O.preventDefault(),!!xe())try{let re=p==="create"&&Ce.length>0?{...H,pendingFiles:Ce}:H;await n(re),z([]),t();}catch(re){console.error("Error submitting task:",re);}},ae=(O,re)=>{De(ce=>{let fe={...ce,[O]:re};if(O==="status"){let Ae=re;Ae==="todo"?fe.progress=0:Ae==="in-progress"?(ce.progress===0||ce.progress===100)&&(fe.progress=50):Ae==="completed"||Ae==="closed"?fe.progress=100:(Ae==="in-review"||Ae==="review")&&(fe.progress=75);}if(O==="progress"){let Ae=typeof re=="number"?re:parseInt(re,10);Ae===100&&ce.status!=="completed"?fe.status="completed":Ae>0&&Ae<100&&ce.status==="todo"?fe.status="in-progress":Ae===0&&ce.status!=="todo"&&(fe.status="todo");}return fe}),Ee[O]&&Be(ce=>{let fe={...ce};return delete fe[O],fe});},Me=g.find(O=>O.id===H.status)??ci[0],_e=pi.find(O=>O.id===H.priority)??pi[1],qe=Tn.find(O=>O.value===H.color)??Tn[0],Ke={backgroundColor:b.bgSecondary,border:`1px solid ${b.borderLight}`,color:b.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${b.border}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Me.color||b.accent}}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsxRuntime.jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:b.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=b.hoverBg,O.currentTarget.style.color=b.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=b.textTertiary;},disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsxs("form",{onSubmit:U,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"p-5 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("input",{type:"text",value:H.name,onChange:O=>ae("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:b.textPrimary},placeholder:"Nombre de la tarea",disabled:s,autoFocus:true}),Ee.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"}),Ee.name]})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsx("textarea",{value:H.description||"",onChange:O=>ae("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:b.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:s})}),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.borderLight}`}}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:B,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!s&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ke,borderColor:Me.color,backgroundColor:`${Me.color}15`},disabled:s,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:Me.color}}),jsxRuntime.jsx("span",{style:{color:Me.color},children:Me.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:Me.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},children:g.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("status",O.id),v(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,H.status===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},O.id))})})]}),jsxRuntime.jsxs("div",{ref:$,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!s&&x(!f),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:_e.color}}),jsxRuntime.jsx("span",{children:_e.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&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:b.bgPrimary,border:`1px solid ${b.border}`},children:pi.map(O=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("priority",O.id),x(false);},children:[jsxRuntime.jsx("span",{children:O.icon}),O.label,H.priority===O.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},O.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:P,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!s&&D(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,children:[H.assignees&&H.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:H.assignees.slice(0,3).map((O,re)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||b.accent,borderColor:b.bgSecondary},children:O.initials},re))}),H.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:b.textTertiary},children:["+",H.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&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:b.bgPrimary,border:`1px solid ${b.border}`},children:o.map(O=>{let re=H.assignees?.some(ce=>ce.name===O.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=re?(H.assignees||[]).filter(fe=>fe.name!==O.name):[...H.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(fe=>fe[0]).join("").toUpperCase().slice(0,2),color:b.accent}];ae("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:O.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},O.id)})})})]}),jsxRuntime.jsxs("div",{ref:Q,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!s)if(I)k(false);else {if(Q.current){let O=Q.current.getBoundingClientRect(),re=window.innerHeight,ce=120,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;N({top:Ae,left:O.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ke,disabled:s,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:H.color}}),jsxRuntime.jsx("span",{children:qe.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${L.top}px`,left:`${L.left}px`,zIndex:99999,backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Tn.slice(0,18).map(O=>{let re=H.color===O.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),ae("color",O.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:re?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||c?jsxRuntime.jsx(ja,{selectedTags:H.tags||[],availableTags:u,onChange:O=>ae("tags",O),onCreateTag:c,theme:b,disabled:s}):null]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4",style:{color:b.textTertiary}}),jsxRuntime.jsxs("div",{ref:ee,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!s&&!H.isMilestone)if(C==="start")G(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),re=window.innerHeight,ce=320,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;de({top:Ae,left:O.left});}G("start"),J(H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:s||H.isMilestone,children:H.startDate?H.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!s&&!H.isMilestone)if(C==="end")G(null);else {if(ee.current){let O=ee.current.getBoundingClientRect(),re=window.innerHeight,ce=320,Ae=re-O.bottom<ce?O.top-ce-8:O.bottom+8;de({top:Ae,left:O.left});}G("end"),J(H.endDate||H.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ke,opacity:H.isMilestone?.5:1,cursor:H.isMilestone?"not-allowed":"pointer"},disabled:s||H.isMilestone,children:H.endDate?H.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>G(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${K.top}px`,left:`${K.left}px`,zIndex:99999,backgroundColor:b.bgPrimary,border:`1px solid ${b.border}`},onClick:O=>O.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${b.border}`},children:[(()=>{let O=new Date,re=new Date(O);re.setDate(O.getDate()+1);let ce=new Date(O);ce.setDate(O.getDate()+7);let fe=new Date(O);return fe.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:fe}].map((ot,kt)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:Le=>Le.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Le=>Le.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(ae("startDate",ot.date),(!H.endDate||ot.date>H.endDate)&&ae("endDate",ot.date),G("end")):(ae("endDate",ot.date),(!H.startDate||ot.date<H.startDate)&&ae("startDate",ot.date),G(null));},children:ot.label},kt))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{ae("startDate",void 0),ae("endDate",void 0),G(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:()=>J(new Date(F.getFullYear(),F.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary},children:F.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>J(new Date(F.getFullYear(),F.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,re)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:O},re))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=F.getFullYear(),re=F.getMonth(),ce=new Date(O,re,1).getDay(),fe=new Date(O,re+1,0).getDate(),Ae=new Date,ot=[];for(let Le=ce-1;Le>=0;Le--)ot.push({day:new Date(O,re,-Le).getDate(),date:new Date(O,re-1,new Date(O,re,-Le).getDate()),isCurrentMonth:false});for(let Le=1;Le<=fe;Le++)ot.push({day:Le,date:new Date(O,re,Le),isCurrentMonth:true});let kt=42-ot.length;for(let Le=1;Le<=kt;Le++)ot.push({day:Le,date:new Date(O,re+1,Le),isCurrentMonth:false});return ot.map((Le,ke)=>{let Ie=Le.date.toDateString()===Ae.toDateString(),Zt=H.startDate?.toDateString()===Le.date.toDateString(),vt=H.endDate?.toDateString()===Le.date.toDateString(),sa=H.startDate&&H.endDate&&Le.date>=H.startDate&&Le.date<=H.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Le.isCurrentMonth?Zt||vt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Zt?"#3B82F6":vt?"#7C3AED":sa?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ie&&!Zt&&!vt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(ae("startDate",Le.date),H.endDate&&Le.date>H.endDate&&ae("endDate",Le.date),G("end")):(ae("endDate",Le.date),H.startDate&&Le.date<H.startDate&&ae("startDate",Le.date),G(null));},children:Le.day},ke)})})()})]})]})]})})]}),Ee.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:Ee.endDate})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4",style:{color:b.textTertiary}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:H.progress,onChange:O=>ae("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,accentColor:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"}20`,color:H.progress<30?"#EF4444":H.progress<70?"#F59E0B":"#10B981"},children:[H.progress,"%"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>Te(!ge),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:b.textTertiary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-3 h-3 transition-transform ${ge?"rotate-180":""}`}),"Opciones avanzadas"]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge&&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:[(i||d.length>0||p==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",p==="create"?Ce.length>0&&`(${Ce.length})`:d.length>0&&`(${d.length})`]})]}),p==="create"?jsxRuntime.jsx(qa,{cardId:"pending",attachments:Ce.map((O,re)=>({id:`pending-${re}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>z(re=>[...re,...O]),onDelete:O=>{let re=parseInt(O.replace("pending-",""),10);z(ce=>ce.filter((fe,Ae)=>Ae!==re));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(qa,{cardId:a?.id||"new",attachments:d,onUpload:i&&a?.id?O=>i(a.id,O):void 0,onDelete:w,maxSizeMB:10,maxFiles:20}),p==="create"&&Ce.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[Ce.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:H.isMilestone,onChange:O=>ae("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:s}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:b.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:b.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:b.bgSecondary},children:r.filter(O=>O.id!==a?.id).map(O=>{let re=H.dependencies?.includes(O.id);return jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=re?(H.dependencies||[]).filter(fe=>fe!==O.id):[...H.dependencies||[],O.id];ae("dependencies",ce);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:re?`${b.accent}30`:b.bgPrimary,color:re?b.accent:b.textSecondary,border:`1px solid ${re?b.accent:b.borderLight}`},disabled:s,children:O.name},O.id)})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${b.border}`},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:b.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:b.accent,color:"#FFF"},onMouseEnter:O=>!s&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!s&&(O.currentTarget.style.opacity="1"),children:s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var d0=['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"'],sc=()=>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"})]}),c0=()=>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"})}),p0=()=>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"})}),m0=()=>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"})}),u0=()=>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 Nn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:n,onTaskDelete:s,onDependencyCreate:p,onDependencyDelete:m}){let[l,u]=react.useState(false),[c,d]=react.useState(false),[i,w]=react.useState([]),[g,b]=react.useState(""),[h,v]=react.useState(false),[f,x]=react.useState(true),T=react.useRef(null),D=react.useRef(null),I=react.useRef(null),{enabled:k=true,placeholder:L='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:N="bottom-right",onCommand:C,suggestions:G=d0,maxHistory:F=50,persistHistory:J}=a,K=J?.storageKey||"gantt-ai-history",de=J?.maxMessages??5;react.useEffect(()=>{if(J?.enabled)try{let $=localStorage.getItem(K);if($){let Q=JSON.parse($).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));w(Q.slice(-de));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[J?.enabled,K,de]),react.useEffect(()=>{if(J?.enabled&&i.length>0)try{let $=i.filter(P=>!P.isLoading).slice(-de);localStorage.setItem(K,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[i,J?.enabled,K,de]),react.useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[i]),react.useEffect(()=>{l&&!c&&T.current&&setTimeout(()=>T.current?.focus(),100);},[l,c]);let ge=react.useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&o?.($.taskId,$.updates);break;case "create_task":$.newTask&&n?.($.newTask);break;case "delete_task":$.taskId&&s?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&p?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&m?.($.taskId,$.dependencyFrom);break}},[o,n,s,p,m]),Te=react.useCallback(async $=>{if(!$.trim()||h)return;let P={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};w(ee=>[...ee.slice(-(F-1)),P]),b(""),x(false),v(true);let Q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};w(ee=>[...ee,Q]);try{if(C){let ee=await C($,e);w(H=>{let De=H.filter(Be=>!Be.isLoading),Ee={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...De,Ee]}),ge(ee);}else w(ee=>[...ee.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(ee){w(H=>[...H.filter(Ee=>!Ee.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{v(false);}},[h,F,C,e,ge]),Ce=$=>{$.preventDefault(),Te(g);},z=$=>{b($),T.current?.focus();};if(react.useEffect(()=>{let $=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),u(Q=>!Q),l||d(false)),P.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[l]),react.useEffect(()=>{if(!l)return;let $=Q=>{let ee=Q.target;I.current&&!I.current.contains(ee)&&u(false);},P=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",$);}},[l]),!k)return null;let B={"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(it,{children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!l&&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 ${B[N]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsxRuntime.jsx(sc,{}),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:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:c?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${B[N]} 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(sc,{}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(m0,{})}),jsxRuntime.jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsxRuntime.jsx(p0,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!c&&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:[i.length===0&&f&&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(($,P)=>jsxRuntime.jsx("button",{onClick:()=>z($),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:$.length>30?$.slice(0,30)+"...":$},P))})]}),i.map($=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:$.role==="user"?"white":t.textPrimary},children:[$.isLoading?jsxRuntime.jsx(u0,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:$.command.success?"#10B981":"#EF4444"},children:[$.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsxRuntime.jsx("div",{ref:D})]}),jsxRuntime.jsxs("form",{onSubmit:Ce,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:T,type:"text",value:g,onChange:$=>b($.target.value),placeholder:L,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsxRuntime.jsx("button",{type:"submit",disabled:!g.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:g.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:g.trim()?"white":t.textSecondary},children:jsxRuntime.jsx(c0,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function ic(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),n=react.useCallback((l,u=true)=>{r(c=>{let d=typeof l=="function"?l(c.present):l;if(o.current)return {...c,present:d};if(!u)return {...c,present:d};let i=[...c.past,c.present];return i.length>t&&i.shift(),{past:i,present:d,future:[]}});},[t]),s=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],c=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:c,present:u,future:[l.present,...l.future]}});},[]),p=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let u=l.future[0],c=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:u,future:c}});},[]),m=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:n,undo:s,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function lc({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let n=s=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?s.metaKey:s.ctrlKey;if(m&&s.key==="z"&&!s.shiftKey&&a){s.preventDefault(),e();return}if(r){if(!p&&m&&s.key==="y"){s.preventDefault(),t();return}if(p&&m&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n);}},[e,t,a,r,o]);}var b0={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${pe.formatDate(e.startDate)} - ${pe.formatDate(e.endDate)}`);let a=pe.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=>pe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function dc(e){return {...b0,...e}}var T0=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},mc=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:n,timeScale:s="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:l=true,availableUsers:u=[],templates:c,enableAutoCriticalPath:d=true,persistExpandedState:i,aiAssistant:w,locale:g="en",customTranslations:b,showCreateTaskButton:h=false,createTaskLabel:v,onCreateTask:f,onThemeChange:x,onTaskClick:T,onTaskDblClick:D,onTaskContextMenu:I,onTaskUpdate:k,onProgressChange:L,onTaskEdit:N,onTaskAddSubtask:C,onTaskMarkIncomplete:G,onTaskSetInProgress:F,onDependencyCreate:J,onDependencyDelete:K,onBeforeTaskAdd:de,onAfterTaskAdd:ge,onBeforeTaskUpdate:Te,onAfterTaskUpdate:Ce,onBeforeTaskDelete:z,onAfterTaskDelete:B}=a,P=react.useContext(dn)?.theme,[Q,ee]=react.useState(P||n||"dark"),[H,De]=react.useState(s),[Ee,Be]=react.useState(p),[xe,U]=react.useState(1),[ae,Me]=react.useState(0),[_e,qe]=react.useState(false),[Ke,O]=react.useState(null),[re,ce]=react.useState({isOpen:false,x:0,y:0,task:null}),[fe,Ae]=react.useState(null),[ot,kt]=react.useState(null);react.useEffect(()=>{P&&P!==Q&&ee(P);},[P]),react.useEffect(()=>{n&&n!==Q&&ee(n);},[n]);let Le=react.useCallback(S=>{ee(S),x?.(S);},[x]),{state:ke,setState:Ie,undo:Zt,redo:vt,canUndo:sa,canRedo:Na,clearHistory:Oe}=ic(t,50),Ue=react.useCallback(()=>i?typeof i=="string"?i:"gantt-expanded-tasks":null,[i]),qt=react.useRef(new Map),he=react.useRef(false);if(!he.current&&i){he.current=true;let S=typeof i=="string"?i:"gantt-expanded-tasks";try{let E=localStorage.getItem(S);if(E){let V=JSON.parse(E);Array.isArray(V)&&(qt.current=new Map(V));}}catch(E){console.warn("[GanttBoard] Error loading expanded state from localStorage:",E);}}let Ge=react.useCallback(()=>{let S=Ue();if(S)try{let E=Array.from(qt.current.entries());localStorage.setItem(S,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving expanded state to localStorage:",E);}},[Ue]);react.useEffect(()=>{let S=E=>E.map(V=>{let oe=qt.current.get(V.id),me=oe!==void 0?{...V,isExpanded:oe}:V;return me.subtasks?.length?{...me,subtasks:S(me.subtasks)}:me});qt.current.size>0?Ie(S(t)):Ie(t);},[t,Ie]);let Fe=react.useRef(t),tt=react.useRef(true);react.useEffect(()=>{if(tt.current){tt.current=false,Fe.current=ke;return}if(!r)return;let S=JSON.stringify(Fe.current),E=JSON.stringify(ke);S!==E&&(Fe.current=ke,r(ke));},[ke,r]);let Xe=react.useMemo(()=>Ys(g,b),[g,b]),wt=react.useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[st,Qe]=react.useState(()=>wt(Xe));react.useEffect(()=>{Qe(S=>S.map(E=>({...E,label:Xe.columns[E.id==="name"?"taskName":E.id]||E.label})));},[Xe]);let A=react.useMemo(()=>st.filter(E=>E.visible).reduce((E,V)=>E+V.width,0),[st]),ue=react.useRef(st.filter(S=>S.visible).map(S=>S.id).join(","));react.useEffect(()=>{let S=st.filter(oe=>oe.visible),E=S.map(oe=>oe.id).join(","),V=ue.current;if(E!==V){let oe=S.some(Se=>Se.id!=="name"),me=V.includes(",");oe?!me&&oe&&O(null):O(null),ue.current=E;}},[st]);let _=60,Z=.6,ve=react.useMemo(()=>{let E=A+_,V=typeof window<"u"?window.innerWidth*Z:800,oe=Math.max(E,V);return Ke!==null?Math.max(200,Math.min(Ke,oe)):Math.max(200,E)},[Ke,A]),Y=react.useRef(null),ne=react.useRef(null),R=react.useRef(null),W=react.useMemo(()=>Sd(Q),[Q]),Ne=react.useMemo(()=>({theme:W,themeName:Q}),[W,Q]),et=react.useMemo(()=>dc(c),[c]),$e=react.useMemo(()=>{if(!d)return ke;let S=pe.calculateCriticalPath(ke),E=V=>V.map(oe=>({...oe,isCriticalPath:S.includes(oe.id),subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(ke)},[ke,d]),mt=T0(Ee);lc({undo:Zt,redo:vt,canUndo:sa,canRedo:Na,enabled:true}),react.useImperativeHandle(o,()=>({getTask:S=>pe.findTaskById(ke,S),addTask:(S,E)=>{Ie(V=>{if(!E)return [...V,{...S,level:0}];let oe=me=>me.map(Se=>Se.id===E?{...Se,subtasks:[...Se.subtasks||[],{...S,parentId:E,level:(Se.level||0)+1}],isExpanded:true}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(V)});},updateTask:(S,E)=>{Ie(V=>{let oe=me=>me.map(Se=>Se.id===S?{...Se,...E}:Se.subtasks?{...Se,subtasks:oe(Se.subtasks)}:Se);return oe(V)});},deleteTask:S=>{Ie(E=>{let V=oe=>oe.filter(me=>me.id===S?false:(me.subtasks&&(me.subtasks=V(me.subtasks)),true));return V(E)});},deleteTasks:S=>{Ie(E=>ti(E,S));},duplicateTask:S=>{Ie(E=>ai(E,[S]));},splitTask:(S,E,V=3)=>{Ie(oe=>pe.splitTask(oe,S,E,V));},calculateEndDate:pe.calculateEndDate,calculateDuration:pe.calculateDuration,validateDependency:(S,E)=>!pe.validateDependencies(ke,S,E),getAllTasks:()=>pe.flattenTasks(ke),getTasksByStatus:S=>pe.flattenTasks(ke).filter(E=>E.status===S),getTasksByParent:S=>S?pe.findTaskById(ke,S)?.subtasks||[]:ke.filter(V=>!V.parentId),getCriticalPath:()=>pe.flattenTasks(ke).filter(S=>S.isCriticalPath),indentTask:S=>{Ie(E=>Zs(E,[S]));},outdentTask:S=>{Ie(E=>Qs(E,[S]));},moveTask:(S,E)=>{Ie(V=>ei(V,[S],E));},createSubtask:async S=>{let{tasks:E,newTask:V}=ni(ke,S);if(de){let oe=de({...V,parentId:S});if((oe instanceof Promise?await oe:oe)===false)return}Ie(E),ge&&ge({...V,parentId:S});},scrollToTask:S=>{let V=pe.flattenTasks(ke).findIndex(oe=>oe.id===S);if(V!==-1&&Y.current){let oe=V*mt;Y.current.scrollTo({top:oe,behavior:"smooth"}),ne.current&&ne.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(S,E=2e3)=>{},expandTask:S=>{Ie(E=>{let V=oe=>oe.map(me=>me.id===S?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:V(me.subtasks)}:me);return V(E)});},collapseTask:S=>{Ie(E=>{let V=oe=>oe.map(me=>me.id===S?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:V(me.subtasks)}:me);return V(E)});},expandAll:()=>{Ie(S=>{let E=V=>V.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},collapseAll:()=>{Ie(S=>{let E=V=>V.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?E(oe.subtasks):void 0}));return E(S)});},undo:Zt,redo:vt,canUndo:()=>sa,canRedo:()=>Na,clearHistory:Oe,exportToPNG:async()=>{if(!R.current||!Y.current||!ne.current)throw new Error("Gantt container not found");let S=R.current,E=Y.current.querySelector(".gantt-grid-scroll"),V=ne.current,oe=E?.scrollTop||0,me=V.scrollTop,Se=S.style.overflow,gt=S.style.height;try{let Ht=E?.querySelector(".gantt-taskgrid-content"),ia=V.querySelector("svg"),la=Ht?.scrollHeight||E?.scrollHeight||600,ba=ia?.getBoundingClientRect().height||V.scrollHeight,Dr=(S.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(la,ba)+20;E&&(E.scrollTop=0),V.scrollTop=0,S.style.overflow="visible",S.style.height=`${Dr}px`,await new Promise(cr=>setTimeout(cr,100));let dr=await pc__default.default(S,{backgroundColor:W.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:cr=>{let jr=window.getComputedStyle(cr),Nr=parseInt(jr.zIndex,10);return !isNaN(Nr)&&Nr>=50||jr.position==="fixed"}});return new Promise((cr,jr)=>{dr.toBlob(Nr=>{Nr?cr(Nr):jr(new Error("Failed to create blob from canvas"));},"image/png");})}finally{S.style.overflow=Se,S.style.height=gt,E&&(E.scrollTop=oe),V.scrollTop=me;}},exportToPDF:async S=>{await pe.exportToPDF(ke,S);},exportToExcel:async S=>{await pe.exportToExcel(ke,S);},exportToJSON:()=>pe.exportToJSON(ke),exportToCSV:()=>pe.exportToCSV(ke),importFromJSON:S=>{let E=pe.importFromJSON(S);Ie(E);},getTasks:()=>ke,refresh:()=>{Ie(S=>[...S]);},clearAll:()=>{Ie([]);}}),[ke,Zt,vt,sa,Na,Oe,W,mt]);let Re=react.useCallback(S=>{Qe(E=>E.map(V=>V.id===S?{...V,visible:!V.visible}:V));},[]),ut=react.useCallback((S,E)=>{Qe(V=>V.map(oe=>{if(oe.id!==S)return oe;let me=oe.minWidth??100,Se=oe.maxWidth??800,gt=Math.max(me,Math.min(Se,E));return {...oe,width:gt}}));},[]),$t=react.useCallback(S=>{Ie(E=>{let V=oi(E,S),oe=me=>{for(let Se of me){if(Se.id===S){qt.current.set(S,Se.isExpanded??true);return}Se.subtasks?.length&&oe(Se.subtasks);}};return oe(V),Ge(),V}),a.onTaskToggleExpand?.(S);},[a,Ge]),se=react.useCallback((S,E)=>{if(Te&&Te(S,E)===false)return;let oe=pe.findTaskById(ke,S)?.progress,me=gt=>gt.map(Ht=>Ht.id===S?{...Ht,...E}:Ht.subtasks?{...Ht,subtasks:me(Ht.subtasks)}:Ht);Ie(me(ke));let Se=pe.findTaskById(me(ke),S);Se&&(k?.(Se),Ce?.(Se),E.progress!==void 0&&oe!==void 0&&E.progress!==oe&&L?.(S,oe,E.progress));},[ke,k,Te,Ce,L]),Mt=react.useCallback(S=>{S.length!==0&&(Ie(E=>Zs(E,S)),a.onTaskIndent?.(S[0]));},[a]),aa=react.useCallback(S=>{S.length!==0&&(Ie(E=>Qs(E,S)),a.onTaskOutdent?.(S[0]));},[a]),_r=react.useCallback((S,E,V)=>{Ie(oe=>Kd(oe,S,E,V)),a.onTaskReparent?.(S,E,V);},[a]),Ho=react.useCallback((S,E)=>{S.length!==0&&(Ie(V=>ei(V,S,E)),a.onTaskMove?.(S[0],E));},[a]),ir=react.useCallback(async S=>{let E=[];for(let V of S)z&&await Promise.resolve(z(V))===false||E.push(V);E.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(E):(Ie(V=>ti(V,E)),E.forEach(V=>a.onTaskDelete?.(V))),B&&E.forEach(V=>B(V)));},[a,z,B]),Qa=react.useCallback(S=>{Ie(E=>ai(E,S)),S.forEach(E=>a.onTaskDuplicate?.(E));},[a]),Tr=react.useCallback((S,E)=>{Ie(V=>{let{tasks:oe,newTask:me}=jd(V,S,E);return de&&de(me)===false?V:(a.onTaskCreate?.(me.parentId,me.position||0),ge?.(me),oe)});},[a,de,ge]),Ut=react.useCallback((S,E)=>{Ie(V=>ri(V,S,E)),a.onTaskRename?.(S,E);},[a]),uo=react.useCallback(S=>{Ie(E=>{let{tasks:V}=ni(E,S);return a.onTaskCreate?.(S,0),V});},[a]),jn=react.useCallback((S,E,V)=>{let oe=S.startDate?Math.round((E.getTime()-S.startDate.getTime())/864e5):0,me=Ht=>Ht.map(ia=>ia.id===S.id?{...ia,startDate:E,endDate:V,...S.segments&&{segments:S.segments}}:ia.subtasks?{...ia,subtasks:me(ia.subtasks)}:ia),Se=me(ke);Se=pe.autoScheduleDependents(Se,S.id,oe),Ie(Se);let gt={...S,startDate:E,endDate:V};k?.(gt);},[ke,k]),sl=react.useCallback((S,E)=>{I?.(S,E),ce({isOpen:true,x:E.clientX,y:E.clientY,task:S});},[I]),go=react.useCallback((S,E)=>{let V=pe.splitTask(ke,S.id,E);Ie(V),ce({isOpen:false,x:0,y:0,task:null});},[ke]),il=react.useCallback(S=>{let E=pe.findTaskById(ke,S.id)||S;D?.(E),N||Ae(E);},[ke,D,N]),ll=react.useCallback((S,E,V)=>{let oe=new Map,me=la=>{la.forEach(ba=>{ba.dependencies&&oe.set(ba.id,ba.dependencies),ba.subtasks&&me(ba.subtasks);});};me(V);let Se=oe.get(E)||[];oe.set(E,[...Se,S]);let gt=new Set,Ht=new Set,ia=la=>{if(!gt.has(la)){gt.add(la),Ht.add(la);let ba=oe.get(la)||[];for(let lr of ba){if(!gt.has(lr)&&ia(lr))return true;if(Ht.has(lr))return true}}return Ht.delete(la),false};return ia(E)},[]),dl=react.useCallback((S,E)=>{if(ll(S.id,E,ke)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
343
343
|
|
|
344
|
-
Task dependencies must flow in one direction only.`);return}let G=se=>se.map(fe=>{if(fe.id===E){let Ce=fe.dependencies||[];if(!Ce.includes(N.id))return {...fe,dependencies:[...Ce,N.id]}}return fe.subtasks?{...fe,subtasks:G(fe.subtasks)}:fe});Pe(G(ke)),q?.(N.id,E);},[ke,q,ll]),cl=react.useCallback((N,E)=>{let G=se=>se.map(fe=>{if(fe.id===N&&fe.dependencies){let Ce=fe.dependencies.filter(ut=>ut!==E);return {...fe,dependencies:Ce}}return fe.subtasks?{...fe,subtasks:G(fe.subtasks)}:fe});Pe(G(ke)),j?.(N,E);},[ke,j]),{startDate:Nm,endDate:Sm}=react.useMemo(()=>{let N=ke.filter(Ce=>Ce.startDate&&Ce.endDate);if(N.length===0){let Ce=new Date,ut=new Date(Ce);ut.setDate(ut.getDate()-30);let Ut=new Date(Ce);return Ut.setDate(Ut.getDate()+60),{startDate:ut,endDate:Ut}}let E=N.flatMap(Ce=>[Ce.startDate,Ce.endDate]).filter(Ce=>Ce!==void 0),G=new Date(Math.min(...E.map(Ce=>Ce.getTime()))),se=new Date(Math.max(...E.map(Ce=>Ce.getTime()))),fe=z==="day"?7:z==="week"?14:30;return G.setDate(G.getDate()-fe),se.setDate(se.getDate()+fe),{startDate:G,endDate:se}},[ke,z]),Em=react.useCallback(async()=>{if(!U.current||!_e.current||!Ue.current)return;await new Promise(vr=>setTimeout(vr,200));let N=U.current,E=_e.current.querySelector(".gantt-grid-scroll"),G=Ue.current,se=E?.scrollTop||0,fe=E?.scrollLeft||0,Ce=G.scrollTop,ut=G.scrollLeft,Ut=N.style.overflow,oa=N.style.height,na=E?.style.overflow||"",ga=G.style.overflow,tr=N.style.width,Go=G.style.width;try{let vr=E?.querySelector(".gantt-taskgrid-content"),ar=G.querySelector("svg"),rr=ar?.getAttribute("height")?parseInt(ar.getAttribute("height"),10):ar?.getBoundingClientRect().height||0,_r=vr?.scrollHeight||E?.scrollHeight||600,xr=Math.max(rr,G.scrollHeight),ml=ar?.getAttribute("width")?parseInt(ar.getAttribute("width"),10):ar?.getBoundingClientRect().width||G.scrollWidth,Bm=N.querySelector('[class*="h-12"]')?.offsetHeight||48,Kn=Math.max(_r,xr,rr),Yn=Bm+Kn+50,qn=(E?.offsetWidth||300)+ml+10;E&&(E.scrollTop=0,E.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,N.style.overflow="visible",N.style.height=`${Yn}px`,N.style.width=`${qn}px`,E&&(E.style.overflow="visible",E.style.height=`${Kn+50}px`),G.style.overflow="visible",G.style.height=`${Kn+50}px`,G.style.width=`${ml+10}px`,await new Promise(Jn=>setTimeout(Jn,150));let Rm=await mc__default.default(N,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qn,height:Yn,windowWidth:qn+100,windowHeight:Yn+100,scrollX:0,scrollY:0,ignoreElements:Jn=>{let pl=window.getComputedStyle(Jn),ul=parseInt(pl.zIndex,10);return !isNaN(ul)&&ul>=50||pl.position==="fixed"}}),Xn=document.createElement("a");Xn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xn.href=Rm.toDataURL("image/png"),Xn.click();}finally{N.style.overflow=Ut,N.style.height=oa,N.style.width=tr,E&&(E.style.overflow=na,E.style.height="",E.scrollTop=se,E.scrollLeft=fe),G.style.overflow=ga,G.style.height="",G.style.width=Go,G.scrollTop=Ce,G.scrollLeft=ut;}},[Z]),Pm=react.useCallback(async()=>{await pe.exportToPDF(ke);},[ke]),Mm=react.useCallback(async()=>{await pe.exportToExcel(ke);},[ke]),Am=react.useCallback(()=>{let N=pe.exportToCSV(ke),E=new Blob([N],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[ke]),Im=react.useCallback(()=>{let N=pe.exportToJSON(ke),E=new Blob([N],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(E),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[ke]),Fm=react.useCallback(()=>{pe.exportToMSProject(ke,"Gantt Project","project.xml");},[ke]),Lm=N=>{N.preventDefault(),pt(true);},Gr=react.useRef(false);return react.useEffect(()=>{let N=Ue.current,E=_e.current?.querySelector(".gantt-grid-scroll");if(!N||!E)return;let G=()=>{if(Gr.current)return;Gr.current=true;let ut=N.scrollTop;Qe(ut),E.scrollTop=ut,requestAnimationFrame(()=>{Gr.current=false;});},se=()=>{if(Gr.current)return;Gr.current=true;let ut=E.scrollTop;Qe(ut),N.scrollTop=ut,requestAnimationFrame(()=>{Gr.current=false;});},fe=ut=>{if(yt&&E){let oa=E.parentElement?.getBoundingClientRect()?.left||0,na=ut.clientX-oa,ga=200,tr=Le+_,Go=window.innerWidth*J,vr=Math.max(tr,Go);na>=ga&&na<=vr&&O(na);}},Ce=()=>{pt(false);};return N.addEventListener("scroll",G),E.addEventListener("scroll",se),document.addEventListener("mousemove",fe),document.addEventListener("mouseup",Ce),()=>{N.removeEventListener("scroll",G),E.removeEventListener("scroll",se),document.removeEventListener("mousemove",fe),document.removeEventListener("mouseup",Ce);}},[yt,Le]),jsxRuntime.jsx(oo.Provider,{value:le,children:jsxRuntime.jsx(as.Provider,{value:Fe,children:jsxRuntime.jsxs("div",{ref:U,className:"flex flex-col h-full w-full",style:{backgroundColor:Z.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(mn,{theme:Z,timeScale:z,onTimeScaleChange:ye,zoom:Te,onZoomChange:Xe,currentTheme:X,onThemeChange:Be,rowDensity:Se,onRowDensityChange:We,showThemeSelector:p,showCreateTaskButton:k,createTaskLabel:u,onCreateTask:y,onExportPNG:d?Em:void 0,onExportPDF:d?Pm:void 0,onExportExcel:d?Mm:void 0,onExportCSV:d?Am:void 0,onExportJSON:d?Im:void 0,onExportMSProject:d?Fm:void 0}),jsxRuntime.jsxs("div",{ref:_e,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:De,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(fn,{tasks:ot,theme:Z,rowHeight:ja,availableUsers:l,templates:kt,onTaskClick:D,onTaskDblClick:il,onTaskContextMenu:M,onTaskToggle:po,scrollTop:ze,columns:$e,onToggleColumn:br,onColumnResize:Qa,onTaskUpdate:ge,onTaskIndent:Pt,onTaskOutdent:Qt,onTaskMove:Ho,onMultiTaskDelete:er,onTaskDuplicate:Ka,onTaskCreate:yr,onTaskRename:zt,onCreateSubtask:uo,onOpenTaskModal:D?N=>D(N):void 0,onDeleteRequest:(N,E)=>wt({taskId:N,taskName:E}),onTaskReparent:Hr})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Z.border,zIndex:15},onMouseDown:Lm}),jsxRuntime.jsx("div",{ref:Ue,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Cn,{tasks:ot,theme:Z,rowHeight:ja,timeScale:z,startDate:Nm,endDate:Sm,zoom:Te,templates:kt,onTaskClick:D,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:jn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),oe.task&&jsxRuntime.jsx(no,{isOpen:oe.isOpen,x:oe.x,y:oe.y,theme:Z,onClose:()=>ue({isOpen:false,x:0,y:0,task:null}),items:(()=>{let N=oe.task;if(!N)return [];let E=pe.findTaskById(ke,N.id)||N;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{wt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:le.contextMenu?.editTask||"Edit Task",icon:St.Pencil,onClick:()=>{S?S(E):Ae(E);}},{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:St.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:le.contextMenu?.markIncomplete||"Mark Incomplete",icon:St.MarkIncomplete,onClick:()=>{$?$(E):ge(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:le.contextMenu?.setInProgress||"Set In Progress",icon:St.SetInProgress,onClick:()=>{L?L(E):ge(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:le.contextMenu?.markComplete||"Mark Complete",icon:St.MarkComplete,onClick:()=>{ge(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:le.contextMenu?.splitTask||"Split Task",icon:St.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let se=E.startDate.getTime(),fe=E.endDate.getTime(),Ce=se+(fe-se)/2,ut=new Date(Ce);go(E,ut);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:St.Delete,onClick:()=>{wt({taskId:E.id,taskName:E.name});}}]})()}),Ee&&jsxRuntime.jsx(Dn,{isOpen:true,onClose:()=>Ae(null),task:Ee,onSubmit:N=>{ge(Ee.id,N),Ae(null);},mode:"edit",theme:X}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:rt&&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:()=>wt(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:Z.bgSecondary,border:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Z.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:Z.textPrimary,fontFamily:"Inter, sans-serif"},children:[le.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="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:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Z.textPrimary},children:['"',rt.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Z.bgPrimary,borderTop:`1px solid ${Z.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>wt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=Z.hoverBg;},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{er([rt.taskId]),wt(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"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),c?.enabled&&jsxRuntime.jsx(Nn,{tasks:ke,theme:Z,config:c,onTasksUpdate:Pe,onTaskUpdate:ge,onTaskCreate:N=>{Pe(E=>[...E,N]);},onTaskDelete:N=>{er([N]);},onDependencyCreate:(N,E)=>{let G=pe.findTaskById(ke,N);G&&dl(G,E);},onDependencyDelete:cl})]})})})});var uc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
344
|
+
Task dependencies must flow in one direction only.`);return}let V=oe=>oe.map(me=>{if(me.id===E){let Se=me.dependencies||[];if(!Se.includes(S.id))return {...me,dependencies:[...Se,S.id]}}return me.subtasks?{...me,subtasks:V(me.subtasks)}:me});Ie(V(ke)),J?.(S.id,E);},[ke,J,ll]),cl=react.useCallback((S,E)=>{let V=oe=>oe.map(me=>{if(me.id===S&&me.dependencies){let Se=me.dependencies.filter(gt=>gt!==E);return {...me,dependencies:Se}}return me.subtasks?{...me,subtasks:V(me.subtasks)}:me});Ie(V(ke)),K?.(S,E);},[ke,K]),{startDate:Sp,endDate:Ep}=react.useMemo(()=>{let S=ke.filter(Se=>Se.startDate&&Se.endDate);if(S.length===0){let Se=new Date,gt=new Date(Se);gt.setDate(gt.getDate()-30);let Ht=new Date(Se);return Ht.setDate(Ht.getDate()+60),{startDate:gt,endDate:Ht}}let E=S.flatMap(Se=>[Se.startDate,Se.endDate]).filter(Se=>Se!==void 0),V=new Date(Math.min(...E.map(Se=>Se.getTime()))),oe=new Date(Math.max(...E.map(Se=>Se.getTime()))),me=H==="day"?7:H==="week"?14:30;return V.setDate(V.getDate()-me),oe.setDate(oe.getDate()+me),{startDate:V,endDate:oe}},[ke,H]),Pp=react.useCallback(async()=>{if(!R.current||!Y.current||!ne.current)return;await new Promise(Dr=>setTimeout(Dr,200));let S=R.current,E=Y.current.querySelector(".gantt-grid-scroll"),V=ne.current,oe=E?.scrollTop||0,me=E?.scrollLeft||0,Se=V.scrollTop,gt=V.scrollLeft,Ht=S.style.overflow,ia=S.style.height,la=E?.style.overflow||"",ba=V.style.overflow,lr=S.style.width,Go=V.style.width;try{let Dr=E?.querySelector(".gantt-taskgrid-content"),dr=V.querySelector("svg"),cr=dr?.getAttribute("height")?parseInt(dr.getAttribute("height"),10):dr?.getBoundingClientRect().height||0,jr=Dr?.scrollHeight||E?.scrollHeight||600,Nr=Math.max(cr,V.scrollHeight),pl=dr?.getAttribute("width")?parseInt(dr.getAttribute("width"),10):dr?.getBoundingClientRect().width||V.scrollWidth,Rp=S.querySelector('[class*="h-12"]')?.offsetHeight||48,Kn=Math.max(jr,Nr,cr),Yn=Rp+Kn+50,qn=(E?.offsetWidth||300)+pl+10;E&&(E.scrollTop=0,E.scrollLeft=0),V.scrollTop=0,V.scrollLeft=0,S.style.overflow="visible",S.style.height=`${Yn}px`,S.style.width=`${qn}px`,E&&(E.style.overflow="visible",E.style.height=`${Kn+50}px`),V.style.overflow="visible",V.style.height=`${Kn+50}px`,V.style.width=`${pl+10}px`,await new Promise(Jn=>setTimeout(Jn,150));let Op=await pc__default.default(S,{backgroundColor:W.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:qn,height:Yn,windowWidth:qn+100,windowHeight:Yn+100,scrollX:0,scrollY:0,ignoreElements:Jn=>{let ml=window.getComputedStyle(Jn),ul=parseInt(ml.zIndex,10);return !isNaN(ul)&&ul>=50||ml.position==="fixed"}}),Xn=document.createElement("a");Xn.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Xn.href=Op.toDataURL("image/png"),Xn.click();}finally{S.style.overflow=Ht,S.style.height=ia,S.style.width=lr,E&&(E.style.overflow=la,E.style.height="",E.scrollTop=oe,E.scrollLeft=me),V.style.overflow=ba,V.style.height="",V.style.width=Go,V.scrollTop=Se,V.scrollLeft=gt;}},[W]),Mp=react.useCallback(async()=>{await pe.exportToPDF(ke);},[ke]),Ap=react.useCallback(async()=>{await pe.exportToExcel(ke);},[ke]),Ip=react.useCallback(()=>{let S=pe.exportToCSV(ke),E=new Blob([S],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(E),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ke]),Fp=react.useCallback(()=>{let S=pe.exportToJSON(ke),E=new Blob([S],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(E),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ke]),Lp=react.useCallback(()=>{pe.exportToMSProject(ke,"Gantt Project","project.xml");},[ke]),Bp=S=>{S.preventDefault(),qe(true);},Vr=react.useRef(false);return react.useEffect(()=>{let S=ne.current,E=Y.current?.querySelector(".gantt-grid-scroll");if(!S||!E)return;let V=()=>{if(Vr.current)return;Vr.current=true;let gt=S.scrollTop;Me(gt),E.scrollTop=gt,requestAnimationFrame(()=>{Vr.current=false;});},oe=()=>{if(Vr.current)return;Vr.current=true;let gt=E.scrollTop;Me(gt),S.scrollTop=gt,requestAnimationFrame(()=>{Vr.current=false;});},me=gt=>{if(_e&&E){let ia=E.parentElement?.getBoundingClientRect()?.left||0,la=gt.clientX-ia,ba=200,lr=A+_,Go=window.innerWidth*Z,Dr=Math.max(lr,Go);la>=ba&&la<=Dr&&O(la);}},Se=()=>{qe(false);};return S.addEventListener("scroll",V),E.addEventListener("scroll",oe),document.addEventListener("mousemove",me),document.addEventListener("mouseup",Se),()=>{S.removeEventListener("scroll",V),E.removeEventListener("scroll",oe),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Se);}},[_e,A]),jsxRuntime.jsx(no.Provider,{value:Xe,children:jsxRuntime.jsx(as.Provider,{value:Ne,children:jsxRuntime.jsxs("div",{ref:R,className:"flex flex-col h-full w-full",style:{backgroundColor:W.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(pn,{theme:W,timeScale:H,onTimeScaleChange:De,zoom:xe,onZoomChange:U,currentTheme:Q,onThemeChange:Le,rowDensity:Ee,onRowDensityChange:Be,showThemeSelector:m,showCreateTaskButton:h,createTaskLabel:v,onCreateTask:f,onExportPNG:l?Pp:void 0,onExportPDF:l?Mp:void 0,onExportExcel:l?Ap:void 0,onExportCSV:l?Ip:void 0,onExportJSON:l?Fp:void 0,onExportMSProject:l?Lp:void 0}),jsxRuntime.jsxs("div",{ref:Y,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:ve,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(fn,{tasks:$e,theme:W,rowHeight:mt,availableUsers:u,templates:et,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:I,onTaskToggle:$t,scrollTop:ae,columns:st,onToggleColumn:Re,onColumnResize:ut,onTaskUpdate:se,onTaskIndent:Mt,onTaskOutdent:aa,onTaskMove:Ho,onMultiTaskDelete:ir,onTaskDuplicate:Qa,onTaskCreate:Tr,onTaskRename:Ut,onCreateSubtask:uo,onOpenTaskModal:T?S=>T(S):void 0,onDeleteRequest:(S,E)=>kt({taskId:S,taskName:E}),onTaskReparent:_r})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:W.border,zIndex:15},onMouseDown:Bp}),jsxRuntime.jsx("div",{ref:ne,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Cn,{tasks:$e,theme:W,rowHeight:mt,timeScale:H,startDate:Sp,endDate:Ep,zoom:xe,templates:et,onTaskClick:T,onTaskDblClick:il,onTaskContextMenu:sl,onTaskDateChange:jn,onDependencyCreate:dl,onDependencyDelete:cl})})]}),re.task&&jsxRuntime.jsx(so,{isOpen:re.isOpen,x:re.x,y:re.y,theme:W,onClose:()=>ce({isOpen:false,x:0,y:0,task:null}),items:(()=>{let S=re.task;if(!S)return [];let E=pe.findTaskById(ke,S.id)||S;return E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{kt({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:Xe.contextMenu?.editTask||"Edit Task",icon:Et.Pencil,onClick:()=>{N?N(E):Ae(E);}},{id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Et.Add,onClick:()=>{C?C(E):uo(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:Xe.contextMenu?.markIncomplete||"Mark Incomplete",icon:Et.MarkIncomplete,onClick:()=>{G?G(E):se(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:Xe.contextMenu?.setInProgress||"Set In Progress",icon:Et.SetInProgress,onClick:()=>{F?F(E):se(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:Xe.contextMenu?.markComplete||"Mark Complete",icon:Et.MarkComplete,onClick:()=>{se(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:Xe.contextMenu?.splitTask||"Split Task",icon:Et.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let oe=E.startDate.getTime(),me=E.endDate.getTime(),Se=oe+(me-oe)/2,gt=new Date(Se);go(E,gt);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Et.Delete,onClick:()=>{kt({taskId:E.id,taskName:E.name});}}]})()}),fe&&jsxRuntime.jsx(Dn,{isOpen:true,onClose:()=>Ae(null),task:fe,onSubmit:S=>{se(fe.id,S),Ae(null);},mode:"edit",theme:Q}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot&&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:()=>kt(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:S=>S.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:W.bgSecondary,border:`1px solid ${W.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${W.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:W.textPrimary,fontFamily:"Inter, sans-serif"},children:[Xe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:W.textSecondary,fontFamily:"Inter, sans-serif"},children:g==="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:W.textSecondary,fontFamily:"Inter, sans-serif"},children:[g==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:W.textPrimary},children:['"',ot.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:W.bgPrimary,borderTop:`1px solid ${W.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>kt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:W.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor=W.hoverBg;},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:g==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ir([ot.taskId]),kt(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:S=>{S.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),g==="es"?"Eliminar":"Delete"]})]})]})})}),w?.enabled&&jsxRuntime.jsx(Nn,{tasks:ke,theme:W,config:w,onTasksUpdate:Ie,onTaskUpdate:se,onTaskCreate:S=>{Ie(E=>[...E,S]);},onTaskDelete:S=>{ir([S]);},onDependencyCreate:(S,E)=>{let V=pe.findTaskById(ke,S);V&&dl(V,E);},onDependencyDelete:cl})]})})})});var uc=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
345
345
|
|
|
346
346
|
AVAILABLE COMMANDS:
|
|
347
347
|
1. move_task - Move a task to a different date
|
|
@@ -383,18 +383,18 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
383
383
|
Always try to match task names case-insensitively and handle partial matches.
|
|
384
384
|
If you can't find a task by name, search through the provided task list.
|
|
385
385
|
If ambiguous, ask for clarification in the message field.`;function gc(e){return `CURRENT TASKS:
|
|
386
|
-
${fc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",
|
|
386
|
+
${fc(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",n=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",s=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${n}, ${r.progress}%, ${r.status||"todo"}) ${s}`}).join(`
|
|
387
387
|
`)}
|
|
388
388
|
|
|
389
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function fc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Za(e,t){let a=fc(e),r=t.toLowerCase().trim(),o=a.find(m=>m.name.toLowerCase()===r);if(o)return o;let n=a.find(m=>m.name.toLowerCase().includes(r));if(n)return n;let i=r.split(/\s+/);return a.find(m=>{let p=m.name.toLowerCase();return i.every(d=>p.includes(d))})}function gi(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 g=new Date(r);return g.setDate(g.getDate()+1),g}if(a==="yesterday"||a==="ayer"){let g=new Date(r);return g.setDate(g.getDate()-1),g}if(a==="next week"||a==="la pr\xF3xima semana"){let g=new Date(r);return g.setDate(g.getDate()+7),g}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 f={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(f!==void 0){let c=new Date(r),w=c.getDay(),h=f-w;return h<=0&&(h+=7),c.setDate(c.getDate()+h),c}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let g=parseInt(n[1],10),f=n[2].toLowerCase(),c=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?c.setDate(c.getDate()+g):f==="week"||f==="semana"||f==="semanas"?c.setDate(c.getDate()+g*7):(f==="month"||f==="mes"||f==="meses")&&c.setMonth(c.getMonth()+g),c}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let m=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(m&&m[1]&&m[2]&&m[3]){let g=parseInt(m[1],10),f=parseInt(m[2],10)-1,c=parseInt(m[3],10);return new Date(c,f,g)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},d=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(d&&d[1]&&d[2]){let g=parseInt(d[1],10),f=p[d[2].toLowerCase()],c=d[3]?parseInt(d[3],10):r.getFullYear();if(f!==void 0)return new Date(c,f,g)}let l={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},s=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(s&&s[1]&&s[2]){let g=l[s[1].toLowerCase()],f=parseInt(s[2],10),c=s[3]?parseInt(s[3],10):r.getFullYear();if(g!==void 0)return new Date(c,g,f)}return null}function fi(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 hi(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 hc(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 bc(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 d=r[1].trim(),l=r[2].trim(),s=Za(t,d),g=gi(l);if(!s)return {type:"move_task",taskName:d,message:`Could not find a task named "${d}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!g)return {type:"move_task",taskId:s.id,taskName:s.name,message:`Could not parse the date "${l}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=s.startDate&&s.endDate?Math.round((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24)):1,c=new Date(g);return c.setDate(c.getDate()+f),{type:"move_task",taskId:s.id,taskName:s.name,updates:{startDate:g,endDate:c},message:`Moved "${s.name}" to ${g.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let d=o[1].trim(),l=o[2].trim(),s=Za(t,d),g=fi(l);if(!s)return {type:"resize_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"};if(!g||!s.endDate)return {type:"resize_task",taskId:s.id,taskName:s.name,message:`Could not parse the duration "${l}".`,success:false,error:"Invalid duration"};let f=new Date(s.endDate);return f.setDate(f.getDate()+g),{type:"resize_task",taskId:s.id,taskName:s.name,updates:{endDate:f},message:`Extended "${s.name}" by ${g} days. New end date: ${f.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let d=n[1].trim(),l=n[2].trim(),s=Za(t,d),g=hi(l);return s?g===null?{type:"set_progress",taskId:s.id,taskName:s.name,message:`Could not parse the progress value "${l}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:s.id,taskName:s.name,updates:{progress:g},message:`Set "${s.name}" progress to ${g}%.`,success:true}:{type:"set_progress",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}let i=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let d=i[1].trim(),l=i[2].trim(),s=Za(t,d);return s?{type:"rename_task",taskId:s.id,taskName:s.name,updates:{name:l},message:`Renamed "${s.name}" to "${l}".`,success:true}:{type:"rename_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}let m=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]&&m[2]){let d=m[1].trim(),l=m[2].trim(),s=Za(t,d),g=Za(t,l);return s?g?{type:"link_tasks",taskId:g.id,taskName:g.name,dependencyFrom:s.id,dependencyTo:g.id,message:`Linked "${s.name}" \u2192 "${g.name}".`,success:true}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let d=p[1].trim(),l=Za(t,d);return l?{type:"delete_task",taskId:l.id,taskName:l.name,message:`Deleted "${l.name}".`,success:true}:{type:"delete_task",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Task not found"}}return null}function yc(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 x0(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 k0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function En(e,t=[],a=[]){let r=e.assignedUserIds?.map(l=>{let s=a.find(g=>g.id===l);return s?{name:s.name,initials:s.initials,color:s.color}:null}).filter(l=>l!==null),o=t.filter(l=>l.metadata?.parentCardId===e.id).map(l=>En(l,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(l=>l.type==="finish-to-start").map(l=>l.taskId));let i=l=>{if(l)return typeof l=="string"?new Date(l):l},m=i(e.startDate),p=i(e.endDate),d=e.metadata?.isMilestone===true||m&&p&&Math.abs(p.getTime()-m.getTime())<=864e5;return {id:e.id,name:e.title,startDate:m,endDate:p,progress:e.progress||0,status:x0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:d,isCriticalPath:e.metadata?.isCriticalPath===true}}function vc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:k0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>En(r,e,t))}var bi={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"}},yi={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"}},Pn={en:bi,es:yi};function vi(e){return Pn[e]||Pn.en}function Mn(e,t){let a=vi(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 Tc(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(...Tc(r.subtasks,t+1));return a}function I0({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 Dc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:i}){let{theme:m="dark",locale:p="en",customTranslations:d,showSearch:l=true,showHierarchy:s=true}=t,g=Mn(p,d),f=m==="dark",[c,w]=react.useState(new Set),[h,k]=react.useState("startDate"),[u,y]=react.useState("asc"),[x,D]=react.useState("");react.useMemo(()=>{let S=new Set;function C($){for(let L of $)L.subtasks?.length&&(S.add(L.id),C(L.subtasks));}C(e),w(S);},[e]);let T=react.useCallback(S=>{w(C=>{let $=new Set(C);return $.has(S)?$.delete(S):$.add(S),$}),a.onTaskToggleExpand?.(S);},[a]),M=react.useCallback(S=>{h===S?y(C=>C==="asc"?"desc":"asc"):(k(S),y("asc")),a.onSortChange?.({column:S,direction:u==="asc"?"desc":"asc"});},[h,u,a]),v=react.useMemo(()=>{let S=Tc(e);if(x.trim()){let $=x.toLowerCase();S=S.filter(L=>L.name.toLowerCase().includes($));}let C=[];for(let $ of S){let L=$.level===0;$.level>0&&(L=true),(L||x.trim())&&C.push($);}return x.trim()&&C.sort(($,L)=>{let q,j;switch(h){case "name":q=$.name.toLowerCase(),j=L.name.toLowerCase();break;case "startDate":q=$.startDate?.getTime()||0,j=L.startDate?.getTime()||0;break;case "endDate":q=$.endDate?.getTime()||0,j=L.endDate?.getTime()||0;break;case "progress":q=$.progress||0,j=L.progress||0;break;case "status":q=$.status||"todo",j=L.status||"todo";break;default:return 0}return q<j?u==="asc"?-1:1:q>j?u==="asc"?1:-1:0}),C},[e,x,h,u]),B=S=>S?(S instanceof Date?S:new Date(S)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",n),style:i,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:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[g.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",n),style:i,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:b("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",f?"bg-[#0F1117]":"bg-white",n),style:i,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:b("text-lg font-semibold mb-2",f?"text-white":"text-gray-900"),children:g.empty.noTasks}),jsxRuntime.jsx("p",{className:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-hidden",f?"bg-[#0F1117]":"bg-white",n),style:i,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",f?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[l&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:b("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:S=>D(S.target.value),placeholder:g.toolbar.searchPlaceholder,className:b("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",f?"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:b("text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[v.length," ",g.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:b("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",f?"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:()=>M("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.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:()=>M("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.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:()=>M("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.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:()=>M("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[g.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:()=>M("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:v.map((S,C)=>{let $=c.has(S.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:b("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",f?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:s?`${24+S.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[s&&S.hasChildren&&jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),T(S.id);},className:b("p-0.5 rounded",f?"hover:bg-white/10":"hover:bg-gray-200"),children:$?jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-4 h-4",f?"text-[#9CA3AF]":"text-gray-400")})}),s&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),a.onTaskUpdate?.({...S,progress:S.progress===100?0:100,status:S.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(I0,{status:S.status,progress:S.progress})}),jsxRuntime.jsx("span",{className:b("truncate",f?"text-white":"text-gray-900",S.progress===100&&(f?"line-through text-[#6B7280]":"line-through text-gray-400")),children:S.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:b("px-2 py-1 rounded-full text-xs font-medium",S.progress===100||S.status==="completed"?"bg-green-500/10 text-green-500":S.progress&&S.progress>0||S.status==="in-progress"?"bg-blue-500/10 text-blue-500":f?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:S.progress===100||S.status==="completed"?g.status.completed:S.progress&&S.progress>0||S.status==="in-progress"?g.status.inProgress:g.status.todo})}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),B(S.startDate)]}),jsxRuntime.jsxs("div",{className:b("col-span-2 flex items-center gap-1 text-sm",f?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),B(S.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:b("flex-1 h-1.5 rounded-full overflow-hidden",f?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",S.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${S.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-xs w-8",f?"text-[#9CA3AF]":"text-gray-500"),children:[S.progress||0,"%"]})]})})]},S.id)})}),v.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:b("w-12 h-12 mx-auto mb-4",f?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:b(f?"text-[#9CA3AF]":"text-gray-600"),children:g.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},In={dark:xi,light:ki,neutral:wi};function Nc(e){return In[e]||In.dark}var Ci={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"}},Ti={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"}},Fn={en:Ci,es:Ti};function Lo(e){return Fn[e]||Fn.en}function Ln(e,t){let a=Lo(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 Sc(e){let t=Lo(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 Ec(e,t=0,a=true){let r=Lo(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 K0(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 Pi(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 Ac({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 Fc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:i,style:m,availableTags:p=[],onCreateTag:d}){let{theme:l="dark",locale:s="en",customTranslations:g}=t,f=Ln(s,g),c=l==="dark",w={textTertiary:c?"#6B7280":"#9CA3AF",textSecondary:c?"#9CA3AF":"#6B7280",textPrimary:c?"#FFFFFF":"#111827",borderLight:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:c?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:c?"#1A1D25":"#FFFFFF",bgSecondary:c?"#0F1117":"#F9FAFB",hoverBg:c?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[h,k]=react.useState(r||new Date),[u,y]=react.useState(null),[x,D]=react.useState(null),[T,M]=react.useState(null),[v,B]=react.useState(new Date),[S,C]=react.useState({}),$=4,L=3,[q,j]=react.useState(false),[me,he]=react.useState(false),[W,te]=react.useState(false),[F,I]=react.useState(false),[R,P]=react.useState(null),[X,ee]=react.useState(""),[z,ye]=react.useState(void 0),[Se,We]=react.useState(null),[Te,Xe]=react.useState(false),[ze,Qe]=react.useState(false),[yt,pt]=react.useState(null),[dt,O]=react.useState(false),[oe,ue]=react.useState(new Date),Ee=react.useCallback(()=>{k(new Date(h.getFullYear(),h.getMonth()-1,1));},[h]),Ae=react.useCallback(()=>{k(new Date(h.getFullYear(),h.getMonth()+1,1));},[h]),rt=react.useCallback(()=>{k(new Date);},[]),wt=react.useMemo(()=>{let H=h.getFullYear(),re=h.getMonth(),be=new Date(H,re,1),tt=new Date(H,re+1,0),ie=be.getDay(),K=tt.getDate(),ae=K0(e),Me=new Date;Me.setHours(0,0,0,0);let le=[],Je=ie,$e=new Date(H,re,0).getDate();for(let Le=Je-1;Le>=0;Le--){let Ne=new Date(H,re-1,$e-Le);le.push({date:Ne,isCurrentMonth:false,isToday:false,isWeekend:Ne.getDay()===0||Ne.getDay()===6,events:ae.filter(_=>Pi(Ne,_)).map(_=>({id:_.id,title:_.name,start:_.startDate,end:_.endDate,task:_}))});}for(let Le=1;Le<=K;Le++){let Ne=new Date(H,re,Le),_=Ne.getTime()===Me.getTime();le.push({date:Ne,isCurrentMonth:true,isToday:_,isWeekend:Ne.getDay()===0||Ne.getDay()===6,events:ae.filter(J=>Pi(Ne,J)).map(J=>({id:J.id,title:J.name,start:J.startDate,end:J.endDate,task:J}))});}let Re=42-le.length;for(let Le=1;Le<=Re;Le++){let Ne=new Date(H,re+1,Le);le.push({date:Ne,isCurrentMonth:false,isToday:false,isWeekend:Ne.getDay()===0||Ne.getDay()===6,events:ae.filter(_=>Pi(Ne,_)).map(_=>({id:_.id,title:_.name,start:_.startDate,end:_.endDate,task:_}))});}return le},[h,e]),Be=s==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ke=h.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Pe=react.useCallback((H,re)=>{if(!u)return;let be={...u,[H]:re};y(be),a.onTaskUpdate?.(be);},[u,a]),qt=react.useCallback(H=>{if(!u)return;let re=u.progress||0;H==="completed"?re=100:H==="todo"&&(re=0);let be={...u,status:H,progress:re};y(be),a.onTaskUpdate?.(be),j(false);},[u,a]),it=react.useCallback((H,re)=>{if(!u)return;let be={...u,startDate:H,endDate:re};y(be),a.onTaskUpdate?.(be);},[u,a]),ta=react.useCallback(()=>{j(false),he(false),te(false),M(null);},[]);return o?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:m,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:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[f.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:m,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:b("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:b("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",i),style:m,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:b("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:f.labels.noEvents}),jsxRuntime.jsx("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:f.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:b("flex-1 flex flex-col w-full h-full overflow-auto",c?"bg-[#0F1117]":"bg-white",i),style:m,children:[jsxRuntime.jsx("div",{className:b("flex-shrink-0 px-6 py-4 border-b",c?"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:b("text-xl font-semibold capitalize",c?"text-white":"text-gray-900"),children:ke}),jsxRuntime.jsx("button",{onClick:rt,className:b("px-3 py-1.5 text-sm rounded-lg transition-colors",c?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:f.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Ee,className:b("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:b("w-5 h-5",c?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ae,className:b("p-2 rounded-lg transition-colors",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:b("w-5 h-5",c?"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:Be.map(H=>jsxRuntime.jsx("div",{className:b("py-2 text-center text-xs font-medium uppercase",c?"text-[#9CA3AF]":"text-gray-500"),children:H},H))}),jsxRuntime.jsx("div",{className:b("grid grid-cols-7 auto-rows-min gap-px rounded-lg",c?"bg-[#2D2D2D]":"bg-gray-300"),children:wt.map((H,re)=>{let be=H.date.getDay()===0||H.date.getDay()===6;return jsxRuntime.jsxs("div",{className:b("min-h-[120px] p-2 transition-colors flex flex-col relative group",c?be?"bg-[#1C1F26]":H.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":be?"bg-gray-100":H.isCurrentMonth?"bg-white":"bg-gray-50",H.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let tt=S[re]||$,ie=H.events.slice(0,tt),K=H.events.length-tt;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ie.map(ae=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{y(ae.task),a.onEventClick?.(ae);},whileHover:{scale:1.02},className:b("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ae.task.progress===100?c?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":c?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Ac,{task:ae.task}),jsxRuntime.jsx("span",{className:"truncate",children:ae.title})]})},ae.id)),K>0&&jsxRuntime.jsxs("button",{onClick:ae=>{ae.stopPropagation(),C(Me=>({...Me,[re]:tt+L}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",K," ",s==="es"?"M\xC1S":"MORE"]}),tt>$&&H.events.length>$&&jsxRuntime.jsx("button",{onClick:ae=>{ae.stopPropagation(),C(Me=>({...Me,[re]:$}));},className:b("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",c?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:s==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let tt=re>=28,ie=re%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),R===re?P(null):(P(re),ee(""),ye(void 0),We(null),pt(null),Xe(false),Qe(false),O(false),ue(H.date));},className:b("w-5 h-5 rounded flex items-center justify-center transition-all",R===re?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",c?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:b("w-3.5 h-3.5 transition-transform",R===re&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:R===re&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{P(null),ee(""),ye(void 0),We(null),pt(null),Xe(false),Qe(false),O(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:tt?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:tt?-5:5,scale:.95},transition:{duration:.12},className:b("absolute w-[320px] rounded-lg shadow-2xl z-50",tt?"bottom-full mb-1":"top-full mt-1",ie?"right-0":"left-0",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:K=>{K.stopPropagation(),Xe(false),Qe(false),O(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:X,onChange:K=>ee(K.target.value),placeholder:s==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:b("w-full bg-transparent text-sm outline-none placeholder:opacity-40",c?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:K=>{if(K.key==="Enter"&&X.trim()){let ae=t.availableUsers?.find(le=>le.id===Se),Me=yt||H.date;a.onTaskCreate?.({name:X.trim(),startDate:Me,endDate:Me,priority:z,assignees:ae?[ae]:void 0}),ee(""),ye(void 0),We(null),pt(null),P(null);}K.key==="Escape"&&(P(null),ee(""),ye(void 0),We(null),pt(null));}})}),jsxRuntime.jsxs("div",{className:b("px-2.5 py-2 flex items-center justify-between border-t",c?"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:K=>{K.stopPropagation(),Xe(!Te),Qe(false);},className:b("p-1 rounded transition-colors",z?z==="urgent"||z==="high"?"text-red-400 bg-red-500/20":z==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":c?"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:Te&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[{id:"urgent",label:s==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:s==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:s==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:s==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:s==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(K=>jsxRuntime.jsxs("button",{onClick:()=>{ye(K.id),Xe(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",z===K.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",K.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:K.label})]},K.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:K=>{K.stopPropagation(),O(!dt),Xe(false),Qe(false),ue(yt||H.date);},className:b("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",yt?"bg-[#7C3AED]/20 text-[#7C3AED]":c?"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"}),(yt||H.date).toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:dt&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsx("div",{className:b("w-40 py-2 border-r",c?"border-white/10":"border-gray-200"),children:(()=>{let K=new Date,ae=new Date(K);ae.setDate(K.getDate()+1);let Me=new Date(K);Me.setDate(K.getDate()+((6-K.getDay()+7)%7||7));let le=new Date(K);le.setDate(K.getDate()+((1-K.getDay()+7)%7||7));let Je=new Date(K);Je.setDate(K.getDate()+14);let $e=new Date(K);return $e.setDate(K.getDate()+28),[{label:s==="es"?"Hoy":"Today",date:K,display:K.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Ma\xF1ana":"Tomorrow",date:ae,display:ae.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Este fin de semana":"This weekend",date:Me,display:s==="es"?"s\xE1b.":"sat."},{label:s==="es"?"Pr\xF3xima semana":"Next week",date:le,display:s==="es"?"lun.":"mon."},{label:s==="es"?"2 semanas":"2 weeks",date:Je,display:Je.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:s==="es"?"4 semanas":"4 weeks",date:$e,display:$e.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Le,Ne)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{pt(Le.date),O(false);},children:[jsxRuntime.jsx("span",{children:Le.label}),jsxRuntime.jsx("span",{className:b("text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:Le.display})]},Ne))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:b("text-xs font-medium",c?"text-white":"text-gray-900"),children:oe.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>ue(new Date),className:b("px-1.5 py-0.5 rounded text-[10px] transition-colors",c?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:s==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>ue(new Date(oe.getFullYear(),oe.getMonth()-1)),className:b("p-0.5 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>ue(new Date(oe.getFullYear(),oe.getMonth()+1)),className:b("p-0.5 rounded",c?"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:(s==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(K=>jsxRuntime.jsx("div",{className:b("w-6 h-6 flex items-center justify-center text-[10px]",c?"text-[#6B7280]":"text-gray-400"),children:K},K))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=oe.getFullYear(),ae=oe.getMonth(),Me=new Date(K,ae,1).getDay(),le=new Date(K,ae+1,0).getDate(),Je=new Date(K,ae,0).getDate(),$e=new Date,Re=[];for(let Ne=Me-1;Ne>=0;Ne--)Re.push({dayNum:Je-Ne,isCurrentMonth:false,date:new Date(K,ae-1,Je-Ne)});for(let Ne=1;Ne<=le;Ne++)Re.push({dayNum:Ne,isCurrentMonth:true,date:new Date(K,ae,Ne)});let Le=42-Re.length;for(let Ne=1;Ne<=Le;Ne++)Re.push({dayNum:Ne,isCurrentMonth:false,date:new Date(K,ae+1,Ne)});return Re.map((Ne,_)=>{let J=Ne.date.toDateString()===$e.toDateString(),De=(yt||H.date).toDateString()===Ne.date.toDateString();return jsxRuntime.jsx("button",{className:b("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Ne.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),Ne.isCurrentMonth&&(c?"text-white":"text-gray-900"),J&&"ring-1 ring-[#3B82F6]",De&&"bg-[#7C3AED] text-white",!De&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{pt(Ne.date),O(false);},children:Ne.dayNum},_)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:K=>{K.stopPropagation(),Qe(!ze),Xe(false);},className:b("p-1 rounded transition-colors",Se?"text-[#7C3AED] bg-[#7C3AED]/20":c?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Se?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(K=>K.id===Se)?.color||"#7C3AED"},children:t.availableUsers?.find(K=>K.id===Se)?.initials||t.availableUsers?.find(K=>K.id===Se)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ze&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:K=>K.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{We(null),Qe(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",!Se&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:b("w-5 h-5 rounded-full flex items-center justify-center",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:c?"text-[#9CA3AF]":"text-gray-500",children:s==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(K=>jsxRuntime.jsxs("button",{onClick:()=>{We(K.id),Qe(false);},className:b("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",Se===K.id&&(c?"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:K.color||"#7C3AED"},children:K.initials||K.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:K.name})]},K.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:b("px-3 py-2 text-xs",c?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(X.trim()){let K=t.availableUsers?.find(Me=>Me.id===Se),ae=yt||H.date;a.onTaskCreate?.({name:X.trim(),startDate:ae,endDate:ae,priority:z,assignees:K?[K]:void 0}),ee(""),ye(void 0),We(null),pt(null),P(null);}},disabled:!X.trim(),className:b("px-2.5 py-1 rounded text-xs font-medium transition-colors",X.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":c?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:s==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:b("text-sm font-medium",H.isToday?"text-[#3B82F6]":H.isCurrentMonth?c?"text-white":"text-gray-900":c?"text-[#6B7280]":"text-gray-400"),children:H.date.getDate()})]})]},re)})})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:u&&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:b("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:b("px-6 py-3 border-b flex items-center gap-3",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:b("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:b("text-xs px-2 py-0.5 rounded",c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[s==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:b("text-xs font-mono",c?"text-[#6B7280]":"text-gray-400"),children:u.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",c?"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:b("p-1.5 rounded transition-colors",c?"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:b("p-1.5 rounded transition-colors",c?"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:b("p-1.5 rounded transition-colors",c?"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 H=u.progress===100?0:100,be={...u,progress:H,status:H===100?"completed":"todo"};y(be),a.onTaskUpdate?.(be);},className:b("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",u.progress===100?"bg-green-500 border-green-500":c?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:u.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("h2",{className:b("text-xl font-semibold flex-1",u.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:u.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:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{ta(),j(!q);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",u.progress===100||u.status==="completed"?"bg-green-500/20 text-green-400":u.progress&&u.progress>0||u.status==="in-progress"?"bg-blue-500/20 text-blue-400":c?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:u.progress===100||u.status==="completed"?s==="es"?"COMPLETADO":"DONE":u.progress&&u.progress>0||u.status==="in-progress"?s==="es"?"EN PROGRESO":"IN PROGRESS":s==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:q&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:s==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:s==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:s==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(H=>jsxRuntime.jsxs("button",{onClick:()=>qt(H.id),className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",(u.status===H.id||H.id==="completed"&&u.progress===100||H.id==="in-progress"&&u.progress&&u.progress>0&&u.progress<100||H.id==="todo"&&(!u.progress||u.progress===0)&&u.status!=="in-progress"&&u.status!=="completed")&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",H.id==="completed"?"bg-green-500":H.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:H.label})]},H.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{j(false),he(false),M(null),te(!W);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[u.assignees&&u.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[u.assignees.slice(0,3).map((H,re)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:H.color||"#8B5CF6"},title:H.name,children:H.initials||H.name.slice(0,2).toUpperCase()},re)),u.assignees.length>3&&jsxRuntime.jsxs("span",{className:b("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:["+",u.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:b("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:b("w-3 h-3",c?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:W&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(H=>{let re=u.assignees?.some(be=>be.name===H.name);return jsxRuntime.jsxs("button",{onClick:()=>{let be=u.assignees||[],tt;re?tt=be.filter(ie=>ie.name!==H.name):tt=[...be,{name:H.name,avatar:H.avatar,initials:H.initials||H.name.slice(0,2).toUpperCase(),color:H.color||"#8B5CF6"}],Pe("assignees",tt);},className:b("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50",re&&(c?"bg-white/5":"bg-gray-50")),children:[H.avatar?jsxRuntime.jsx("img",{src:H.avatar,alt:H.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:H.color||"#8B5CF6"},children:H.initials||H.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:b("flex-1 text-left",c?"text-white":"text-gray-900"),children:H.name}),re&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},H.id||H.name)}):jsxRuntime.jsx("div",{className:b("px-3 py-4 text-sm text-center",c?"text-[#6B7280]":"text-gray-400"),children:s==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{M(T?null:"start"),B(u.startDate||new Date);},className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",c?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[u.startDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:b("mx-1",c?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),u.endDate?.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(s==="es"?"Fin":"End"),(u.startDate||u.endDate)&&jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:H=>{H.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>M(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:b("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:H=>H.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:b("w-44 py-2 border-r",c?"border-white/10":"border-gray-200"),children:[(()=>{let H=new Date,re=new Date(H);re.setDate(H.getDate()+1);let be=new Date(H);be.setDate(H.getDate()+((6-H.getDay()+7)%7||7));let tt=new Date(H);tt.setDate(H.getDate()+((1-H.getDay()+7)%7||7));let ie=new Date(H);ie.setDate(H.getDate()+(6-H.getDay()+7)%7+7);let K=new Date(H);K.setDate(H.getDate()+14);let ae=new Date(H);return ae.setDate(H.getDate()+28),[{label:s==="es"?"Hoy":"Today",date:H,display:H.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Ma\xF1ana":"Tomorrow",date:re,display:re.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:s==="es"?"Este fin de semana":"This weekend",date:be,display:s==="es"?"s\xE1b.":"sat."},{label:s==="es"?"Pr\xF3xima semana":"Next week",date:tt,display:s==="es"?"lun.":"mon."},{label:s==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ie,display:ie.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:s==="es"?"2 semanas":"2 weeks",date:K,display:K.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:s==="es"?"4 semanas":"4 weeks",date:ae,display:ae.toLocaleDateString(s==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((le,Je)=>jsxRuntime.jsxs("button",{className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(T==="start"){let $e=u.endDate&&le.date>u.endDate?le.date:u.endDate;it(le.date,$e),M("end");}else {let $e=u.startDate&&le.date<u.startDate?le.date:u.startDate;it($e,le.date),M(null);}},children:[jsxRuntime.jsx("span",{children:le.label}),jsxRuntime.jsx("span",{className:b("text-xs",c?"text-[#6B7280]":"text-gray-400"),children:le.display})]},Je))})(),jsxRuntime.jsx("div",{className:b("border-t mt-2 pt-2",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{it(void 0,void 0),M(null);},className:b("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",c?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:s==="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:b("text-xs mb-3 px-2 py-1 rounded",c?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T==="start"?s==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":s==="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:b("font-medium",c?"text-white":"text-gray-900"),children:v.toLocaleDateString(s==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>B(new Date),className:b("p-1 rounded text-sm transition-colors",c?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:s==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>B(new Date(v.getFullYear(),v.getMonth()-1)),className:b("p-1 rounded",c?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>B(new Date(v.getFullYear(),v.getMonth()+1)),className:b("p-1 rounded",c?"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:(s==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(H=>jsxRuntime.jsx("div",{className:b("w-8 h-8 flex items-center justify-center text-xs",c?"text-[#6B7280]":"text-gray-400"),children:H},H))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let H=v.getFullYear(),re=v.getMonth(),be=new Date(H,re,1).getDay(),tt=new Date(H,re+1,0).getDate(),ie=new Date(H,re,0).getDate(),K=new Date,ae=[];for(let le=be-1;le>=0;le--)ae.push({day:ie-le,isCurrentMonth:false,date:new Date(H,re-1,ie-le)});for(let le=1;le<=tt;le++)ae.push({day:le,isCurrentMonth:true,date:new Date(H,re,le)});let Me=42-ae.length;for(let le=1;le<=Me;le++)ae.push({day:le,isCurrentMonth:false,date:new Date(H,re+1,le)});return ae.map((le,Je)=>{let $e=le.date.toDateString()===K.toDateString(),Re=u.startDate?.toDateString()===le.date.toDateString(),Le=u.endDate?.toDateString()===le.date.toDateString(),Ne=Re||Le,_=u.startDate&&u.endDate&&le.date>=u.startDate&&le.date<=u.endDate;return jsxRuntime.jsx("button",{className:b("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!le.isCurrentMonth&&(c?"text-[#4B5563]":"text-gray-300"),le.isCurrentMonth&&(c?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#3B82F6]",Re&&"bg-[#3B82F6] text-white",Le&&!Re&&"bg-[#7C3AED] text-white",_&&!Ne&&(c?"bg-[#7C3AED]/20":"bg-purple-100"),!Ne&&(c?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let J=new Date(le.date);if(T==="start"){let De=u.endDate&&J>u.endDate?J:u.endDate;it(J,De),M("end");}else {let De=u.startDate&&J<u.startDate?J:u.startDate;it(De,J),M(null);}},children:le.day},Je)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{ta(),he(!me);},className:b("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",u.priority==="high"||u.priority==="urgent"?"bg-red-500/20 text-red-400":u.priority==="medium"?"bg-yellow-500/20 text-yellow-400":u.priority==="low"?"bg-green-500/20 text-green-400":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:u.priority?u.priority==="high"||u.priority==="urgent"?s==="es"?"Urgente":"Urgent":u.priority==="medium"?s==="es"?"Media":"Medium":s==="es"?"Baja":"Low":s==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>he(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:b("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",c?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:s==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:s==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:s==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:s==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:s==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(H=>jsxRuntime.jsxs("button",{onClick:()=>{Pe("priority",H.id),he(false);},className:b("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",c?"hover:bg-white/5":"hover:bg-gray-50",u.priority===H.id&&(c?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:b("w-2 h-2 rounded-full",H.color)}),jsxRuntime.jsx("span",{className:c?"text-white":"text-gray-900",children:H.label})]},H.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:b("text-sm",c?"text-white":"text-gray-900"),children:u.startDate&&u.endDate?`${Math.ceil((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24))} ${s==="es"?"d\xEDas":"days"}`:s==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded-full border-2",c?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:u.progress||0,onChange:H=>{let re=parseInt(H.target.value),be=u.status;re===100?be="completed":re>0?be="in-progress":be="todo";let tt={...u,progress:re,status:be};y(tt),a.onTaskUpdate?.(tt);},onBlur:()=>I(false),className:b("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",c?"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:()=>I(true),className:b("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",c?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:b("h-full rounded-full transition-all",u.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${u.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:b("text-sm font-medium min-w-[40px]",c?"text-white":"text-gray-900"),children:[u.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx($a,{selectedTags:u.tags||[],availableTags:p,onChange:H=>{Pe("tags",H);},onCreateTag:d,theme:w})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:b("w-4 h-4",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:b("text-sm w-24",c?"text-[#9CA3AF]":"text-gray-500"),children:s==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:b("text-sm",c?"text-[#6B7280]":"text-gray-400"),children:u.dependencies&&u.dependencies.length>0?`${u.dependencies.length} ${s==="es"?"dependencias":"dependencies"}`:s==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm transition-colors",c?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),s==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxRuntime.jsxs("button",{className:b("flex items-center gap-2 text-sm mt-2 transition-colors",c?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),s==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:s==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),s==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:s==="es"?"Agregar subtarea":"Add subtask"}),u.subtasks&&u.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:u.subtasks.map(H=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:b("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",H.progress===100?"bg-green-500 border-green-500":c?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:H.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:b("text-sm",H.progress===100?"line-through text-[#6B7280]":c?"text-white":"text-gray-900"),children:H.name})]},H.id))}),jsxRuntime.jsxs("button",{className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),s==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold",c?"text-white":"text-gray-900"),children:s==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:b("p-1 rounded transition-colors",c?"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:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",c?"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"}),s==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:b("mt-6 pt-4 border-t",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:b("text-sm font-semibold mb-3",c?"text-white":"text-gray-900"),children:s==="es"?"Adjuntos":"Attachments"}),jsxRuntime.jsxs("div",{className:b("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",c?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx(lucideReact.Upload,{className:b("w-6 h-6 mx-auto mb-2",c?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsxs("p",{className:b("text-sm",c?"text-[#9CA3AF]":"text-gray-500"),children:[s==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsxRuntime.jsx("span",{className:b("underline",c?"text-white":"text-gray-700"),children:s==="es"?"subir":"upload"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:b("w-[280px] border-l flex flex-col",c?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:b("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:b("font-medium",c?"text-white":"text-gray-900"),children:s==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:b("text-sm text-center py-8",c?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),s==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:b("p-3 border-t",c?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:b("flex items-center gap-2 px-3 py-2 rounded-lg",c?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:s==="es"?"Escribe un comentario...":"Write a comment...",className:b("flex-1 bg-transparent text-sm outline-none",c?"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:()=>D(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:b("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",c?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:b("px-4 py-3 border-b flex items-center justify-between",c?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:b("font-medium",c?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(s==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>D(null),className:b("p-1 rounded",c?"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(H=>jsxRuntime.jsxs("button",{onClick:()=>{D(null),y(H.task);},className:b("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",c?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Ac,{task:H.task}),jsxRuntime.jsx("span",{className:b("text-sm truncate flex-1",c?"text-white":"text-gray-900"),children:H.title}),H.task.priority==="high"||H.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},H.id))})]})]})})]})}var Mi={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"},Ai={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"},Ii={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"},zn={dark:Mi,light:Ai,neutral:Ii};function Lc(e){return zn[e]||zn.dark}function q0({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:i,className:m}){let[p,d]=react.useState(false),l=react.useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),s=react.useMemo(()=>{let f=l.length,c=new Set(l.flatMap(k=>k.assignedUserIds||[])).size,w=l.map(k=>k.priority).filter(Boolean),h=new Set(l.flatMap(k=>k.labels||[])).size;return {totalCards:f,uniqueAssignees:c,priorities:w,labels:h}},[l]),g=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:b("card-stack",!e.isExpanded&&"card-stack-collapsed",m),onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:g,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:b("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:s.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"]})]}),p&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),i?.(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:[s.uniqueAssignees," assignees"]})]}),s.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:[s.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:l.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:l.map(f=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsxRuntime.jsx("h4",{children:f.title}),f.description&&jsxRuntime.jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:c=>{c.stopPropagation(),n?.(e.id,f.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"})]})})]},f.id))})})]})}var Rc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Bo(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 Ro(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 Oc(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 zc({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:i,className:m}){let p=react.useMemo(()=>({...Rc,...i}),[i]),[d,l]=react.useState(new Set),s=react.useRef(null),g=react.useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let u=new Map;return e.forEach(y=>{let x=y.timestamp.toISOString().split("T")[0],D=u.get(x);D?D.push(y):u.set(x,[y]);}),Array.from(u.entries()).sort((y,x)=>x[0].localeCompare(y[0])).map(([y,x])=>({date:new Date(y),events:x.sort((D,T)=>T.timestamp.getTime()-D.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:f,uniqueTypes:c}=react.useMemo(()=>{let u=new Set,y=new Set;return e.forEach(x=>{u.add(x.userId),y.add(x.type);}),{uniqueUsers:Array.from(u),uniqueTypes:Array.from(y)}},[e]),w=u=>{l(y=>{let x=new Set(y);return x.has(u)?x.delete(u):x.add(u),x});},h=u=>{let x=new Date().getTime()-u.getTime(),D=Math.floor(x/6e4),T=Math.floor(x/36e5),M=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:T<24?`${T}h ago`:M<7?`${M}d ago`:u.toLocaleDateString()},k=react.useMemo(()=>{let u=0;return t.types&&t.types.length>0&&u++,t.users&&t.users.length>0&&u++,t.dateRange&&u++,t.searchTerm&&u++,u},[t]);return react.useEffect(()=>{if(n&&s.current){let u=s.current.querySelector(`[data-event-id="${n}"]`);u&&u.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:b("history-timeline-empty",m),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:b("history-timeline",p.compact&&"compact",m),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:u=>{let y=u.target.value;a({...t,types:y?[y]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),c.map(u=>jsxRuntime.jsxs("option",{value:u,children:[Ro(u)," ",u.replace("_"," ")]},u))]}),f.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:u=>{let y=u.target.value;a({...t,users:y?[y]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),f.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:u=>a({...t,searchTerm:u.target.value})})]}),k>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",k,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:s,children:g.map(u=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&u.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:u.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[u.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:u.events.map((y,x)=>{let D=d.has(y.id),T=n===y.id,M=Oc(y.type);return jsxRuntime.jsxs("div",{"data-event-id":y.id,className:b("history-timeline-event",D&&"expanded",T&&"selected"),onClick:()=>o?.(y),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:M},children:p.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ro(y.type)})}),x<u.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:M}})]}),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:[p.showAvatars&&y.userAvatar&&jsxRuntime.jsx("img",{src:y.userAvatar,alt:y.userName||y.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:y.userName||y.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Bo(y)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?h(y.timestamp):y.timestamp.toLocaleString()})]}),Object.keys(y.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),w(y.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(y.changes).map(([v,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},v)),y.metadata&&Object.keys(y.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(y.metadata).map(([v,B])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},v))]})]})]})]},y.id)})})]},u.date?.toISOString()||"all"))})]})}function Uc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:i,onGoToEvent:m,onSpeedChange:p,className:d}){let l=[.5,1,1.5,2,3],s=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),g=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:b("history-replay-empty",d),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:b("history-replay",d),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:s&&Ro(s.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:s&&Bo(s)}),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:s&&s.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:f=>m(parseInt(f.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${g}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((f,c)=>jsxRuntime.jsx("div",{className:b("history-replay-progress-marker",c===e.currentIndex&&"active"),style:{left:`${c/(e.totalEvents-1)*100}%`},onClick:()=>m(c),title:Bo(f)},f.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:i,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:l.map(f=>jsxRuntime.jsxs("button",{className:b("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>p(f),children:[f,"x"]},f))})]}),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:s&&s.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(f=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxRuntime.jsxs("div",{className:b("history-replay-start",d),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 Fi(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 Li(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 Wc(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 Hc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function th(e,t,a,r,o,n=100){let i=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),m=new Map(i.map(p=>[p.id,p]));for(let p=0;p<n;p++){let d=1-p/n;i.forEach(l=>{let s=a/2,g=r/2;l.vx+=(s-l.x)*o.centerForce*d,l.vy+=(g-l.y)*o.centerForce*d,i.forEach(f=>{if(l.id===f.id)return;let c=l.x-f.x,w=l.y-f.y,h=Math.sqrt(c*c+w*w)||1,k=o.chargeStrength*d/(h*h);l.vx+=c/h*k,l.vy+=w/h*k;});}),t.forEach(l=>{let s=m.get(typeof l.source=="string"?l.source:l.source.id),g=m.get(typeof l.target=="string"?l.target:l.target.id);if(!s||!g)return;let f=g.x-s.x,c=g.y-s.y,w=Math.sqrt(f*f+c*c)||1,h=(w-o.linkDistance)/w*o.forceStrength*d;s.vx+=f*h,s.vy+=c*h,g.vx-=f*h,g.vy-=c*h;}),i.forEach(l=>{l.fx!==null&&l.fx!==void 0?(l.x=l.fx,l.vx=0):l.x+=l.vx,l.fy!==null&&l.fy!==void 0?(l.y=l.fy,l.vy=0):l.y+=l.vy,l.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,l.x)),l.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,l.y)),l.vx*=.9,l.vy*=.9;});}return i}function Gc({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:i,onInteraction:m,className:p}){let d=react.useRef(null),[l,s]=react.useState([]),[g,f]=react.useState(null),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(1),[x,D]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let L=th(e,t,a.width,a.height,a,150);s(L);},[e,t,a]);let T=react.useCallback((L,q)=>{a.enableDragging&&(q.stopPropagation(),f(L));},[a.enableDragging]),M=react.useCallback(L=>{if(!g||!d.current)return;let j=d.current.getBoundingClientRect(),me=(L.clientX-j.left-x.x)/u,he=(L.clientY-j.top-x.y)/u;s(W=>W.map(te=>te.id===g?{...te,x:me,y:he,fx:me,fy:he}:te));},[g,u,x]),v=react.useCallback(()=>{f(null);},[]),B=react.useCallback((L,q)=>{q.stopPropagation(),m?.({type:"node-click",node:L,position:{x:q.clientX,y:q.clientY}});},[m]),S=react.useCallback((L,q)=>{q.stopPropagation(),m?.({type:"edge-click",edge:L,position:{x:q.clientX,y:q.clientY}});},[m]),C=react.useCallback(L=>{let q=l.find(j=>j.id===L);return q?{x:q.x,y:q.y}:{x:0,y:0}},[l]),$=react.useCallback(L=>{if(L.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return L.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let q=L.card.priority;return q==="URGENT"?"#ef4444":q==="HIGH"?"#f59e0b":q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return L.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:b("relationships-graph-empty",p),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:b("relationships-graph",p),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:i.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:i.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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:()=>y(L=>Math.min(L+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(u*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>y(L=>Math.max(L-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{y(1),D({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(L=>L.type))).map(L=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Fi(L)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Wc(L)," ",Li(L)]})]},L))}),jsxRuntime.jsxs("svg",{ref:d,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:M,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${u})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(L=>{let q=C(typeof L.source=="string"?L.source:L.source.id),j=C(typeof L.target=="string"?L.target:L.target.id),me=Hc(L.type),he=h===L.id,W=L.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-edge",he&&"hovered",W&&"critical"),onMouseEnter:()=>k(L.id),onMouseLeave:()=>k(null),onClick:te=>S(L,te),children:[jsxRuntime.jsx("line",{x1:q.x,y1:q.y,x2:j.x,y2:j.y,stroke:Fi(L.type),strokeWidth:W?a.edgeWidth*2:a.edgeWidth,strokeOpacity:he?1:.6,markerEnd:me?"url(#arrowhead)":void 0}),a.showEdgeLabels&&he&&jsxRuntime.jsx("text",{x:(q.x+j.x)/2,y:(q.y+j.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Li(L.type)})]},L.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:l.map(L=>{let q=c===L.id,j=L.onCriticalPath;return jsxRuntime.jsxs("g",{className:b("relationships-graph-node",q&&"hovered",j&&"critical"),transform:`translate(${L.x}, ${L.y})`,onMouseDown:me=>T(L.id,me),onMouseEnter:()=>w(L.id),onMouseLeave:()=>w(null),onClick:me=>B(L,me),children:[jsxRuntime.jsx("circle",{r:j?a.nodeSize*1.2:a.nodeSize,fill:$(L),stroke:j?"#fbbf24":"#ffffff",strokeWidth:j?3:2,opacity:q?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:L.card.title.length>20?L.card.title.substring(0,20)+"...":L.card.title})]},L.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 jc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,i]=react.useState(""),[m,p]=react.useState(false),[d,l]=react.useState(null),[s,g]=react.useState(null),f=react.useRef(null),c=m||o;react.useEffect(()=>{e&&f.current&&f.current.focus();},[e]),react.useEffect(()=>{let u=y=>{y.key==="Escape"&&!c&&w();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,c]);let w=()=>{c||(i(""),l(null),g(null),t());},h=async()=>{if(!(!n.trim()||c)){p(true),l(null),g(null);try{let u=await r(n.trim());g(u);}catch(u){l(u instanceof Error?u.message:"Failed to generate plan");}finally{p(false);}}},k=()=>{s&&(a(s),w());};return e?jsxRuntime.jsxs(nt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),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:u=>u.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:w,disabled:c,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:s?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!"})]}),s.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:s.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",s.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:s.columns.map((u,y)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:u.title},y))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",s.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[s.cards.slice(0,10).map((u,y)=>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:u.title}),u.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:u.description})]}),u.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${u.priority==="URGENT"?"bg-red-500/20 text-red-400":u.priority==="HIGH"?"bg-orange-500/20 text-orange-400":u.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:u.priority})]})},y)),s.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",s.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:f,value:n,onChange:u=>i(u.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:c}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),d&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:d}),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((u,y)=>jsxRuntime.jsx("button",{onClick:()=>i(u),disabled:c,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:u},y))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:c&&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:w,disabled:c,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"}),s?jsxRuntime.jsx("button",{onClick:k,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:h,disabled:!n.trim()||c,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:c?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Bi={"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 rh={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},oh={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 nh(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Oo(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=nh(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(s=>s.timestamp>=t.start&&s.timestamp<=t.end));let r=a.length,o=a.reduce((s,g)=>s+g.cost,0),n=a.reduce((s,g)=>s+g.inputTokens,0),i=a.reduce((s,g)=>s+g.outputTokens,0),m=a.filter(s=>s.success),p=a.reduce((s,g)=>s+g.duration,0),d={},l={};return a.forEach(s=>{d[s.feature]=(d[s.feature]||0)+1,l[s.feature]=(l[s.feature]||0)+s.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:i,operationsByFeature:d,costsByFeature:l,averageDuration:r>0?p/r:0,successRate:r>0?m.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],n=new Date,i=new Date;a==="month"?i.setMonth(n.getMonth()-1):i.setDate(n.getDate()-1);let m=this.operations.filter(l=>l.timestamp>=i).length,p=Math.max(0,o-m),d=m/o*100;return {used:m,limit:o,remaining:p,percentUsed:d,isExceeded:m>=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)}},zr=new Ri;function qc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(zr.getStats()),[n,i]=react.useState(zr.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(zr.getStats()),i(zr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),react.useEffect(()=>{let p=d=>{d.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let m=zr.getRecentOperations(5);return jsxRuntime.jsxs(nt,{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:p=>p.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:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Oo(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(([p,d])=>{let l=r.costsByFeature[p]||0,s=r.totalOperations>0?d/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:p.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:[d," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Oo(l)})]})]}),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:`${s}%`}})})]},p)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),m.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:m.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Oo(p.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 Zc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[i,m]=react.useState(""),[p,d]=react.useState(""),[l,s]=react.useState(""),[g,f]=react.useState(false),[c,w]=react.useState(null),[h,k]=react.useState(null),[u,y]=react.useState(null),x=react.useRef(null),D=g||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let S=C=>{C.key==="Escape"&&!D&&T();};if(e)return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,D]);let T=()=>{D||(m(""),d(""),s(""),w(null),k(null),y(null),t());},M=async()=>{if(!(!i.trim()||D)){f(true),w(null),k(null),y(null);try{let S=await r({prompt:i.trim(),projectName:n||"Mi Proyecto",startDate:p||void 0,endDate:l||void 0});k(S.tasks.tasks),y({from_cache:S.from_cache,tokens_used:S.tokens_used,mock_mode:S.mock_mode,similarity:S.similarity,tokens_saved:S.tokens_saved});}catch(S){w(S instanceof Error?S.message:"Failed to generate tasks");}finally{f(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let B=u?.similarity?((u.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nt,{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:S=>S.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:T,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:h?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:[u?.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"}),u?.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 (",B,"% 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:[u?.tokens_used||0," tokens"]}),u?.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:[u.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:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((S,C)=>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:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:S.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"})]}),S.start," \u2192 ",S.end]}),jsxRuntime.jsxs("span",{children:[S.duration," days"]}),S.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",S.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${S.priority==="high"?"bg-red-500/20 text-red-400":S.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:S.priority})]})},S.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:x,value:i,onChange:S=>m(S.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:p,onChange:S=>d(S.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:l,onChange:S=>s(S.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})]})]}),c&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:c}),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((S,C)=>jsxRuntime.jsx("button",{onClick:()=>m(S),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:S},C))})]})]})}),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:T,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"}),h?jsxRuntime.jsx("button",{onClick:v,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:M,disabled:!i.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 Wn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Ko(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(k,u,y)=>{console.warn(`Retry attempt ${u} after ${y}ms: ${k.message}`);}}).then(k=>{k.success||console.error(`Failed to persist board after ${k.attempts} attempts:`,k.error);});},[t]),n=react.useCallback(async(h,k,u)=>{r(y=>{let x=y.cards.find(S=>S.id===h);if(!x)return y;let D=x.columnId,T={...x,columnId:k,position:u},M=y.cards.map(S=>S.id===h?T:S),v=y.columns.map(S=>{if(S.id===D)return {...S,cardIds:S.cardIds.filter(C=>C!==h)};if(S.id===k){let C=M.filter($=>$.columnId===k).sort(($,L)=>$.position-L.position);return {...S,cardIds:C.map($=>$.id)}}return S}),B={...y,cards:M,columns:v};return o(B),B});},[o]),i=react.useCallback(async(h,k)=>{r(u=>{let y=u.cards.map(D=>D.id===h?{...D,...k}:D),x={...u,cards:y};return o(x),x});},[o]),m=react.useCallback(async h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let y={...h,id:k},x=u.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,k]}:T),D={...u,cards:[...u.cards,y],columns:x};return o(D),D});},[o]),p=react.useCallback(async h=>{r(k=>{let u=k.cards.find(T=>T.id===h);if(!u)return k;let y=k.cards.filter(T=>T.id!==h),x=k.columns.map(T=>T.id===u.columnId?{...T,cardIds:T.cardIds.filter(M=>M!==h)}:T),D={...k,cards:y,columns:x};return o(D),D});},[o]),d=react.useCallback(async h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>{let y={...h,id:k,cardIds:[]},x={...u,columns:[...u.columns,y]};return o(x),x});},[o]),l=react.useCallback(async(h,k)=>{r(u=>{let y=u.columns.map(D=>D.id===h?{...D,...k}:D),x={...u,columns:y};return o(x),x});},[o]),s=react.useCallback(async h=>{r(k=>{let u=k.cards.filter(D=>D.columnId!==h),y=k.columns.filter(D=>D.id!==h),x={...k,cards:u,columns:y};return o(x),x});},[o]),g=react.useCallback(h=>{let k=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return m(h),k},[m]),f=react.useCallback(h=>{let k=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(h),k},[d]),c=react.useCallback(()=>{r(h=>{let k={...h,cards:[],columns:[]};return o(k),k});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:i,onCardCreate:m,onCardDelete:p,onColumnCreate:d,onColumnUpdate:l,onColumnDelete:s},setBoard:r,helpers:{addCard:g,addColumn:f,deleteCard:p,deleteColumn:s,clearBoard:c}}}function em({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Wn({initialBoard:e,onPersist:a}),i=react.useMemo(()=>({addCard:(p,d,l={})=>{n.addCard({title:d,columnId:p,position:r.cards.filter(s=>s.columnId===p).length,...l});},addColumn:(p,d)=>{let l=r.columns.length>0?Math.max(...r.columns.map(s=>s.position)):0;n.addColumn({title:p,position:d??l+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:i}}var zo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},am={by:"none",order:"asc"};function rm({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...zo,...e}),[n,i]=react.useState({...am,...t}),m=react.useCallback(w=>{o(h=>({...h,...w}));},[]),p=react.useCallback(w=>{i(h=>({...h,...w}));},[]),d=react.useCallback(()=>{o(zo),i(am);},[]),l=react.useCallback(()=>{a&&o({...zo,assignees:[a]});},[a]),s=react.useCallback(()=>{o({...zo,dateFilter:"overdue"});},[]),g=react.useCallback(()=>{o({...zo,priorities:["HIGH","URGENT"]});},[]),f=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||n.by!=="none",[r,n]),c=react.useCallback(w=>{let h=[...w];if(r.search){let k=r.search.toLowerCase();h=h.filter(u=>u.title.toLowerCase().includes(k)||u.description?.toLowerCase().includes(k));}if(r.dateFilter!=="all"){let k=new Date,u=k.getFullYear(),y=String(k.getMonth()+1).padStart(2,"0"),x=String(k.getDate()).padStart(2,"0"),D=`${u}-${y}-${x}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let M=T.endDate||T.dueDate;if(!M)return false;let v;if(typeof M=="string")v=M.split("T")[0]||M;else {let B=M.getUTCFullYear(),S=String(M.getUTCMonth()+1).padStart(2,"0"),C=String(M.getUTCDate()).padStart(2,"0");v=`${B}-${S}-${C}`;}switch(r.dateFilter){case "overdue":return v<D;case "today":return v===D;case "this-week":let B=new Date(D+"T00:00:00"),S=new Date(v+"T00:00:00"),C=new Date(B);return C.setDate(C.getDate()+7),S>=B&&S<=C;case "custom":if(r.dateRange){let $=typeof M=="string"?new Date(M):M;return $>=r.dateRange.start&&$<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(k=>k.priority&&r.priorities.includes(k.priority))),r.assignees.length>0&&(h=h.filter(k=>(k.assignedUserIds||(k.assigneeId?[k.assigneeId]:[])).some(y=>r.assignees.includes(y)))),r.labels.length>0&&(h=h.filter(k=>k.labels&&k.labels.some(u=>r.labels.includes(u)))),r.columns.length>0&&(h=h.filter(k=>r.columns.includes(k.columnId))),n.by!=="none"&&h.sort((k,u)=>{let y=0;switch(n.by){case "created":let x=k.createdAt?new Date(k.createdAt).getTime():0,D=u.createdAt?new Date(u.createdAt).getTime():0;y=x-D;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},M=T[k.priority||"LOW"],v=T[u.priority||"LOW"];y=M-v;break;case "dueDate":let B=k.endDate||k.dueDate,S=u.endDate||u.dueDate;if(!B)return 1;if(!S)return -1;let C=typeof B=="string"?new Date(B).getTime():B.getTime(),$=typeof S=="string"?new Date(S).getTime():S.getTime();y=C-$;break;case "title":y=k.title.localeCompare(u.title);break;case "estimate":let L=k.estimatedTime||0,q=u.estimatedTime||0;y=L-q;break;default:y=0;}return n.order==="asc"?y:-y}),h},[r,n]);return {filters:r,sort:n,setFilters:m,setSort:p,resetFilters:d,filterMyTasks:l,filterOverdue:s,filterHighPriority:g,applyFilters:c,hasActiveFilters:f}}var nm,sm;if(typeof window<"u")try{let e=_o("ai");nm=e.generateObject,sm=e.generateText;}catch{}function im(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(nm&&sm&&e.apiKey),i=react.useCallback(async s=>{if(!n)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:",s),{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: ${s}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(g){let f=g instanceof Error?g:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[n]),m=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",s.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(g){let f=g instanceof Error?g:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[n]),p=react.useCallback(async s=>{if(!n)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(g){let f=g instanceof Error?g:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[n]),d=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",s.title),[{title:`Subtask 1 for: ${s.title}`,position:s.position+.1,columnId:s.columnId},{title:`Subtask 2 for: ${s.title}`,position:s.position+.2,columnId:s.columnId}]}catch(g){let f=g instanceof Error?g:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[n]),l=react.useCallback(async s=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",s.title),{hours:8,confidence:.75}}catch(g){let f=g instanceof Error?g:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[n]);return {onGeneratePlan:i,onSuggestAssignee:m,onPredictRisks:p,onGenerateSubtasks:d,onEstimateEffort:l,isAvailable:n,isLoading:t,error:r}}function zi(){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 lm(e){let{cards:t}=e,[a,r]=zi(),o=react.useCallback(s=>a.selectedCardIds.includes(s),[a.selectedCardIds]),n=react.useCallback((s,g)=>{if(!g){r({selectedCardIds:[s],lastSelectedCardId:s});return}let f=g.ctrlKey||g.metaKey,c=g.shiftKey;if(f)a.selectedCardIds.includes(s)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==s),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,s],lastSelectedCardId:s});else if(c&&a.lastSelectedCardId){let w=t.find(k=>k.id===s),h=t.find(k=>k.id===a.lastSelectedCardId);if(w&&h&&w.columnId===h.columnId){let k=t.filter(v=>v.columnId===w.columnId).sort((v,B)=>v.position-B.position),u=k.findIndex(v=>v.id===a.lastSelectedCardId),y=k.findIndex(v=>v.id===s),[x,D]=u<y?[u,y]:[y,u],T=k.slice(x,D+1).map(v=>v.id),M=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:M,lastSelectedCardId:s});}else r({selectedCardIds:[s],lastSelectedCardId:s});}else r({selectedCardIds:[s],lastSelectedCardId:s});},[t,a,r]),i=react.useCallback(s=>{r({selectedCardIds:a.selectedCardIds.filter(g=>g!==s),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),m=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=react.useCallback(()=>{r({selectedCardIds:t.map(s=>s.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),d=react.useCallback(s=>{a.selectedCardIds.includes(s)?i(s):r({selectedCardIds:[...a.selectedCardIds,s],lastSelectedCardId:s});},[a,i,r]),l=react.useCallback(()=>t.filter(s=>a.selectedCardIds.includes(s.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:i,clearSelection:m,selectAll:p,toggleCard:d,getSelectedCards:l}}var dm={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cm(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...dm,...a}),[a]),[n,i]=react.useState([]),m=react.useCallback((w,h,k,u,y)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:h,columnId:k,strategy:u,color:y,isExpanded:true,position:n.filter(D=>D.columnId===k).length,createdAt:new Date};i(D=>[...D,x]);},[o.minCardsPerStack,n]),p=react.useCallback(w=>{i(h=>h.filter(k=>k.id!==w));},[]),d=react.useCallback(w=>{i(h=>h.map(k=>k.id===w?{...k,isExpanded:!k.isExpanded}:k));},[]),l=react.useCallback((w,h)=>{i(k=>k.map(u=>u.id===w&&!u.cardIds.includes(h)?{...u,cardIds:[...u.cardIds,h]}:u));},[]),s=react.useCallback((w,h)=>{i(k=>k.map(u=>{if(u.id===w){let y=u.cardIds.filter(x=>x!==h);return y.length<o.minCardsPerStack?null:{...u,cardIds:y}}return u}).filter(u=>u!==null));},[o.minCardsPerStack]),g=react.useCallback(w=>n.filter(h=>h.columnId===w).sort((h,k)=>h.position-k.position),[n]),f=react.useCallback(async w=>{let h=t.filter(D=>D.columnId===w);if(h.length<o.minCardsPerStack*2)return [];let k=[],u=new Map;h.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(T=>{u.has(T)||u.set(T,[]),u.get(T).push(D);});}),u.forEach((D,T)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:D.map(M=>M.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${T}"`,confidence:.85});});let y=new Map;h.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(T=>{y.has(T)||y.set(T,[]),y.get(T).push(D);});}),y.forEach((D,T)=>{D.length>=o.minCardsPerStack&&k.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:D.map(M=>M.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(h.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,T)=>{if(D.length>=o.minCardsPerStack){let M={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";k.push({stack:{title:`${M} ${T} Priority`,cardIds:D.map(v=>v.id),columnId:w,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of h){let M=(await r.findSimilar(D,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(M.length>=o.minCardsPerStack-1){let v=[D.id,...M.map(S=>S.card.id)],B=M.reduce((S,C)=>S+C.similarity,0)/M.length;k.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:v,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${M.length+1} similar tasks`,confidence:B});}}return k.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,T)=>T.confidence-D.confidence).slice(0,5)},[t,o,r]),c=react.useCallback(w=>{m(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[m]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let k=await f(h),u=k[0];k.length>0&&u&&u.confidence>=.9&&c(u);});},[]),{stacks:n,createStack:m,deleteStack:p,toggleStack:d,addToStack:l,removeFromStack:s,getStacksForColumn:g,getSuggestions:f,applySuggestion:c,config:o}}var mm=react.createContext(null);function pm({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,i=new Map;t?.columns?.forEach(p=>{let{Column:d}=_o("@libxai/core");n.set(p.id,new d(p));}),t?.cards?.forEach(p=>{let{Card:d}=_o("@libxai/core");i.set(p.id,new d(p));});let m=null;if(t?.board){let{Board:p}=_o("@libxai/core");m=new p(t.board);}r.current=new core.BoardStore({board:m,columns:n,cards:i});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(mm.Provider,{value:{store:o},children:e})}function Hn(){let e=react.useContext(mm);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Uo(){let e=Hn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,i]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),i(e.getAllCards());}),[e]);let m=react.useCallback(u=>{e.updateBoard(u);},[e]),p=react.useCallback(u=>{e.addColumn(u);},[e]),d=react.useCallback((u,y)=>{e.updateColumn(u,y);},[e]),l=react.useCallback(u=>{e.deleteColumn(u);},[e]),s=react.useCallback(u=>e.getColumn(u),[e]),g=react.useCallback(u=>{e.addCard(u);},[e]),f=react.useCallback((u,y)=>{e.updateCard(u,y);},[e]),c=react.useCallback(u=>{e.deleteCard(u);},[e]),w=react.useCallback((u,y,x)=>{e.moveCard(u,y,x);},[e]),h=react.useCallback(u=>e.getCard(u),[e]),k=react.useCallback(u=>e.getCardsByColumn(u),[e]);return {board:t,columns:r,cards:n,updateBoard:m,addColumn:p,updateColumn:d,deleteColumn:l,getColumn:s,addCard:g,updateCard:f,deleteCard:c,moveCard:w,getCard:h,getCardsByColumn:k}}function gm(e){let{cards:t}=Uo();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 fm(e="position",t="asc"){let{cards:a}=Uo();return react.useMemo(()=>[...a].sort((o,n)=>{let i=0;switch(e){case "title":i=o.title.localeCompare(n.title);break;case "priority":{let m={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?m[o.priority]:0,d=n.priority?m[n.priority]:0;i=p-d;break}case "createdAt":i=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":i=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":i=o.position-n.position;break}return t==="asc"?i:-i}),[a,e,t])}var Gn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let i=n[t];if(typeof i=="function")try{let m=await Promise.resolve(i.apply(n,a));m!==void 0&&(o=m,a[0]=m);}catch(m){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,m,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(i=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,i,{plugin:o.id,hook:t});}));}await Promise.all(r);}},wh=new Gn;function bm({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:i=false,gap:m=0,getItemKey:p}){let d=react.useRef(null),l=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:n,horizontal:i,gap:m}),s=l.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=i?{width:`${l.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${l.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:g,className:o,children:jsxRuntime.jsx("div",{style:f,children:s.map(c=>{let w=e[c.index];if(!w)return null;let h=p?p(w,c.index):c.index,k={position:"absolute",top:i?0:c.start,left:i?c.start:0,width:i?c.size:"100%",height:i?"100%":c.size};return jsxRuntime.jsx("div",{style:k,"data-index":c.index,children:r(w,c.index)},h)})})})}function ym(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 xm({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:i=3,gap:m=16,getItemKey:p,horizontal:d=true}){let l=react.useRef(null),s=reactVirtual.useVirtualizer({horizontal:d,count:e.length,getScrollElement:()=>l.current,estimateSize:()=>r,overscan:i,gap:m}),g=s.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},c={width:`${s.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:f,className:n,children:jsxRuntime.jsx("div",{style:c,children:g.map(w=>{let h=e[w.index];if(!h)return null;let k=p?p(h,w.index):w.index,u={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsxRuntime.jsx("div",{style:u,"data-index":w.index,children:o(h,w.index)},k)})})})}function km(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 wm(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},_n={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Cm(e,t,a){return e[t]??a}function el(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?el(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Dh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(_n),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,i=Dh(o);a.push(` ${n}: ${i};`);}return `:root {
|
|
389
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function fc(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function sr(e,t){let a=fc(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let n=a.find(p=>p.name.toLowerCase().includes(r));if(n)return n;let s=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return s.every(l=>m.includes(l))})}function gi(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 d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}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 i={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(i!==void 0){let w=new Date(r),g=w.getDay(),b=i-g;return b<=0&&(b+=7),w.setDate(w.getDate()+b),w}}let n=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(n&&n[1]&&n[2]){let d=parseInt(n[1],10),i=n[2].toLowerCase(),w=new Date(r);return i==="day"||i==="d\xEDa"||i==="dias"?w.setDate(w.getDate()+d):i==="week"||i==="semana"||i==="semanas"?w.setDate(w.getDate()+d*7):(i==="month"||i==="mes"||i==="meses")&&w.setMonth(w.getMonth()+d),w}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let d=parseInt(p[1],10),i=parseInt(p[2],10)-1,w=parseInt(p[3],10);return new Date(w,i,d)}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},l=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(l&&l[1]&&l[2]){let d=parseInt(l[1],10),i=m[l[2].toLowerCase()],w=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(w,i,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},c=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(c&&c[1]&&c[2]){let d=u[c[1].toLowerCase()],i=parseInt(c[2],10),w=c[3]?parseInt(c[3],10):r.getFullYear();if(d!==void 0)return new Date(w,d,i)}return null}function fi(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 hi(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 hc(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 bc(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 l=r[1].trim(),u=r[2].trim(),c=sr(t,l),d=gi(u);if(!c)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:c.id,taskName:c.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let i=c.startDate&&c.endDate?Math.round((c.endDate.getTime()-c.startDate.getTime())/(1e3*60*60*24)):1,w=new Date(d);return w.setDate(w.getDate()+i),{type:"move_task",taskId:c.id,taskName:c.name,updates:{startDate:d,endDate:w},message:`Moved "${c.name}" to ${d.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),c=sr(t,l),d=fi(u);if(!c)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!c.endDate)return {type:"resize_task",taskId:c.id,taskName:c.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let i=new Date(c.endDate);return i.setDate(i.getDate()+d),{type:"resize_task",taskId:c.id,taskName:c.name,updates:{endDate:i},message:`Extended "${c.name}" by ${d} days. New end date: ${i.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),c=sr(t,l),d=hi(u);return c?d===null?{type:"set_progress",taskId:c.id,taskName:c.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:c.id,taskName:c.name,updates:{progress:d},message:`Set "${c.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let s=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),c=sr(t,l);return c?{type:"rename_task",taskId:c.id,taskName:c.name,updates:{name:u},message:`Renamed "${c.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let l=p[1].trim(),u=p[2].trim(),c=sr(t,l),d=sr(t,u);return c?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:c.id,dependencyTo:d.id,message:`Linked "${c.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let l=m[1].trim(),u=sr(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function yc(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 D0(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 N0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function En(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let c=a.find(d=>d.id===u);return c?{name:c.name,initials:c.initials,color:c.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>En(u,t,a)),n;e.dependencies&&(typeof e.dependencies[0]=="string"?n=e.dependencies:n=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},p=s(e.startDate),m=s(e.endDate),l=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:D0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:n?.length?n:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function vc(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(n=>n.name===r.name||n.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:N0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xc(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>En(r,e,t))}var bi={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"}},yi={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"}},Pn={en:bi,es:yi};function vi(e){return Pn[e]||Pn.en}function Mn(e,t){let a=vi(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 Tc(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(...Tc(r.subtasks,t+1));return a}function O0({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 Dc({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:n,style:s}){let{theme:p="dark",locale:m="en",customTranslations:l,showSearch:u=true,showHierarchy:c=true}=t,d=Mn(m,l),i=p==="dark",[w,g]=react.useState(new Set),[b,h]=react.useState("startDate"),[v,f]=react.useState("asc"),[x,T]=react.useState("");react.useMemo(()=>{let N=new Set;function C(G){for(let F of G)F.subtasks?.length&&(N.add(F.id),C(F.subtasks));}C(e),g(N);},[e]);let D=react.useCallback(N=>{g(C=>{let G=new Set(C);return G.has(N)?G.delete(N):G.add(N),G}),a.onTaskToggleExpand?.(N);},[a]),I=react.useCallback(N=>{b===N?f(C=>C==="asc"?"desc":"asc"):(h(N),f("asc")),a.onSortChange?.({column:N,direction:v==="asc"?"desc":"asc"});},[b,v,a]),k=react.useMemo(()=>{let N=Tc(e);if(x.trim()){let G=x.toLowerCase();N=N.filter(F=>F.name.toLowerCase().includes(G));}let C=[];for(let G of N){let F=G.level===0;G.level>0&&(F=true),(F||x.trim())&&C.push(G);}return x.trim()&&C.sort((G,F)=>{let J,K;switch(b){case "name":J=G.name.toLowerCase(),K=F.name.toLowerCase();break;case "startDate":J=G.startDate?.getTime()||0,K=F.startDate?.getTime()||0;break;case "endDate":J=G.endDate?.getTime()||0,K=F.endDate?.getTime()||0;break;case "progress":J=G.progress||0,K=F.progress||0;break;case "status":J=G.status||"todo",K=F.status||"todo";break;default:return 0}return J<K?v==="asc"?-1:1:J>K?v==="asc"?1:-1:0}),C},[e,x,b,v]),L=N=>N?(N instanceof Date?N:new Date(N)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",n),style:s,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:y("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.empty.noTasks}),jsxRuntime.jsx("p",{className:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-hidden",i?"bg-[#0F1117]":"bg-white",n),style:s,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:y("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:x,onChange:N=>T(N.target.value),placeholder:d.toolbar.searchPlaceholder,className:y("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",i?"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:y("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[k.length," ",d.pagination.tasks]})]})}),jsxRuntime.jsxs("div",{className:y("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",i?"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:()=>I("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>I("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>I("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>I("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[d.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:()=>I("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:k.map((N,C)=>{let G=w.has(N.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:C*.02},className:y("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",i?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:c?`${24+N.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(N),onDoubleClick:()=>a.onTaskDoubleClick?.(N),children:[jsxRuntime.jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[c&&N.hasChildren&&jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),D(N.id);},className:y("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-200"),children:G?jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-400")})}),c&&!N.hasChildren&&jsxRuntime.jsx("div",{className:"w-5"}),jsxRuntime.jsx("button",{onClick:F=>{F.stopPropagation(),a.onTaskUpdate?.({...N,progress:N.progress===100?0:100,status:N.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(O0,{status:N.status,progress:N.progress})}),jsxRuntime.jsx("span",{className:y("truncate",i?"text-white":"text-gray-900",N.progress===100&&(i?"line-through text-[#6B7280]":"line-through text-gray-400")),children:N.name})]}),jsxRuntime.jsx("div",{className:"col-span-2 flex items-center",children:jsxRuntime.jsx("span",{className:y("px-2 py-1 rounded-full text-xs font-medium",N.progress===100||N.status==="completed"?"bg-green-500/10 text-green-500":N.progress&&N.progress>0||N.status==="in-progress"?"bg-blue-500/10 text-blue-500":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:N.progress===100||N.status==="completed"?d.status.completed:N.progress&&N.progress>0||N.status==="in-progress"?d.status.inProgress:d.status.todo})}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),L(N.startDate)]}),jsxRuntime.jsxs("div",{className:y("col-span-2 flex items-center gap-1 text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),L(N.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:y("flex-1 h-1.5 rounded-full overflow-hidden",i?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",N.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${N.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-xs w-8",i?"text-[#9CA3AF]":"text-gray-500"),children:[N.progress||0,"%"]})]})})]},N.id)})}),k.length===0&&x&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:y("w-12 h-12 mx-auto mb-4",i?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y(i?"text-[#9CA3AF]":"text-gray-600"),children:d.empty.noResults})]})})]})]})}var xi={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"},ki={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"},wi={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"},In={dark:xi,light:ki,neutral:wi};function Nc(e){return In[e]||In.dark}var Ci={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"}},Ti={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"}},Fn={en:Ci,es:Ti};function Lo(e){return Fn[e]||Fn.en}function Ln(e,t){let a=Lo(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 Sc(e){let t=Lo(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 Ec(e,t=0,a=true){let r=Lo(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 th(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 Pi(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 Ic({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 Lc({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:n,className:s,style:p,availableTags:m=[],onCreateTag:l,attachmentsByTask:u}){let{theme:c="dark",locale:d="en",customTranslations:i}=t,w=Ln(d,i),g=c==="dark",b={textTertiary:g?"#6B7280":"#9CA3AF",textSecondary:g?"#9CA3AF":"#6B7280",textPrimary:g?"#FFFFFF":"#111827",borderLight:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:g?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:g?"#1A1D25":"#FFFFFF",bgSecondary:g?"#0F1117":"#F9FAFB",hoverBg:g?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},[h,v]=react.useState(r||new Date),[f,x]=react.useState(null),[T,D]=react.useState(null),[I,k]=react.useState(null),[L,N]=react.useState(new Date),[C,G]=react.useState({}),F=4,J=3,[K,de]=react.useState(false),[ge,Te]=react.useState(false),[Ce,z]=react.useState(false),[B,$]=react.useState(false),[P,Q]=react.useState(null),[ee,H]=react.useState(""),[De,Ee]=react.useState(void 0),[Be,xe]=react.useState(null),[U,ae]=react.useState(false),[Me,_e]=react.useState(false),[qe,Ke]=react.useState(null),[O,re]=react.useState(false),[ce,fe]=react.useState(new Date),[Ae,ot]=react.useState(false),[kt,Le]=react.useState(false),ke=react.useCallback(()=>{v(new Date(h.getFullYear(),h.getMonth()-1,1));},[h]),Ie=react.useCallback(()=>{v(new Date(h.getFullYear(),h.getMonth()+1,1));},[h]),Zt=react.useCallback(()=>{v(new Date);},[]),vt=react.useMemo(()=>{let A=h.getFullYear(),ue=h.getMonth(),_=new Date(A,ue,1),Z=new Date(A,ue+1,0),ve=_.getDay(),Y=Z.getDate(),ne=th(e),R=new Date;R.setHours(0,0,0,0);let W=[],Ne=ve,et=new Date(A,ue,0).getDate();for(let mt=Ne-1;mt>=0;mt--){let Re=new Date(A,ue-1,et-mt);W.push({date:Re,isCurrentMonth:false,isToday:false,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter(ut=>Pi(Re,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}for(let mt=1;mt<=Y;mt++){let Re=new Date(A,ue,mt),ut=Re.getTime()===R.getTime();W.push({date:Re,isCurrentMonth:true,isToday:ut,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter($t=>Pi(Re,$t)).map($t=>({id:$t.id,title:$t.name,start:$t.startDate,end:$t.endDate,task:$t}))});}let $e=42-W.length;for(let mt=1;mt<=$e;mt++){let Re=new Date(A,ue+1,mt);W.push({date:Re,isCurrentMonth:false,isToday:false,isWeekend:Re.getDay()===0||Re.getDay()===6,events:ne.filter(ut=>Pi(Re,ut)).map(ut=>({id:ut.id,title:ut.name,start:ut.startDate,end:ut.endDate,task:ut}))});}return W},[h,e]),sa=d==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Na=h.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Oe=react.useCallback((A,ue)=>{if(!f)return;let _={...f,[A]:ue};x(_),a.onTaskUpdate?.(_);},[f,a]),Ue=react.useCallback(A=>{if(!f)return;let ue=f.progress||0;A==="completed"?ue=100:A==="todo"&&(ue=0);let _={...f,status:A,progress:ue};x(_),a.onTaskUpdate?.(_),de(false);},[f,a]),qt=react.useCallback((A,ue)=>{if(!f)return;let _={...f,startDate:A,endDate:ue};x(_),a.onTaskUpdate?.(_);},[f,a]),he=react.useCallback(()=>{de(false),Te(false),z(false),k(null);},[]),Ge=react.useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),ot(false),!f||!a.onUploadAttachments)return;let ue=Array.from(A.dataTransfer.files);if(ue.length!==0){Le(true);try{await a.onUploadAttachments(f.id,ue);}finally{Le(false);}}},[f,a]),Fe=react.useCallback(async A=>{if(!f||!a.onUploadAttachments||!A.target.files)return;let ue=Array.from(A.target.files);if(ue.length!==0){Le(true);try{await a.onUploadAttachments(f.id,ue);}finally{Le(false);}A.target.value="";}},[f,a]),tt=react.useCallback(A=>{A.preventDefault(),A.stopPropagation(),ot(true);},[]),Xe=react.useCallback(A=>{A.preventDefault(),A.stopPropagation(),ot(false);},[]),wt=react.useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),st=react.useCallback(A=>A.startsWith("image/")?lucideReact.Image:A.includes("pdf")||A.includes("document")?lucideReact.FileText:lucideReact.File,[]),Qe=react.useMemo(()=>!f||!u?[]:u.get(f.id)||[],[f,u]);return o?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),style:p,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:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:[w.labels.noEvents,"..."]})]})}):n?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),style:p,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:y("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:y("flex-1 flex items-center justify-center",g?"bg-[#0F1117]":"bg-white",s),style:p,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:y("text-lg font-semibold mb-2",g?"text-white":"text-gray-900"),children:w.labels.noEvents}),jsxRuntime.jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-600"),children:w.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:y("flex-1 flex flex-col w-full h-full overflow-auto",g?"bg-[#0F1117]":"bg-white",s),style:p,children:[jsxRuntime.jsx("div",{className:y("flex-shrink-0 px-6 py-4 border-b",g?"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:y("text-xl font-semibold capitalize",g?"text-white":"text-gray-900"),children:Na}),jsxRuntime.jsx("button",{onClick:Zt,className:y("px-3 py-1.5 text-sm rounded-lg transition-colors",g?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:w.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:ke,className:y("p-2 rounded-lg transition-colors",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:y("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Ie,className:y("p-2 rounded-lg transition-colors",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:y("w-5 h-5",g?"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:sa.map(A=>jsxRuntime.jsx("div",{className:y("py-2 text-center text-xs font-medium uppercase",g?"text-[#9CA3AF]":"text-gray-500"),children:A},A))}),jsxRuntime.jsx("div",{className:y("grid grid-cols-7 auto-rows-min gap-px rounded-lg",g?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((A,ue)=>{let _=A.date.getDay()===0||A.date.getDay()===6;return jsxRuntime.jsxs("div",{className:y("min-h-[120px] p-2 transition-colors flex flex-col relative group",g?_?"bg-[#1C1F26]":A.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":_?"bg-gray-100":A.isCurrentMonth?"bg-white":"bg-gray-50",A.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Z=C[ue]||F,ve=A.events.slice(0,Z),Y=A.events.length-Z;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[ve.map(ne=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{x(ne.task),a.onEventClick?.(ne);},whileHover:{scale:1.02},className:y("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",ne.task.progress===100?g?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":g?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(Ic,{task:ne.task}),jsxRuntime.jsx("span",{className:"truncate",children:ne.title})]})},ne.id)),Y>0&&jsxRuntime.jsxs("button",{onClick:ne=>{ne.stopPropagation(),G(R=>({...R,[ue]:Z+J}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",g?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Y," ",d==="es"?"M\xC1S":"MORE"]}),Z>F&&A.events.length>F&&jsxRuntime.jsx("button",{onClick:ne=>{ne.stopPropagation(),G(R=>({...R,[ue]:F}));},className:y("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",g?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:d==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Z=ue>=28,ve=ue%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Y=>{Y.stopPropagation(),P===ue?Q(null):(Q(ue),H(""),Ee(void 0),xe(null),Ke(null),ae(false),_e(false),re(false),fe(A.date));},className:y("w-5 h-5 rounded flex items-center justify-center transition-all",P===ue?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",g?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:y("w-3.5 h-3.5 transition-transform",P===ue&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:P===ue&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Q(null),H(""),Ee(void 0),xe(null),Ke(null),ae(false),_e(false),re(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:Z?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Z?-5:5,scale:.95},transition:{duration:.12},className:y("absolute w-[320px] rounded-lg shadow-2xl z-50",Z?"bottom-full mb-1":"top-full mt-1",ve?"right-0":"left-0",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>{Y.stopPropagation(),ae(false),_e(false),re(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:ee,onChange:Y=>H(Y.target.value),placeholder:d==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:y("w-full bg-transparent text-sm outline-none placeholder:opacity-40",g?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Y=>{if(Y.key==="Enter"&&ee.trim()){let ne=t.availableUsers?.find(W=>W.id===Be),R=qe||A.date;a.onTaskCreate?.({name:ee.trim(),startDate:R,endDate:R,priority:De,assignees:ne?[ne]:void 0}),H(""),Ee(void 0),xe(null),Ke(null),Q(null);}Y.key==="Escape"&&(Q(null),H(""),Ee(void 0),xe(null),Ke(null));}})}),jsxRuntime.jsxs("div",{className:y("px-2.5 py-2 flex items-center justify-between border-t",g?"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:Y=>{Y.stopPropagation(),ae(!U),_e(false);},className:y("p-1 rounded transition-colors",De?De==="urgent"||De==="high"?"text-red-400 bg-red-500/20":De==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":g?"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:U&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:d==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:d==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:d==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:d==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:d==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxRuntime.jsxs("button",{onClick:()=>{Ee(Y.id),ae(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",De===Y.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",Y.color)}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:Y=>{Y.stopPropagation(),re(!O),ae(false),_e(false),fe(qe||A.date);},className:y("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",qe?"bg-[#7C3AED]/20 text-[#7C3AED]":g?"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"}),(qe||A.date).toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:O&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxRuntime.jsx("div",{className:y("w-40 py-2 border-r",g?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,ne=new Date(Y);ne.setDate(Y.getDate()+1);let R=new Date(Y);R.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let W=new Date(Y);W.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let Ne=new Date(Y);Ne.setDate(Y.getDate()+14);let et=new Date(Y);return et.setDate(Y.getDate()+28),[{label:d==="es"?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Ma\xF1ana":"Tomorrow",date:ne,display:ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Este fin de semana":"This weekend",date:R,display:d==="es"?"s\xE1b.":"sat."},{label:d==="es"?"Pr\xF3xima semana":"Next week",date:W,display:d==="es"?"lun.":"mon."},{label:d==="es"?"2 semanas":"2 weeks",date:Ne,display:Ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"4 semanas":"4 weeks",date:et,display:et.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((mt,Re)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",g?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Ke(mt.date),re(false);},children:[jsxRuntime.jsx("span",{children:mt.label}),jsxRuntime.jsx("span",{className:y("text-[10px]",g?"text-[#6B7280]":"text-gray-400"),children:mt.display})]},Re))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:y("text-xs font-medium",g?"text-white":"text-gray-900"),children:ce.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>fe(new Date),className:y("px-1.5 py-0.5 rounded text-[10px] transition-colors",g?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:d==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>fe(new Date(ce.getFullYear(),ce.getMonth()-1)),className:y("p-0.5 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>fe(new Date(ce.getFullYear(),ce.getMonth()+1)),className:y("p-0.5 rounded",g?"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:(d==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsxRuntime.jsx("div",{className:y("w-6 h-6 flex items-center justify-center text-[10px]",g?"text-[#6B7280]":"text-gray-400"),children:Y},Y))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=ce.getFullYear(),ne=ce.getMonth(),R=new Date(Y,ne,1).getDay(),W=new Date(Y,ne+1,0).getDate(),Ne=new Date(Y,ne,0).getDate(),et=new Date,$e=[];for(let Re=R-1;Re>=0;Re--)$e.push({dayNum:Ne-Re,isCurrentMonth:false,date:new Date(Y,ne-1,Ne-Re)});for(let Re=1;Re<=W;Re++)$e.push({dayNum:Re,isCurrentMonth:true,date:new Date(Y,ne,Re)});let mt=42-$e.length;for(let Re=1;Re<=mt;Re++)$e.push({dayNum:Re,isCurrentMonth:false,date:new Date(Y,ne+1,Re)});return $e.map((Re,ut)=>{let $t=Re.date.toDateString()===et.toDateString(),se=(qe||A.date).toDateString()===Re.date.toDateString();return jsxRuntime.jsx("button",{className:y("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!Re.isCurrentMonth&&(g?"text-[#4B5563]":"text-gray-300"),Re.isCurrentMonth&&(g?"text-white":"text-gray-900"),$t&&"ring-1 ring-[#3B82F6]",se&&"bg-[#7C3AED] text-white",!se&&(g?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Ke(Re.date),re(false);},children:Re.dayNum},ut)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Y=>{Y.stopPropagation(),_e(!Me),ae(false);},className:y("p-1 rounded transition-colors",Be?"text-[#7C3AED] bg-[#7C3AED]/20":g?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Be?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(Y=>Y.id===Be)?.color||"#7C3AED"},children:t.availableUsers?.find(Y=>Y.id===Be)?.initials||t.availableUsers?.find(Y=>Y.id===Be)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Me&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{xe(null),_e(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",!Be&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:y("w-5 h-5 rounded-full flex items-center justify-center",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:g?"text-[#9CA3AF]":"text-gray-500",children:d==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Y=>jsxRuntime.jsxs("button",{onClick:()=>{xe(Y.id),_e(false);},className:y("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",Be===Y.id&&(g?"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:Y.color||"#7C3AED"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:Y.name})]},Y.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:y("px-3 py-2 text-xs",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(ee.trim()){let Y=t.availableUsers?.find(R=>R.id===Be),ne=qe||A.date;a.onTaskCreate?.({name:ee.trim(),startDate:ne,endDate:ne,priority:De,assignees:Y?[Y]:void 0}),H(""),Ee(void 0),xe(null),Ke(null),Q(null);}},disabled:!ee.trim(),className:y("px-2.5 py-1 rounded text-xs font-medium transition-colors",ee.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":g?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:d==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:y("text-sm font-medium",A.isToday?"text-[#3B82F6]":A.isCurrentMonth?g?"text-white":"text-gray-900":g?"text-[#6B7280]":"text-gray-400"),children:A.date.getDate()})]})]},ue)})})]})}),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:()=>x(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:y("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",g?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxRuntime.jsxs("div",{className:y("px-6 py-3 border-b flex items-center gap-3",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Circle,{className:y("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxRuntime.jsxs("span",{className:y("text-xs px-2 py-0.5 rounded",g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[d==="es"?"Tarea":"Task"," \u2228"]}),jsxRuntime.jsx("span",{className:y("text-xs font-mono",g?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",g?"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:y("p-1.5 rounded transition-colors",g?"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:y("p-1.5 rounded transition-colors",g?"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:()=>x(null),className:y("p-1.5 rounded transition-colors",g?"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 A=f.progress===100?0:100,_={...f,progress:A,status:A===100?"completed":"todo"};x(_),a.onTaskUpdate?.(_);},className:y("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":g?"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:y("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":g?"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:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Estado":"Status"}),jsxRuntime.jsx("button",{onClick:()=>{he(),de(!K);},className:y("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":g?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?d==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?d==="es"?"EN PROGRESO":"IN PROGRESS":d==="es"?"POR HACER":"TO DO"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:K&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>de(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:d==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:d==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:d==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(A=>jsxRuntime.jsxs("button",{onClick:()=>Ue(A.id),className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",(f.status===A.id||A.id==="completed"&&f.progress===100||A.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||A.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",A.id==="completed"?"bg-green-500":A.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.User,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Asignados":"Assignees"}),jsxRuntime.jsxs("button",{onClick:()=>{de(false),Te(false),k(null),z(!Ce);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[f.assignees&&f.assignees.length>0?jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((A,ue)=>jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ue)),f.assignees.length>3&&jsxRuntime.jsxs("span",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsxRuntime.jsx("span",{className:y("text-sm",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"Agregar":"Add"}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:y("w-3 h-3",g?"text-[#6B7280]":"text-gray-400")})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ce&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>z(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:t.availableUsers&&t.availableUsers.length>0?t.availableUsers.map(A=>{let ue=f.assignees?.some(_=>_.name===A.name);return jsxRuntime.jsxs("button",{onClick:()=>{let _=f.assignees||[],Z;ue?Z=_.filter(ve=>ve.name!==A.name):Z=[..._,{name:A.name,avatar:A.avatar,initials:A.initials||A.name.slice(0,2).toUpperCase(),color:A.color||"#8B5CF6"}],Oe("assignees",Z);},className:y("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5":"hover:bg-gray-50",ue&&(g?"bg-white/5":"bg-gray-50")),children:[A.avatar?jsxRuntime.jsx("img",{src:A.avatar,alt:A.name,className:"w-6 h-6 rounded-full object-cover"}):jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:y("flex-1 text-left",g?"text-white":"text-gray-900"),children:A.name}),ue&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},A.id||A.name)}):jsxRuntime.jsx("div",{className:y("px-3 py-4 text-sm text-center",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.CalendarDays,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Fechas":"Dates"}),jsxRuntime.jsxs("button",{onClick:()=>{k(I?null:"start"),N(f.startDate||new Date);},className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",g?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(d==="es"?"Inicio":"Start"),jsxRuntime.jsx("span",{className:y("mx-1",g?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(d==="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:A=>{A.stopPropagation();}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:y("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:y("w-44 py-2 border-r",g?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ue=new Date(A);ue.setDate(A.getDate()+1);let _=new Date(A);_.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Z=new Date(A);Z.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let ve=new Date(A);ve.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Y=new Date(A);Y.setDate(A.getDate()+14);let ne=new Date(A);return ne.setDate(A.getDate()+28),[{label:d==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Ma\xF1ana":"Tomorrow",date:ue,display:ue.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:d==="es"?"Este fin de semana":"This weekend",date:_,display:d==="es"?"s\xE1b.":"sat."},{label:d==="es"?"Pr\xF3xima semana":"Next week",date:Z,display:d==="es"?"lun.":"mon."},{label:d==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ve,display:ve.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:d==="es"?"4 semanas":"4 weeks",date:ne,display:ne.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((W,Ne)=>jsxRuntime.jsxs("button",{className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(I==="start"){let et=f.endDate&&W.date>f.endDate?W.date:f.endDate;qt(W.date,et),k("end");}else {let et=f.startDate&&W.date<f.startDate?W.date:f.startDate;qt(et,W.date),k(null);}},children:[jsxRuntime.jsx("span",{children:W.label}),jsxRuntime.jsx("span",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:W.display})]},Ne))})(),jsxRuntime.jsx("div",{className:y("border-t mt-2 pt-2",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{qt(void 0,void 0),k(null);},className:y("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",g?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsxRuntime.jsx("span",{children:d==="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:y("text-xs mb-3 px-2 py-1 rounded",g?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:I==="start"?d==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":d==="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:y("font-medium",g?"text-white":"text-gray-900"),children:L.toLocaleDateString(d==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>N(new Date),className:y("p-1 rounded text-sm transition-colors",g?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:d==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(L.getFullYear(),L.getMonth()-1)),className:y("p-1 rounded",g?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsx("button",{onClick:()=>N(new Date(L.getFullYear(),L.getMonth()+1)),className:y("p-1 rounded",g?"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:(d==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsxRuntime.jsx("div",{className:y("w-8 h-8 flex items-center justify-center text-xs",g?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=L.getFullYear(),ue=L.getMonth(),_=new Date(A,ue,1).getDay(),Z=new Date(A,ue+1,0).getDate(),ve=new Date(A,ue,0).getDate(),Y=new Date,ne=[];for(let W=_-1;W>=0;W--)ne.push({day:ve-W,isCurrentMonth:false,date:new Date(A,ue-1,ve-W)});for(let W=1;W<=Z;W++)ne.push({day:W,isCurrentMonth:true,date:new Date(A,ue,W)});let R=42-ne.length;for(let W=1;W<=R;W++)ne.push({day:W,isCurrentMonth:false,date:new Date(A,ue+1,W)});return ne.map((W,Ne)=>{let et=W.date.toDateString()===Y.toDateString(),$e=f.startDate?.toDateString()===W.date.toDateString(),mt=f.endDate?.toDateString()===W.date.toDateString(),Re=$e||mt,ut=f.startDate&&f.endDate&&W.date>=f.startDate&&W.date<=f.endDate;return jsxRuntime.jsx("button",{className:y("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!W.isCurrentMonth&&(g?"text-[#4B5563]":"text-gray-300"),W.isCurrentMonth&&(g?"text-white":"text-gray-900"),et&&"ring-2 ring-[#3B82F6]",$e&&"bg-[#3B82F6] text-white",mt&&!$e&&"bg-[#7C3AED] text-white",ut&&!Re&&(g?"bg-[#7C3AED]/20":"bg-purple-100"),!Re&&(g?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let $t=new Date(W.date);if(I==="start"){let se=f.endDate&&$t>f.endDate?$t:f.endDate;qt($t,se),k("end");}else {let se=f.startDate&&$t<f.startDate?$t:f.startDate;qt(se,$t),k(null);}},children:W.day},Ne)})})()})]})]})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 relative",children:[jsxRuntime.jsx(lucideReact.Flag,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Prioridad":"Priority"}),jsxRuntime.jsx("button",{onClick:()=>{he(),Te(!ge);},className:y("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":g?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?d==="es"?"Urgente":"Urgent":f.priority==="medium"?d==="es"?"Media":"Medium":d==="es"?"Baja":"Low":d==="es"?"Sin prioridad":"No priority"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:y("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:d==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:d==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:d==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:d==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:d==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxRuntime.jsxs("button",{onClick:()=>{Oe("priority",A.id),Te(false);},className:y("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",g?"hover:bg-white/5":"hover:bg-gray-50",f.priority===A.id&&(g?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:y("w-2 h-2 rounded-full",A.color)}),jsxRuntime.jsx("span",{className:g?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Clock,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Duraci\xF3n":"Duration"}),jsxRuntime.jsx("span",{className:y("text-sm",g?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${d==="es"?"d\xEDas":"days"}`:d==="es"?"Sin definir":"Not set"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded-full border-2",g?"border-[#6B7280]":"border-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Progreso":"Progress"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B?jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:A=>{let ue=parseInt(A.target.value),_=f.status;ue===100?_="completed":ue>0?_="in-progress":_="todo";let Z={...f,progress:ue,status:_};x(Z),a.onTaskUpdate?.(Z);},onBlur:()=>$(false),className:y("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",g?"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:()=>$(true),className:y("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:y("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxRuntime.jsxs("span",{className:y("text-sm font-medium min-w-[40px]",g?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Tag,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Etiquetas":"Tags"}),jsxRuntime.jsx(ja,{selectedTags:f.tags||[],availableTags:m,onChange:A=>{Oe("tags",A);},onCreateTag:l,theme:b})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(lucideReact.Link2,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:y("text-sm w-24",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Relaciones":"Relations"}),jsxRuntime.jsx("span",{className:y("text-sm",g?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${d==="es"?"dependencias":"dependencies"}`:d==="es"?"Vac\xEDo":"Empty"})]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsxRuntime.jsx(lucideReact.FileText,{className:y("w-4 h-4",g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",g?"text-white":"text-gray-900"),children:d==="es"?"Descripci\xF3n":"Description"})]}),jsxRuntime.jsx("textarea",{value:f.description||"",onChange:A=>Oe("description",A.target.value),placeholder:d==="es"?"Agregar descripci\xF3n...":"Add description...",className:y("w-full min-h-[100px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors",g?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")}),jsxRuntime.jsxs("button",{className:y("flex items-center gap-2 text-sm mt-2 transition-colors",g?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsxRuntime.jsx(lucideReact.Sparkles,{className:"w-4 h-4"}),d==="es"?"Escribe con IA":"Write with AI"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:d==="es"?"Campos personalizados":"Custom fields"}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:d==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(A=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:y("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",A.progress===100?"bg-green-500 border-green-500":g?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:y("text-sm",A.progress===100?"line-through text-[#6B7280]":g?"text-white":"text-gray-900"),children:A.name})]},A.id))}),jsxRuntime.jsxs("button",{className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Add Tarea":"Add Task"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("h3",{className:y("text-sm font-semibold",g?"text-white":"text-gray-900"),children:d==="es"?"Listas de control":"Checklists"}),jsxRuntime.jsx("button",{className:y("p-1 rounded transition-colors",g?"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:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",g?"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"}),d==="es"?"Crear lista de control":"Create checklist"]})]}),jsxRuntime.jsxs("div",{className:y("mt-6 pt-4 border-t",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsxs("h3",{className:y("text-sm font-semibold mb-3",g?"text-white":"text-gray-900"),children:[d==="es"?"Adjuntos":"Attachments",Qe.length>0&&jsxRuntime.jsxs("span",{className:y("ml-2 text-xs font-normal",g?"text-[#6B7280]":"text-gray-400"),children:["(",Qe.length,")"]})]}),Qe.length>0&&jsxRuntime.jsx("div",{className:"space-y-2 mb-4",children:Qe.map(A=>{let ue=st(A.type),_=A.type.startsWith("image/");return jsxRuntime.jsxs("div",{className:y("flex items-center gap-3 p-2 rounded-lg group transition-colors",g?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[_&&A.thumbnailUrl?jsxRuntime.jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsxRuntime.jsx("div",{className:y("w-10 h-10 rounded flex items-center justify-center",g?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(ue,{className:y("w-5 h-5",g?"text-[#9CA3AF]":"text-gray-500")})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:y("text-sm font-medium truncate block hover:underline",g?"text-white":"text-gray-900"),children:A.name}),jsxRuntime.jsx("p",{className:y("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:wt(A.size)})]}),a.onDeleteAttachment&&jsxRuntime.jsx("button",{onClick:()=>a.onDeleteAttachment?.(A.id),className:y("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",g?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:d==="es"?"Eliminar":"Delete",children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxRuntime.jsxs("div",{onDragOver:tt,onDragLeave:Xe,onDrop:Ge,className:y("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ae?g?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":g?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",kt&&"pointer-events-none opacity-50"),children:[jsxRuntime.jsx("input",{type:"file",multiple:true,onChange:Fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!a.onUploadAttachments||kt}),kt?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsxRuntime.jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:d==="es"?"Subiendo...":"Uploading..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Upload,{className:y("w-6 h-6 mx-auto mb-2",Ae?"text-blue-500":g?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:y("text-sm",g?"text-[#9CA3AF]":"text-gray-500"),children:Ae?d==="es"?"Suelta los archivos aqu\xED":"Drop files here":d==="es"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Suelta tus archivos aqu\xED o ",jsxRuntime.jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Drop your files here or ",jsxRuntime.jsx("span",{className:"underline",children:"click to upload"})]})}),!a.onUploadAttachments&&jsxRuntime.jsx("p",{className:y("text-xs mt-1",g?"text-[#6B7280]":"text-gray-400"),children:d==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:y("w-[280px] border-l flex flex-col",g?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsx("div",{className:y("px-4 py-3 border-b flex items-center justify-between",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:y("font-medium",g?"text-white":"text-gray-900"),children:d==="es"?"Actividad":"Activity"})}),jsxRuntime.jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxRuntime.jsxs("div",{className:y("text-sm text-center py-8",g?"text-[#6B7280]":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),d==="es"?"Sin actividad reciente":"No recent activity"]})}),jsxRuntime.jsx("div",{className:y("p-3 border-t",g?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("div",{className:y("flex items-center gap-2 px-3 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:jsxRuntime.jsx("input",{type:"text",placeholder:d==="es"?"Escribe un comentario...":"Write a comment...",className:y("flex-1 bg-transparent text-sm outline-none",g?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>D(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:y("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",g?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:y("px-4 py-3 border-b flex items-center justify-between",g?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:y("font-medium",g?"text-white":"text-gray-900"),children:T.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>D(null),className:y("p-1 rounded",g?"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:T.events.map(A=>jsxRuntime.jsxs("button",{onClick:()=>{D(null),x(A.task);},className:y("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(Ic,{task:A.task}),jsxRuntime.jsx("span",{className:y("text-sm truncate flex-1",g?"text-white":"text-gray-900"),children:A.title}),A.task.priority==="high"||A.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},A.id))})]})]})})]})}var Mi={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"},Ai={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"},Ii={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"},zn={dark:Mi,light:Ai,neutral:Ii};function Bc(e){return zn[e]||zn.dark}function rh({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:n,onDeleteStack:s,className:p}){let[m,l]=react.useState(false),u=react.useMemo(()=>t.filter(i=>e.cardIds.includes(i.id)),[t,e.cardIds]),c=react.useMemo(()=>{let i=u.length,w=new Set(u.flatMap(h=>h.assignedUserIds||[])).size,g=u.map(h=>h.priority).filter(Boolean),b=new Set(u.flatMap(h=>h.labels||[])).size;return {totalCards:i,uniqueAssignees:w,priorities:g,labels:b}},[u]),d=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:y("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:d,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:y("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:c.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:i=>{i.stopPropagation(),s?.(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:[c.uniqueAssignees," assignees"]})]}),c.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:[c.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:u.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:u.map(i=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(i),children:a(i)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(i),children:[jsxRuntime.jsx("h4",{children:i.title}),i.description&&jsxRuntime.jsxs("p",{children:[i.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:w=>{w.stopPropagation(),n?.(e.id,i.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"})]})})]},i.id))})})]})}var Oc={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Bo(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 Ro(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 zc(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 $c({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:n,config:s,className:p}){let m=react.useMemo(()=>({...Oc,...s}),[s]),[l,u]=react.useState(new Set),c=react.useRef(null),d=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(f=>{let x=f.timestamp.toISOString().split("T")[0],T=v.get(x);T?T.push(f):v.set(x,[f]);}),Array.from(v.entries()).sort((f,x)=>x[0].localeCompare(f[0])).map(([f,x])=>({date:new Date(f),events:x.sort((T,D)=>D.timestamp.getTime()-T.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:i,uniqueTypes:w}=react.useMemo(()=>{let v=new Set,f=new Set;return e.forEach(x=>{v.add(x.userId),f.add(x.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(f)}},[e]),g=v=>{u(f=>{let x=new Set(f);return x.has(v)?x.delete(v):x.add(v),x});},b=v=>{let x=new Date().getTime()-v.getTime(),T=Math.floor(x/6e4),D=Math.floor(x/36e5),I=Math.floor(x/864e5);return T<1?"just now":T<60?`${T}m ago`:D<24?`${D}h ago`:I<7?`${I}d ago`:v.toLocaleDateString()},h=react.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return react.useEffect(()=>{if(n&&c.current){let v=c.current.querySelector(`[data-event-id="${n}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[n]),e.length===0?jsxRuntime.jsxs("div",{className:y("history-timeline-empty",p),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:y("history-timeline",m.compact&&"compact",p),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:v=>{let f=v.target.value;a({...t,types:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),w.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Ro(v)," ",v.replace("_"," ")]},v))]}),i.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let f=v.target.value;a({...t,users:f?[f]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),i.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>a({...t,searchTerm:v.target.value})})]}),h>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:c,children:d.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((f,x)=>{let T=l.has(f.id),D=n===f.id,I=zc(f.type);return jsxRuntime.jsxs("div",{"data-event-id":f.id,className:y("history-timeline-event",T&&"expanded",D&&"selected"),onClick:()=>o?.(f),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Ro(f.type)})}),x<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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&&f.userAvatar&&jsxRuntime.jsx("img",{src:f.userAvatar,alt:f.userName||f.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:f.userName||f.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Bo(f)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?b(f.timestamp):f.timestamp.toLocaleString()})]}),Object.keys(f.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),g(f.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(f.changes).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),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)})]})]},k)),f.metadata&&Object.keys(f.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(f.metadata).map(([k,L])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},f.id)})})]},v.date?.toISOString()||"all"))})]})}function Wc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:n,onNext:s,onGoToEvent:p,onSpeedChange:m,className:l}){let u=[.5,1,1.5,2,3],c=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:y("history-replay-empty",l),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:y("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:c&&Ro(c.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:c&&Bo(c)}),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:c&&c.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:i=>p(parseInt(i.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((i,w)=>jsxRuntime.jsx("div",{className:y("history-replay-progress-marker",w===e.currentIndex&&"active"),style:{left:`${w/(e.totalEvents-1)*100}%`},onClick:()=>p(w),title:Bo(i)},i.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:s,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:u.map(i=>jsxRuntime.jsxs("button",{className:y("history-replay-speed-btn",e.speed===i&&"active"),onClick:()=>m(i),children:[i,"x"]},i))})]}),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:c&&c.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(i=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:i},i))})]})]})]})]}):jsxRuntime.jsxs("div",{className:y("history-replay-start",l),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 Fi(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 Li(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 Hc(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 Gc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function dh(e,t,a,r,o,n=100){let s=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})),p=new Map(s.map(m=>[m.id,m]));for(let m=0;m<n;m++){let l=1-m/n;s.forEach(u=>{let c=a/2,d=r/2;u.vx+=(c-u.x)*o.centerForce*l,u.vy+=(d-u.y)*o.centerForce*l,s.forEach(i=>{if(u.id===i.id)return;let w=u.x-i.x,g=u.y-i.y,b=Math.sqrt(w*w+g*g)||1,h=o.chargeStrength*l/(b*b);u.vx+=w/b*h,u.vy+=g/b*h;});}),t.forEach(u=>{let c=p.get(typeof u.source=="string"?u.source:u.source.id),d=p.get(typeof u.target=="string"?u.target:u.target.id);if(!c||!d)return;let i=d.x-c.x,w=d.y-c.y,g=Math.sqrt(i*i+w*w)||1,b=(g-o.linkDistance)/g*o.forceStrength*l;c.vx+=i*b,c.vy+=w*b,d.vx-=i*b,d.vy-=w*b;}),s.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return s}function _c({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:n,stats:s,onInteraction:p,className:m}){let l=react.useRef(null),[u,c]=react.useState([]),[d,i]=react.useState(null),[w,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(1),[x,T]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let F=dh(e,t,a.width,a.height,a,150);c(F);},[e,t,a]);let D=react.useCallback((F,J)=>{a.enableDragging&&(J.stopPropagation(),i(F));},[a.enableDragging]),I=react.useCallback(F=>{if(!d||!l.current)return;let K=l.current.getBoundingClientRect(),de=(F.clientX-K.left-x.x)/v,ge=(F.clientY-K.top-x.y)/v;c(Te=>Te.map(Ce=>Ce.id===d?{...Ce,x:de,y:ge,fx:de,fy:ge}:Ce));},[d,v,x]),k=react.useCallback(()=>{i(null);},[]),L=react.useCallback((F,J)=>{J.stopPropagation(),p?.({type:"node-click",node:F,position:{x:J.clientX,y:J.clientY}});},[p]),N=react.useCallback((F,J)=>{J.stopPropagation(),p?.({type:"edge-click",edge:F,position:{x:J.clientX,y:J.clientY}});},[p]),C=react.useCallback(F=>{let J=u.find(K=>K.id===F);return J?{x:J.x,y:J.y}:{x:0,y:0}},[u]),G=react.useCallback(F=>{if(F.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return F.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let J=F.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return F.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:y("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:y("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:s.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:s.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),n&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.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:()=>f(F=>Math.min(F+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>f(F=>Math.max(F-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{f(1),T({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(F=>F.type))).map(F=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Fi(F)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Hc(F)," ",Li(F)]})]},F))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:k,onMouseLeave:k,children:[jsxRuntime.jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(F=>{let J=C(typeof F.source=="string"?F.source:F.source.id),K=C(typeof F.target=="string"?F.target:F.target.id),de=Gc(F.type),ge=b===F.id,Te=F.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-edge",ge&&"hovered",Te&&"critical"),onMouseEnter:()=>h(F.id),onMouseLeave:()=>h(null),onClick:Ce=>N(F,Ce),children:[jsxRuntime.jsx("line",{x1:J.x,y1:J.y,x2:K.x,y2:K.y,stroke:Fi(F.type),strokeWidth:Te?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ge?1:.6,markerEnd:de?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ge&&jsxRuntime.jsx("text",{x:(J.x+K.x)/2,y:(J.y+K.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Li(F.type)})]},F.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(F=>{let J=w===F.id,K=F.onCriticalPath;return jsxRuntime.jsxs("g",{className:y("relationships-graph-node",J&&"hovered",K&&"critical"),transform:`translate(${F.x}, ${F.y})`,onMouseDown:de=>D(F.id,de),onMouseEnter:()=>g(F.id),onMouseLeave:()=>g(null),onClick:de=>L(F,de),children:[jsxRuntime.jsx("circle",{r:K?a.nodeSize*1.2:a.nodeSize,fill:G(F),stroke:K?"#fbbf24":"#ffffff",strokeWidth:K?3:2,opacity:J?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:F.card.title.length>20?F.card.title.substring(0,20)+"...":F.card.title})]},F.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 Kc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[n,s]=react.useState(""),[p,m]=react.useState(false),[l,u]=react.useState(null),[c,d]=react.useState(null),i=react.useRef(null),w=p||o;react.useEffect(()=>{e&&i.current&&i.current.focus();},[e]),react.useEffect(()=>{let v=f=>{f.key==="Escape"&&!w&&g();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,w]);let g=()=>{w||(s(""),u(null),d(null),t());},b=async()=>{if(!(!n.trim()||w)){m(true),u(null),d(null);try{let v=await r(n.trim());d(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{m(false);}}},h=()=>{c&&(a(c),g());};return e?jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:g}),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:v=>v.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:g,disabled:w,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:c?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!"})]}),c.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:c.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",c.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:c.columns.map((v,f)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},f))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",c.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[c.cards.slice(0,10).map((v,f)=>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:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},f)),c.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",c.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:i,value:n,onChange:v=>s(v.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:w}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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((v,f)=>jsxRuntime.jsx("button",{onClick:()=>s(v),disabled:w,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:v},f))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:w&&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:g,disabled:w,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"}),c?jsxRuntime.jsx("button",{onClick:h,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:b,disabled:!n.trim()||w,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:w?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Bi={"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 ph={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},mh={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 uh(e,t,a){let r=Bi[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,n=a/1e3*r.costPer1kOutput;return o+n}function Oo(e){return `$${e.toFixed(4)}`}var Ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=uh(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(c=>c.timestamp>=t.start&&c.timestamp<=t.end));let r=a.length,o=a.reduce((c,d)=>c+d.cost,0),n=a.reduce((c,d)=>c+d.inputTokens,0),s=a.reduce((c,d)=>c+d.outputTokens,0),p=a.filter(c=>c.success),m=a.reduce((c,d)=>c+d.duration,0),l={},u={};return a.forEach(c=>{l[c.feature]=(l[c.feature]||0)+1,u[c.feature]=(u[c.feature]||0)+c.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:n,totalOutputTokens:s,operationsByFeature:l,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.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],n=new Date,s=new Date;a==="month"?s.setMonth(n.getMonth()-1):s.setDate(n.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=s).length,m=Math.max(0,o-p),l=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:l,isExceeded:p>=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)}},Ur=new Ri;function Xc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(Ur.getStats()),[n,s]=react.useState(Ur.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Ur.getStats()),s(Ur.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Ur.getRecentOperations(5);return jsxRuntime.jsxs(it,{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:[n.used," / ",n.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,n.percentUsed)}%`,background:n.percentUsed>90?"#EF4444":n.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[n.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:Oo(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,l])=>{let u=r.costsByFeature[m]||0,c=r.totalOperations>0?l/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:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Oo(u)})]})]}),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:`${c}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.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:p.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:Oo(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 Qc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:n}){let[s,p]=react.useState(""),[m,l]=react.useState(""),[u,c]=react.useState(""),[d,i]=react.useState(false),[w,g]=react.useState(null),[b,h]=react.useState(null),[v,f]=react.useState(null),x=react.useRef(null),T=d||o;react.useEffect(()=>{e&&x.current&&x.current.focus();},[e]),react.useEffect(()=>{let N=C=>{C.key==="Escape"&&!T&&D();};if(e)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[e,T]);let D=()=>{T||(p(""),l(""),c(""),g(null),h(null),f(null),t());},I=async()=>{if(!(!s.trim()||T)){i(true),g(null),h(null),f(null);try{let N=await r({prompt:s.trim(),projectName:n||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});h(N.tasks.tasks),f({from_cache:N.from_cache,tokens_used:N.tokens_used,mock_mode:N.mock_mode,similarity:N.similarity,tokens_saved:N.tokens_saved});}catch(N){g(N instanceof Error?N.message:"Failed to generate tasks");}finally{i(false);}}},k=()=>{b&&(a(b),D());};if(!e)return null;let L=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),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:N=>N.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:D,disabled:T,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:b?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:[v?.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"}),v?.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:[v?.tokens_used||0," tokens"]}),v?.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:[v.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:[b.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((N,C)=>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:["#",C+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:N.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"})]}),N.start," \u2192 ",N.end]}),jsxRuntime.jsxs("span",{children:[N.duration," days"]}),N.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",N.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${N.priority==="high"?"bg-red-500/20 text-red-400":N.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:N.priority})]})},N.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:x,value:s,onChange:N=>p(N.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:T}),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:N=>l(N.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:T})]}),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:u,onChange:N=>c(N.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:T})]})]}),w&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:w}),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((N,C)=>jsxRuntime.jsx("button",{onClick:()=>p(N),disabled:T,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:N},C))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:T&&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:D,disabled:T,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"}),b?jsxRuntime.jsx("button",{onClick:k,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:I,disabled:!s.trim()||T,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:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wn({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(b=>{t&&Ko(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,v,f)=>{console.warn(`Retry attempt ${v} after ${f}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),n=react.useCallback(async(b,h,v)=>{r(f=>{let x=f.cards.find(N=>N.id===b);if(!x)return f;let T=x.columnId,D={...x,columnId:h,position:v},I=f.cards.map(N=>N.id===b?D:N),k=f.columns.map(N=>{if(N.id===T)return {...N,cardIds:N.cardIds.filter(C=>C!==b)};if(N.id===h){let C=I.filter(G=>G.columnId===h).sort((G,F)=>G.position-F.position);return {...N,cardIds:C.map(G=>G.id)}}return N}),L={...f,cards:I,columns:k};return o(L),L});},[o]),s=react.useCallback(async(b,h)=>{r(v=>{let f=v.cards.map(T=>T.id===b?{...T,...h}:T),x={...v,cards:f};return o(x),x});},[o]),p=react.useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let f={...b,id:h},x=v.columns.map(D=>D.id===b.columnId?{...D,cardIds:[...D.cardIds,h]}:D),T={...v,cards:[...v.cards,f],columns:x};return o(T),T});},[o]),m=react.useCallback(async b=>{r(h=>{let v=h.cards.find(D=>D.id===b);if(!v)return h;let f=h.cards.filter(D=>D.id!==b),x=h.columns.map(D=>D.id===v.columnId?{...D,cardIds:D.cardIds.filter(I=>I!==b)}:D),T={...h,cards:f,columns:x};return o(T),T});},[o]),l=react.useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(v=>{let f={...b,id:h,cardIds:[]},x={...v,columns:[...v.columns,f]};return o(x),x});},[o]),u=react.useCallback(async(b,h)=>{r(v=>{let f=v.columns.map(T=>T.id===b?{...T,...h}:T),x={...v,columns:f};return o(x),x});},[o]),c=react.useCallback(async b=>{r(h=>{let v=h.cards.filter(T=>T.columnId!==b),f=h.columns.filter(T=>T.id!==b),x={...h,cards:v,columns:f};return o(x),x});},[o]),d=react.useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(b),h},[p]),i=react.useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),w=react.useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return o(h),h});},[o]);return {board:a,callbacks:{onCardMove:n,onCardUpdate:s,onCardCreate:p,onCardDelete:m,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:c},setBoard:r,helpers:{addCard:d,addColumn:i,deleteCard:m,deleteColumn:c,clearBoard:w}}}function tp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:n}=Wn({initialBoard:e,onPersist:a}),s=react.useMemo(()=>({addCard:(m,l,u={})=>{n.addCard({title:l,columnId:m,position:r.cards.filter(c=>c.columnId===m).length,...u});},addColumn:(m,l)=>{let u=r.columns.length>0?Math.max(...r.columns.map(c=>c.position)):0;n.addColumn({title:m,position:l??u+1e3});},reset:n.clearBoard}),[r.cards,r.columns,n]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:s}}var zo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},rp={by:"none",order:"asc"};function op({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...zo,...e}),[n,s]=react.useState({...rp,...t}),p=react.useCallback(g=>{o(b=>({...b,...g}));},[]),m=react.useCallback(g=>{s(b=>({...b,...g}));},[]),l=react.useCallback(()=>{o(zo),s(rp);},[]),u=react.useCallback(()=>{a&&o({...zo,assignees:[a]});},[a]),c=react.useCallback(()=>{o({...zo,dateFilter:"overdue"});},[]),d=react.useCallback(()=>{o({...zo,priorities:["HIGH","URGENT"]});},[]),i=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||n.by!=="none",[r,n]),w=react.useCallback(g=>{let b=[...g];if(r.search){let h=r.search.toLowerCase();b=b.filter(v=>v.title.toLowerCase().includes(h)||v.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,v=h.getFullYear(),f=String(h.getMonth()+1).padStart(2,"0"),x=String(h.getDate()).padStart(2,"0"),T=`${v}-${f}-${x}`;b=b.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let I=D.endDate||D.dueDate;if(!I)return false;let k;if(typeof I=="string")k=I.split("T")[0]||I;else {let L=I.getUTCFullYear(),N=String(I.getUTCMonth()+1).padStart(2,"0"),C=String(I.getUTCDate()).padStart(2,"0");k=`${L}-${N}-${C}`;}switch(r.dateFilter){case "overdue":return k<T;case "today":return k===T;case "this-week":let L=new Date(T+"T00:00:00"),N=new Date(k+"T00:00:00"),C=new Date(L);return C.setDate(C.getDate()+7),N>=L&&N<=C;case "custom":if(r.dateRange){let G=typeof I=="string"?new Date(I):I;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(f=>r.assignees.includes(f)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(v=>r.labels.includes(v)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),n.by!=="none"&&b.sort((h,v)=>{let f=0;switch(n.by){case "created":let x=h.createdAt?new Date(h.createdAt).getTime():0,T=v.createdAt?new Date(v.createdAt).getTime():0;f=x-T;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=D[h.priority||"LOW"],k=D[v.priority||"LOW"];f=I-k;break;case "dueDate":let L=h.endDate||h.dueDate,N=v.endDate||v.dueDate;if(!L)return 1;if(!N)return -1;let C=typeof L=="string"?new Date(L).getTime():L.getTime(),G=typeof N=="string"?new Date(N).getTime():N.getTime();f=C-G;break;case "title":f=h.title.localeCompare(v.title);break;case "estimate":let F=h.estimatedTime||0,J=v.estimatedTime||0;f=F-J;break;default:f=0;}return n.order==="asc"?f:-f}),b},[r,n]);return {filters:r,sort:n,setFilters:p,setSort:m,resetFilters:l,filterMyTasks:u,filterOverdue:c,filterHighPriority:d,applyFilters:w,hasActiveFilters:i}}var sp,ip;if(typeof window<"u")try{let e=_o("ai");sp=e.generateObject,ip=e.generateText;}catch{}function lp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),n=!!(sp&&ip&&e.apiKey),s=react.useCallback(async c=>{if(!n)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:",c),{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: ${c}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let i=d instanceof Error?d:new Error("Failed to generate plan");throw o(i),i}finally{a(false);}},[n]),p=react.useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",c.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let i=d instanceof Error?d:new Error("Failed to suggest assignee");throw o(i),i}finally{a(false);}},[n]),m=react.useCallback(async c=>{if(!n)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(d){let i=d instanceof Error?d:new Error("Failed to predict risks");throw o(i),i}finally{a(false);}},[n]),l=react.useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",c.title),[{title:`Subtask 1 for: ${c.title}`,position:c.position+.1,columnId:c.columnId},{title:`Subtask 2 for: ${c.title}`,position:c.position+.2,columnId:c.columnId}]}catch(d){let i=d instanceof Error?d:new Error("Failed to generate subtasks");throw o(i),i}finally{a(false);}},[n]),u=react.useCallback(async c=>{if(!n)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",c.title),{hours:8,confidence:.75}}catch(d){let i=d instanceof Error?d:new Error("Failed to estimate effort");throw o(i),i}finally{a(false);}},[n]);return {onGeneratePlan:s,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:n,isLoading:t,error:r}}function zi(){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 dp(e){let{cards:t}=e,[a,r]=zi(),o=react.useCallback(c=>a.selectedCardIds.includes(c),[a.selectedCardIds]),n=react.useCallback((c,d)=>{if(!d){r({selectedCardIds:[c],lastSelectedCardId:c});return}let i=d.ctrlKey||d.metaKey,w=d.shiftKey;if(i)a.selectedCardIds.includes(c)?r({selectedCardIds:a.selectedCardIds.filter(g=>g!==c),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});else if(w&&a.lastSelectedCardId){let g=t.find(h=>h.id===c),b=t.find(h=>h.id===a.lastSelectedCardId);if(g&&b&&g.columnId===b.columnId){let h=t.filter(k=>k.columnId===g.columnId).sort((k,L)=>k.position-L.position),v=h.findIndex(k=>k.id===a.lastSelectedCardId),f=h.findIndex(k=>k.id===c),[x,T]=v<f?[v,f]:[f,v],D=h.slice(x,T+1).map(k=>k.id),I=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:I,lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});}else r({selectedCardIds:[c],lastSelectedCardId:c});},[t,a,r]),s=react.useCallback(c=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==c),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(c=>c.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(c=>{a.selectedCardIds.includes(c)?s(c):r({selectedCardIds:[...a.selectedCardIds,c],lastSelectedCardId:c});},[a,s,r]),u=react.useCallback(()=>t.filter(c=>a.selectedCardIds.includes(c.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:n,deselectCard:s,clearSelection:p,selectAll:m,toggleCard:l,getSelectedCards:u}}var cp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function pp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...cp,...a}),[a]),[n,s]=react.useState([]),p=react.useCallback((g,b,h,v,f)=>{if(b.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:g,cardIds:b,columnId:h,strategy:v,color:f,isExpanded:true,position:n.filter(T=>T.columnId===h).length,createdAt:new Date};s(T=>[...T,x]);},[o.minCardsPerStack,n]),m=react.useCallback(g=>{s(b=>b.filter(h=>h.id!==g));},[]),l=react.useCallback(g=>{s(b=>b.map(h=>h.id===g?{...h,isExpanded:!h.isExpanded}:h));},[]),u=react.useCallback((g,b)=>{s(h=>h.map(v=>v.id===g&&!v.cardIds.includes(b)?{...v,cardIds:[...v.cardIds,b]}:v));},[]),c=react.useCallback((g,b)=>{s(h=>h.map(v=>{if(v.id===g){let f=v.cardIds.filter(x=>x!==b);return f.length<o.minCardsPerStack?null:{...v,cardIds:f}}return v}).filter(v=>v!==null));},[o.minCardsPerStack]),d=react.useCallback(g=>n.filter(b=>b.columnId===g).sort((b,h)=>b.position-h.position),[n]),i=react.useCallback(async g=>{let b=t.filter(T=>T.columnId===g);if(b.length<o.minCardsPerStack*2)return [];let h=[],v=new Map;b.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(T);});}),v.forEach((T,D)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:T.map(I=>I.id),columnId:g,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${D}"`,confidence:.85});});let f=new Map;b.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(D=>{f.has(D)||f.set(D,[]),f.get(D).push(T);});}),f.forEach((T,D)=>{T.length>=o.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:T.map(I=>I.id),columnId:g,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(b.forEach(T=>{T.priority&&(x.has(T.priority)||x.set(T.priority,[]),x.get(T.priority).push(T));}),x.forEach((T,D)=>{if(T.length>=o.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";h.push({stack:{title:`${I} ${D} Priority`,cardIds:T.map(k=>k.id),columnId:g,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of b){let I=(await r.findSimilar(T,b)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(I.length>=o.minCardsPerStack-1){let k=[T.id,...I.map(N=>N.card.id)],L=I.reduce((N,C)=>N+C.similarity,0)/I.length;h.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:k,columnId:g,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:L});}}return h.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,D)=>D.confidence-T.confidence).slice(0,5)},[t,o,r]),w=react.useCallback(g=>{p(g.stack.title,g.stack.cardIds,g.stack.columnId,g.stack.strategy,g.stack.color);},[p]);return react.useEffect(()=>{o.enableAutoStacking&&n.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await i(b),v=h[0];h.length>0&&v&&v.confidence>=.9&&w(v);});},[]),{stacks:n,createStack:p,deleteStack:m,toggleStack:l,addToStack:u,removeFromStack:c,getStacksForColumn:d,getSuggestions:i,applySuggestion:w,config:o}}var mp=react.createContext(null);function up({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let n=new Map,s=new Map;t?.columns?.forEach(m=>{let{Column:l}=_o("@libxai/core");n.set(m.id,new l(m));}),t?.cards?.forEach(m=>{let{Card:l}=_o("@libxai/core");s.set(m.id,new l(m));});let p=null;if(t?.board){let{Board:m}=_o("@libxai/core");p=new m(t.board);}r.current=new core.BoardStore({board:p,columns:n,cards:s});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(n=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(mp.Provider,{value:{store:o},children:e})}function Hn(){let e=react.useContext(mp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Uo(){let e=Hn(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[n,s]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),s(e.getAllCards());}),[e]);let p=react.useCallback(v=>{e.updateBoard(v);},[e]),m=react.useCallback(v=>{e.addColumn(v);},[e]),l=react.useCallback((v,f)=>{e.updateColumn(v,f);},[e]),u=react.useCallback(v=>{e.deleteColumn(v);},[e]),c=react.useCallback(v=>e.getColumn(v),[e]),d=react.useCallback(v=>{e.addCard(v);},[e]),i=react.useCallback((v,f)=>{e.updateCard(v,f);},[e]),w=react.useCallback(v=>{e.deleteCard(v);},[e]),g=react.useCallback((v,f,x)=>{e.moveCard(v,f,x);},[e]),b=react.useCallback(v=>e.getCard(v),[e]),h=react.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:r,cards:n,updateBoard:p,addColumn:m,updateColumn:l,deleteColumn:u,getColumn:c,addCard:d,updateCard:i,deleteCard:w,moveCard:g,getCard:b,getCardsByColumn:h}}function fp(e){let{cards:t}=Uo();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),n=a.description?.toLowerCase().includes(r);if(!o&&!n)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 hp(e="position",t="asc"){let{cards:a}=Uo();return react.useMemo(()=>[...a].sort((o,n)=>{let s=0;switch(e){case "title":s=o.title.localeCompare(n.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,l=n.priority?p[n.priority]:0;s=m-l;break}case "createdAt":s=o.createdAt.getTime()-n.createdAt.getTime();break;case "updatedAt":s=o.updatedAt.getTime()-n.updatedAt.getTime();break;case "position":s=o.position-n.position;break}return t==="asc"?s:-s}),[a,e,t])}var Gn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hl.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 n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];if(typeof s=="function")try{let p=await Promise.resolve(s.apply(n,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,p,{plugin:n.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 n=o[t];typeof n=="function"&&r.push(Promise.resolve(n.apply(o,a)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,s,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Mh=new Gn;function yp({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:n=5,horizontal:s=false,gap:p=0,getItemKey:m}){let l=react.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:n,horizontal:s,gap:p}),c=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},i=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:d,className:o,children:jsxRuntime.jsx("div",{style:i,children:c.map(w=>{let g=e[w.index];if(!g)return null;let b=m?m(g,w.index):w.index,h={position:"absolute",top:s?0:w.start,left:s?w.start:0,width:s?w.size:"100%",height:s?"100%":w.size};return jsxRuntime.jsx("div",{style:h,"data-index":w.index,children:r(g,w.index)},b)})})})}function vp(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 kp({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:n="",overscan:s=3,gap:p=16,getItemKey:m,horizontal:l=true}){let u=react.useRef(null),c=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:s,gap:p}),d=c.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},w={width:`${c.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:i,className:n,children:jsxRuntime.jsx("div",{style:w,children:d.map(g=>{let b=e[g.index];if(!b)return null;let h=m?m(b,g.index):g.index,v={position:"absolute",top:0,left:g.start,width:g.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":g.index,children:o(b,g.index)},h)})})})}function wp(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 Cp(e,t=10){return e>t}var Hi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Gi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},_i={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Vi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ji={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ki={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Yi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},qi={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)"},Xi={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)"},Ji={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Zi={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}},Qi={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}},_n={spacing:Hi,borderRadius:Gi,fontSize:_i,fontWeight:Vi,lineHeight:ji,zIndex:Ki,duration:Yi,easing:qi,shadows:Xi,opacity:Ji,kanban:Zi,gantt:Qi};function Tp(e,t,a){return e[t]??a}function el(e,t="",a={}){for(let[r,o]of Object.entries(e)){let n=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?el(o,n,a):(typeof o=="string"||typeof o=="number")&&(a[n]=o);}return a}function Fh(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function tl(e="asakaa"){let t=el(_n),a=[];for(let[r,o]of Object.entries(t)){let n=`--${e}-${r}`,s=Fh(o);a.push(` ${n}: ${s};`);}return `:root {
|
|
390
390
|
${a.join(`
|
|
391
391
|
`)}
|
|
392
|
-
}`}function Wo(e,t="asakaa"){let a=[],r=el(e);for(let[o,n]of Object.entries(r)){let
|
|
392
|
+
}`}function Wo(e,t="asakaa"){let a=[],r=el(e);for(let[o,n]of Object.entries(r)){let s=`--${t}-color-${o}`;a.push(` ${s}: ${n};`);}return `:root {
|
|
393
393
|
${a.join(`
|
|
394
394
|
`)}
|
|
395
395
|
}`}var Vn={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},al={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},rl={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function ol(e=Vn,t="asakaa"){let a=tl(t),r=Wo(e,t);return `${a}
|
|
396
396
|
|
|
397
|
-
${r}`}function
|
|
397
|
+
${r}`}function Dp(){return `/**
|
|
398
398
|
* ASAKAA Design Tokens
|
|
399
399
|
* Auto-generated from design-tokens.ts
|
|
400
400
|
* Do not edit this file directly
|
|
@@ -415,6 +415,6 @@ ${Wo(rl,"asakaa").split(`
|
|
|
415
415
|
`).slice(1,-1).join(`
|
|
416
416
|
`)}
|
|
417
417
|
}
|
|
418
|
-
`}var
|
|
419
|
-
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=
|
|
418
|
+
`}var Lh=({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 Np({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:n}=ro();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(n).map(([s,p])=>{let m=s,l=m===r;return jsxRuntime.jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":l,title:p.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(Lh,{theme:m})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
|
|
419
|
+
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=Xc;exports.AI_FEATURES=mh;exports.AI_MODELS=Bi;exports.AddCardButton=vs;exports.AddColumnButton=ys;exports.AttachmentUploader=qa;exports.BoardProvider=up;exports.BulkOperationsToolbar=nn;exports.BurnDownChart=As;exports.CalendarBoard=Lc;exports.Card=er;exports.CardDetailModal=Ds;exports.CardDetailModalV2=Es;exports.CardHistoryReplay=Wc;exports.CardHistoryTimeline=$c;exports.CardRelationshipsGraph=_c;exports.CardStack=rh;exports.CardTemplateSelector=zs;exports.CircuitBreaker=Qn;exports.Column=Xr;exports.ColumnManager=mn;exports.CommandPalette=ws;exports.ConfigMenu=Hs;exports.ContextMenu=so;exports.DEFAULT_SHORTCUTS=Do;exports.DEFAULT_TEMPLATES=Os;exports.DateRangePicker=fo;exports.DependenciesSelector=bo;exports.DependencyLine=vn;exports.DistributionCharts=Is;exports.EditableColumnTitle=is;exports.ErrorBoundary=Qr;exports.ExportImportModal=Us;exports.FilterBar=Ws;exports.GANTT_AI_SYSTEM_PROMPT=uc;exports.GanttAIAssistant=Nn;exports.GanttBoard=mc;exports.GanttI18nContext=no;exports.GanttMilestone=kn;exports.GanttToolbar=pn;exports.GenerateGanttTasksDialog=Qc;exports.GeneratePlanModal=Kc;exports.GroupBySelector=Bs;exports.KanbanBoard=fr;exports.KanbanToolbar=hs;exports.KanbanViewAdapter=wo;exports.KeyboardShortcutsHelp=Rs;exports.ListView=Dc;exports.MenuIcons=Et;exports.PluginManager=Gn;exports.PrioritySelector=Er;exports.RATE_LIMITS=ph;exports.SwimlaneBoardView=Fs;exports.TagBadge=ds;exports.TagList=jl;exports.TagPicker=ja;exports.TaskBar=hn;exports.TaskFormModal=Dn;exports.TaskGrid=fn;exports.ThemeModal=js;exports.ThemeProvider=Nd;exports.ThemeSwitcher=Np;exports.Timeline=Cn;exports.UserAssignmentSelector=Mr;exports.VelocityChart=Ms;exports.VirtualGrid=kp;exports.VirtualList=yp;exports.aiUsageTracker=Ur;exports.borderRadius=Gi;exports.calculatePosition=jo;exports.calendarDarkTheme=Mi;exports.calendarEnTranslations=Ci;exports.calendarEsTranslations=Ti;exports.calendarLightTheme=Ai;exports.calendarNeutralTheme=Ii;exports.calendarThemes=zn;exports.calendarTranslations=Fn;exports.cardToGanttTask=En;exports.cardsToGanttTasks=xc;exports.cn=y;exports.createKanbanView=nd;exports.createRetryWrapper=_p;exports.darkTheme=Gs;exports.darkTokenTheme=Vn;exports.defaultTheme=ln;exports.designTokens=_n;exports.duration=Yi;exports.easing=qi;exports.exportTokensToCSS=Dp;exports.findTaskByName=sr;exports.fontSize=_i;exports.fontWeight=Vi;exports.formatCost=Oo;exports.ganttEnTranslations=cn;exports.ganttEsTranslations=Ed;exports.ganttTaskToCardUpdate=vc;exports.ganttThemes=Ve;exports.ganttTokens=Qi;exports.ganttTranslations=Ks;exports.ganttUtils=pe;exports.generateCSSVariables=tl;exports.generateCompleteCSS=ol;exports.generateInitialPositions=Up;exports.generateTasksContext=gc;exports.generateThemeVariables=Wo;exports.getCalendarTheme=Bc;exports.getCalendarTranslations=Lo;exports.getListViewTheme=Nc;exports.getListViewTranslations=vi;exports.getMonthNames=Sc;exports.getToken=Tp;exports.getTranslations=Pd;exports.getWeekdayNames=Ec;exports.kanbanTokens=Zi;exports.lightTheme=_s;exports.lightTokenTheme=al;exports.lineHeight=ji;exports.listViewDarkTheme=xi;exports.listViewEnTranslations=bi;exports.listViewEsTranslations=yi;exports.listViewLightTheme=ki;exports.listViewNeutralTheme=wi;exports.listViewThemes=In;exports.listViewTranslations=Pn;exports.mergeCalendarTranslations=Ln;exports.mergeListViewTranslations=Mn;exports.mergeTranslations=Ys;exports.neutralTheme=Vs;exports.neutralTokenTheme=rl;exports.opacity=Ji;exports.parseLocalCommand=bc;exports.parseNaturalDate=gi;exports.parseNaturalDuration=fi;exports.parseProgress=hi;exports.parseStatus=hc;exports.pluginManager=Mh;exports.retrySyncOperation=Gp;exports.retryWithBackoff=Ko;exports.shadows=Xi;exports.shouldVirtualizeGrid=Cp;exports.spacing=Hi;exports.themes=Lr;exports.useAI=lp;exports.useBoard=tp;exports.useBoardCore=Uo;exports.useBoardStore=Hn;exports.useCardStacking=pp;exports.useDragState=gs;exports.useFilteredCards=fp;exports.useFilters=op;exports.useGanttI18n=No;exports.useKanbanState=Wn;exports.useKeyboardShortcuts=Cd;exports.useMultiSelect=dp;exports.useSelectionState=zi;exports.useSortedCards=hp;exports.useTheme=ro;exports.useVirtualGrid=wp;exports.useVirtualList=vp;exports.validateAIResponse=yc;exports.withErrorBoundary=xs;exports.wouldCreateCircularDependency=qo;exports.zIndex=Ki;//# sourceMappingURL=index.cjs.map
|
|
420
420
|
//# sourceMappingURL=index.cjs.map
|