@libxai/board 0.17.430 → 0.17.431

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -386,7 +386,7 @@ If ambiguous, ask for clarification in the message field.`;function cm(e){return
386
386
  ${mm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
387
387
  `)}
388
388
 
389
- Today's date: ${new Date().toISOString().split("T")[0]}`}function mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Yi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 b={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(b!==void 0){let y=new Date(r),C=y.getDay(),g=b-C;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+u):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+u*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let u=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,u)}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},i=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(i&&i[1]&&i[2]){let u=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,u)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let u=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,b)}return null}function qi(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 Xi(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 pm(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 um(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 i=r[1].trim(),c=r[2].trim(),l=br(t,i),u=Yi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:u,endDate:y},message:`Moved "${l.name}" to ${u.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),l=br(t,i),u=qi(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+u),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${u} days. New end date: ${b.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),l=br(t,i),u=Xi(c);return l?u===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:u},message:`Set "${l.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),u=br(t,c);return l?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:l.id,dependencyTo:u.id,message:`Linked "${l.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function gm(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 S0(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 E0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(u=>u.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:S0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function fm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:E0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Ji={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"}},Zi={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"}},es={en:Ji,es:Zi};function Qi(e){return es[e]||es.en}function ts(e,t){let a=Qi(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}var el=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let m=el[0],i=el.find(u=>u.value===e)??m,c=i.icon,l=u=>{switch(u){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:el.map(u=>{let b=u.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(u.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(u.value)})]},u.value)})})]})}var tl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=tl.find(c=>c.value===e)??tl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function km({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(C=>C.name===y),b=y=>{if(a)if(u(y.name))a(e.filter(C=>C.name!==y.name));else {let C={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,C)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${C}`))})]})]})}var Z0={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Q0={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),C=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),p=y(g,v),k=new Date,x=[];for(let D=0;D<p;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),w=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,A=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",w?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Z0[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Q0[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:l,onClick:u=>u.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}m(false);},b=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ky(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Hm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),u=r==="es"?zm.es:zm.en;if(react.useEffect(()=>{let v=p=>{l.current&&!l.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:u.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(D=>D.name===h.name)?p.filter(D=>D.name!==h.name):[...p,{name:h.name,initials:ky(h.name),color:h.color||wy(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},C=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Cy,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Cy({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var zm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var _m={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},zy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Vm.es:Vm.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},p=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){b(p.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},C=zy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Vm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Yy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function qm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Ym.es:Ym.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},C=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Yy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Ym={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Zm={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Qm({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Zm.es:Zm.en;react.useEffect(()=>{if(!n)return;let b=C=>{Date.now()-i.current<100||m.current&&!m.current.contains(C.target)&&d(false);},y=C=>{C.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,u&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,C=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:C()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{r(!t),t||a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var mv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function op(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(...op(r.subtasks,t+1));return a}function pv({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 np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:u=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:C=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[w,A]=react.useState("asc"),[I,N]=react.useState(""),[H,U]=react.useState("all"),[j,ce]=react.useState(false),[ee,te]=react.useState(y||mv),[me,pe]=react.useState(false),[Ae,F]=react.useState(false),[R,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[B,_]=react.useState(null),[ae,ne]=react.useState(0),[de,Me]=react.useState(0),Z=react.useRef(null);react.useEffect(()=>{y&&te(y);},[y]);let Ye=react.useMemo(()=>{let G=new Set;function Y(He){for(let Re of He)Re.subtasks?.length&&(Re.isExpanded!==false&&G.add(Re.id),Y(Re.subtasks));}return Y(e),G},[e]),Te=react.useMemo(()=>ee.filter(G=>G.visible),[ee]),Ke=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),Tt=react.useCallback(G=>{D===G?A(Y=>Y==="asc"?"desc":"asc"):(T(G),A("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[D,w,a]),Et=react.useCallback(G=>{te(G),a.onColumnsChange?.(G);},[a]),Ze=react.useCallback(G=>{let Y=ee.map(He=>He.id===G?{...He,visible:false}:He);Et(Y);},[ee,Et]),vt=react.useCallback((G,Y)=>{T(G),A(Y);},[]),bt=react.useCallback((G,Y,He)=>{v&&(G.preventDefault(),S({isOpen:true,x:G.clientX,y:G.clientY,type:Y?"task":"header",task:Y,columnId:He}));},[v]),Gt=react.useCallback(()=>{S(G=>({...G,isOpen:false}));},[]),ue=react.useCallback((G,Y)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let He=ee.find(Re=>Re.id===Y);He&&(_(Y),ne(G.clientX),Me(He.width));},[ee,g]);react.useEffect(()=>{if(!B)return;let G=He=>{let Re=He.clientX-ae,je=Math.max(50,de+Re),We=ee.map(le=>le.id===B?{...le,width:je}:le);te(We);},Y=()=>{B&&a.onColumnsChange?.(ee),_(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y);}},[B,ae,de,ee,a]);let L=react.useCallback(async G=>{if(a.onCreateCustomField){let Y={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),se=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),ge=react.useMemo(()=>{let G=op(e);if(I.trim()){let Y=I.toLowerCase();G=G.filter(He=>He.name.toLowerCase().includes(Y));}return H!=="all"&&(G=G.filter(Y=>se(Y)===H)),j&&(G=G.filter(Y=>se(Y)!=="completed")),G.sort((Y,He)=>{let Re,je;switch(D){case "name":Re=Y.name.toLowerCase(),je=He.name.toLowerCase();break;case "startDate":Re=Y.startDate?.getTime()||0,je=He.startDate?.getTime()||0;break;case "endDate":Re=Y.endDate?.getTime()||0,je=He.endDate?.getTime()||0;break;case "progress":Re=Y.progress||0,je=He.progress||0;break;case "status":Re=Y.status||"todo",je=He.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Re=We[Y.priority]??4,je=We[He.priority]??4;break;default:return 0}return Re<je?w==="asc"?-1:1:Re>je?w==="asc"?1:-1:0}),G},[e,I,H,j,D,w,se]),$e=react.useCallback((G,Y)=>{let He=We=>{a.onTaskUpdate?.({...G,...We});},Re=We=>We?G.customFields?.find(Le=>Le.fieldId===We)?.value:void 0,je=(We,le)=>{if(!We)return;let Q=[...G.customFields||[]],_e=Q.findIndex(Na=>Na.fieldId===We);_e>=0?Q[_e]={fieldId:We,value:le}:Q.push({fieldId:We,value:le}),He({customFields:Q});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:le=>{He({status:le,progress:le==="completed"?100:le==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(vm,{value:G.priority,onChange:le=>He({priority:le}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(km,{value:G.assignees||[],availableUsers:d,onChange:le=>He({assignees:le}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:G.startDate,onChange:le=>He({startDate:le}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:G.endDate,onChange:le=>He({endDate:le}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Nm,{value:G.progress||0,onChange:le=>{let Le=le===100?"completed":le>0?"in-progress":"todo";He({progress:le,status:Le});},isDark:x});case "tags":return jsxRuntime.jsx(Om,{value:G.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Em,{value:Re(Y.customFieldId)||"",onChange:le=>je(Y.customFieldId,le),isDark:x});case "number":return jsxRuntime.jsx(Fm,{value:Re(Y.customFieldId)||0,onChange:le=>je(Y.customFieldId,le),isDark:x});case "date":let We=Re(Y.customFieldId);return jsxRuntime.jsx(ss,{value:We?new Date(We):void 0,onChange:le=>je(Y.customFieldId,le),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Re(Y.customFieldId)||"",options:Y.options||[],onChange:le=>je(Y.customFieldId,le),isDark:x});case "checkbox":return jsxRuntime.jsx(Im,{value:Re(Y.customFieldId)||false,onChange:le=>je(Y.customFieldId,le),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),X=react.useCallback(G=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[G.type]||G.label,[k]),Be=react.useMemo(()=>Te.reduce((G,Y)=>G+Y.width,0)+(C?48:0),[Te,C]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Z,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",B&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Qm,{value:H,hideCompleted:j,onChange:U,onHideCompletedChange:ce,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[ge.length," ",k.pagination.tasks]}),u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:I,onChange:G=>N(G.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"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.jsx("div",{className:"flex-1"}),h&&p&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,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-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Be},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Te.map(G=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:Y=>bt(Y,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>Tt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[X(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:X(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",B===G.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ue(Y,G.id)})]},G.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),pe(Y=>!Y);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",me&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(jm,{isOpen:me,onClose:()=>pe(false),columns:ee,customFields:m,onColumnsChange:Et,onCreateCustomField:()=>{pe(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge.map((G,Y)=>{let He=Ye.has(G.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Re=>bt(Re,G),children:[Te.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),b&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),Ke(G.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:He?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pv,{status:G.status,progress:G.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):$e(G,Re)},Re.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),ge.length===0&&I&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx(Hm,{state:R,onClose:Gt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ze,onColumnSort:vt,availableUsers:d}),jsxRuntime.jsx(qm,{isOpen:Ae,onClose:()=>F(false),onSave:L,isDark:x,locale:c})]})}var sp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],ip=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],lp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var il={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"},ll={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"},dl={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"},ds={dark:il,light:ll,neutral:dl};function dp(e){return ds[e]||ds.dark}var cl={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"}},ml={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"}},cs={en:cl,es:ml};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(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 cp(e){let t=tn(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 mp(e,t=0,a=true){let r=tn(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 bp(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 ul(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 hp({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 vp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,k=ms(h,p),x=v==="dark",[D,T]=react.useState(r||new Date),[w,A]=react.useState(null),[I,N]=react.useState(null),[H,U]=react.useState({}),j=4,ce=3,[ee,te]=react.useState(null),[me,pe]=react.useState(""),[Ae,F]=react.useState(void 0),[R,S]=react.useState(null),[B,_]=react.useState(false),[ae,ne]=react.useState(false),[de,Me]=react.useState(null),[Z,Ye]=react.useState(false),[Te,Ke]=react.useState(new Date),Tt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),Et=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),Ze=react.useCallback(()=>{T(new Date);},[]),vt=react.useMemo(()=>{let ue=D.getFullYear(),L=D.getMonth(),se=new Date(ue,L,1),ge=new Date(ue,L+1,0),$e=se.getDay(),X=ge.getDate(),Be=bp(e),G=new Date;G.setHours(0,0,0,0);let Y=[],He=$e,Re=new Date(ue,L,0).getDate();for(let We=He-1;We>=0;We--){let le=new Date(ue,L-1,Re-We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Le=>ul(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}for(let We=1;We<=X;We++){let le=new Date(ue,L,We),Le=le.getTime()===G.getTime();Y.push({date:le,isCurrentMonth:true,isToday:Le,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Q=>ul(le,Q)).map(Q=>({id:Q.id,title:Q.name,start:Q.startDate,end:Q.endDate,task:Q}))});}let je=42-Y.length;for(let We=1;We<=je;We++){let le=new Date(ue,L+1,We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Le=>ul(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}return Y},[D,e]),bt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Gt=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"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:f("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Gt}),jsxRuntime.jsx("button",{onClick:Ze,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Tt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Et,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"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:bt.map(ue=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ue},ue))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((ue,L)=>{let se=ue.date.getDay()===0||ue.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?se?"bg-[#1C1F26]":ue.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":se?"bg-gray-100":ue.isCurrentMonth?"bg-white":"bg-gray-50",ue.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let ge=H[L]||j,$e=ue.events.slice(0,ge),X=ue.events.length-ge;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[$e.map(Be=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{A(Be.task),a.onEventClick?.(Be),g?.(Be.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Be.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hp,{task:Be.task}),jsxRuntime.jsx("span",{className:"truncate",children:Be.title})]})},Be.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Be=>{Be.stopPropagation(),U(G=>({...G,[L]:ge+ce}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",h==="es"?"M\xC1S":"MORE"]}),ge>j&&ue.events.length>j&&jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),U(G=>({...G,[L]:j}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let ge=L>=28,$e=L%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ee===L?te(null):(te(L),pe(""),F(void 0),S(null),Me(null),_(false),ne(false),Ye(false),Ke(ue.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",ee===L?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",ee===L&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee===L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{te(null),pe(""),F(void 0),S(null),Me(null),_(false),ne(false),Ye(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:ge?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ge?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",ge?"bottom-full mb-1":"top-full mt-1",$e?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),_(false),ne(false),Ye(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:me,onChange:X=>pe(X.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&me.trim()){let Be=t.availableUsers?.find(Y=>Y.id===R),G=de||ue.date;a.onTaskCreate?.({name:me.trim(),startDate:G,endDate:G,priority:Ae,assignees:Be?[Be]:void 0}),pe(""),F(void 0),S(null),Me(null),te(null);}X.key==="Escape"&&(te(null),pe(""),F(void 0),S(null),Me(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"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:X=>{X.stopPropagation(),_(!B),ne(false);},className:f("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"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:B&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),_(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),Ye(!Z),_(false),ne(false),Ke(de||ue.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",de?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"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"}),(de||ue.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Be=new Date(X);Be.setDate(X.getDate()+1);let G=new Date(X);G.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let He=new Date(X);He.setDate(X.getDate()+14);let Re=new Date(X);return Re.setDate(X.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Be,display:Be.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:G,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:He,display:He.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,le)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Me(We.date),Ye(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},le))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",x?"text-white":"text-gray-900"),children:Te.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ke(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()+1)),className:f("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=Te.getFullYear(),Be=Te.getMonth(),G=new Date(X,Be,1).getDay(),Y=new Date(X,Be+1,0).getDate(),He=new Date(X,Be,0).getDate(),Re=new Date,je=[];for(let le=G-1;le>=0;le--)je.push({dayNum:He-le,isCurrentMonth:false,date:new Date(X,Be-1,He-le)});for(let le=1;le<=Y;le++)je.push({dayNum:le,isCurrentMonth:true,date:new Date(X,Be,le)});let We=42-je.length;for(let le=1;le<=We;le++)je.push({dayNum:le,isCurrentMonth:false,date:new Date(X,Be+1,le)});return je.map((le,Le)=>{let Q=le.date.toDateString()===Re.toDateString(),_e=(de||ue.date).toDateString()===le.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!le.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),le.isCurrentMonth&&(x?"text-white":"text-gray-900"),Q&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Me(le.date),Ye(false);},children:le.dayNum},Le)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ne(!ae),_(false);},className:f("p-1 rounded transition-colors",R?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:R?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(X=>X.id===R)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===R)?.initials||t.availableUsers?.find(X=>X.id===R)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!R&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{S(X.id),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",R===X.id&&(x?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(me.trim()){let X=t.availableUsers?.find(G=>G.id===R),Be=de||ue.date;a.onTaskCreate?.({name:me.trim(),startDate:Be,endDate:Be,priority:Ae,assignees:X?[X]:void 0}),pe(""),F(void 0),S(null),Me(null),te(null);}},disabled:!me.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",me.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",ue.isToday?"text-[#3B82F6]":ue.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ue.date.getDate()})]})]},L)})})]})}),jsxRuntime.jsx(mr,{task:w,isOpen:!!w,onClose:()=>A(null),onTaskUpdate:ue=>{a.onTaskUpdate?.(ue),A(ue);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ue=>({id:ue.id,name:ue.name,avatar:ue.avatar,initials:ue.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:w?c?.get(w.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(ue=>ue.id!==w?.id),comments:l?.filter(ue=>ue.taskId===w?.id).map(ue=>({...ue,createdAt:ue.createdAt instanceof Date?ue.createdAt:new Date(ue.createdAt),updatedAt:ue.updatedAt instanceof Date?ue.updatedAt:ue.updatedAt?new Date(ue.updatedAt):void 0})),onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(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:f("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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:I.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"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:I.events.map(ue=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),A(ue.task),g?.(ue.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hp,{task:ue.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ue.title}),ue.task.priority==="high"||ue.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ue.id))})]})]})})]})}var gl={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"},fl={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"},bl={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"},ps={dark:gl,light:fl,neutral:bl};function xp(e){return ps[e]||ps.dark}function wv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,C=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:C,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,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:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.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:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.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"})]})})]},b.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(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 on(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 Cp(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 Tp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...wp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),u=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let k=p.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(p):h.set(k,[p]);}),Array.from(h.entries()).sort((p,k)=>k[0].localeCompare(p[0])).map(([p,k])=>({date:new Date(p),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,p=new Set;return e.forEach(k=>{h.add(k.userId),p.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),C=h=>{c(p=>{let k=new Set(p);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),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:f("history-timeline",m.compact&&"compact",d),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:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:u.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((p,k)=>{let x=i.has(p.id),D=s===p.id,T=Cp(p.type);return jsxRuntime.jsxs("div",{"data-event-id":p.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(p.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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&&p.userAvatar&&jsxRuntime.jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(p)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),C(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},w)),p.metadata&&Object.keys(p.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(p.metadata).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},w))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),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:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),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 hl(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 yl(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 Sp(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 Ep(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ev(e,t,a,r,o,s=100){let n=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})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,u=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,C=c.y-b.y,g=Math.sqrt(y*y+C*C)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=C/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),u=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!u)return;let b=u.x-l.x,y=u.y-l.y,C=Math.sqrt(b*b+y*y)||1,g=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,u.vx-=b*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Pp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Ev(e,t,a.width,a.height,a,150);l(U);},[e,t,a]);let D=react.useCallback((U,j)=>{a.enableDragging&&(j.stopPropagation(),b(U));},[a.enableDragging]),T=react.useCallback(U=>{if(!u||!i.current)return;let ce=i.current.getBoundingClientRect(),ee=(U.clientX-ce.left-k.x)/h,te=(U.clientY-ce.top-k.y)/h;l(me=>me.map(pe=>pe.id===u?{...pe,x:ee,y:te,fx:ee,fy:te}:pe));},[u,h,k]),w=react.useCallback(()=>{b(null);},[]),A=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"node-click",node:U,position:{x:j.clientX,y:j.clientY}});},[d]),I=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"edge-click",edge:U,position:{x:j.clientX,y:j.clientY}});},[d]),N=react.useCallback(U=>{let j=c.find(ce=>ce.id===U);return j?{x:j.x,y:j.y}:{x:0,y:0}},[c]),H=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=U.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("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:f("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:n.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:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:hl(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sp(U)," ",yl(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let j=N(typeof U.source=="string"?U.source:U.source.id),ce=N(typeof U.target=="string"?U.target:U.target.id),ee=Ep(U.type),te=g===U.id,me=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",te&&"hovered",me&&"critical"),onMouseEnter:()=>v(U.id),onMouseLeave:()=>v(null),onClick:pe=>I(U,pe),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:ce.x,y2:ce.y,stroke:hl(U.type),strokeWidth:me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:te?1:.6,markerEnd:ee?"url(#arrowhead)":void 0}),a.showEdgeLabels&&te&&jsxRuntime.jsx("text",{x:(j.x+ce.x)/2,y:(j.y+ce.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:yl(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(U=>{let j=y===U.id,ce=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",j&&"hovered",ce&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:ee=>D(U.id,ee),onMouseEnter:()=>C(U.id),onMouseLeave:()=>C(null),onClick:ee=>A(U,ee),children:[jsxRuntime.jsx("circle",{r:ce?a.nodeSize*1.2:a.nodeSize,fill:H(U),stroke:ce?"#fbbf24":"#ffffff",strokeWidth:ce?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 Ap({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,u]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&C();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let C=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:h=>h.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:C,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,p)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,p)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},p)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.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:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,p)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,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:h},p))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&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:C,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick: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 Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,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:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vl={"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 Mv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={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 Av(e,t,a){let r=vl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var xl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Av(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,u)=>l+u.cost,0),s=a.reduce((l,u)=>l+u.inputTokens,0),n=a.reduce((l,u)=>l+u.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,u)=>l+u.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=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)}},no=new xl;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let d=no.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:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:nn(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,i])=>{let c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.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:nn(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 $p({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[u,b]=react.useState(false),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(null),k=react.useRef(null),x=u||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let I=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),C(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),C(null),v(null),p(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(I.tasks.tasks),p({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){C(I instanceof Error?I.message:"Failed to generate tasks");}finally{b(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let A=h?.similarity?((h.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:I=>I.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:x,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:g?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:[h?.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"}),h?.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 (",A,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:k,value:n,onChange:I=>d(I.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:x}),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:I=>i(I.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:x})]}),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:c,onChange:I=>l(I.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:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((I,N)=>jsxRuntime.jsx("button",{onClick:()=>d(I),disabled:x,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:I},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&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:x,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"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,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:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(p=>{let k=p.cards.find(I=>I.id===g);if(!k)return p;let x=k.columnId,D={...k,columnId:v,position:h},T=p.cards.map(I=>I.id===g?D:I),w=p.columns.map(I=>{if(I.id===x)return {...I,cardIds:I.cardIds.filter(N=>N!==g)};if(I.id===v){let N=T.filter(H=>H.columnId===v).sort((H,U)=>H.position-U.position);return {...I,cardIds:N.map(H=>H.id)}}return I}),A={...p,cards:T,columns:w};return o(A),A});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:p};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,p],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let p=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:p,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,p]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:p};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:p};return o(k),k});},[o]),u=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:u,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function Up({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({...Wp,...t}),d=react.useCallback(C=>{o(g=>({...g,...C}));},[]),m=react.useCallback(C=>{n(g=>({...g,...C}));},[]),i=react.useCallback(()=>{o(sn),n(Wp);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(C=>{let g=[...C];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${A}-${I}-${N}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let A=new Date(x+"T00:00:00"),I=new Date(w+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),I>=A&&I<=N;case "custom":if(r.dateRange){let H=typeof T=="string"?new Date(T):T;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],w=D[h.priority||"LOW"];p=T-w;break;case "dueDate":let A=v.endDate||v.dueDate,I=h.endDate||h.dueDate;if(!A)return 1;if(!I)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),H=typeof I=="string"?new Date(I).getTime():I.getTime();p=N-H;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let U=v.estimatedTime||0,j=h.estimatedTime||0;p=U-j;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:u,applyFilters:y,hasActiveFilters:b}}var Vp,jp;if(typeof window<"u")try{let e=un("ai");Vp=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vp&&jp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let b=u instanceof Error?u:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let b=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let b=u instanceof Error?u:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(u){let b=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(u){let b=u instanceof Error?u:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function wl(){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 Yp(e){let{cards:t}=e,[a,r]=wl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,u)=>{if(!u){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=u.ctrlKey||u.metaKey,y=u.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let C=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(C&&g&&C.columnId===g.columnId){let v=t.filter(w=>w.columnId===C.columnId).sort((w,A)=>w.position-A.position),h=v.findIndex(w=>w.id===a.lastSelectedCardId),p=v.findIndex(w=>w.id===l),[k,x]=h<p?[h,p]:[p,h],D=v.slice(k,x+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(u=>u!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((C,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(C=>{n(g=>g.filter(v=>v.id!==C));},[]),i=react.useCallback(C=>{n(g=>g.map(v=>v.id===C?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((C,g)=>{n(v=>v.map(h=>h.id===C&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((C,g)=>{n(v=>v.map(h=>{if(h.id===C){let p=h.cardIds.filter(k=>k!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=react.useCallback(C=>s.filter(g=>g.columnId===C).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async C=>{let g=t.filter(x=>x.columnId===C);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{p.has(D)||p.set(D,[]),p.get(D).push(x);});}),p.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:C,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[x.id,...T.map(I=>I.card.id)],A=T.reduce((I,N)=>I+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(C=>{d(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:u,getSuggestions:b,applySuggestion:y,config:o}}var Jp=react.createContext(null);function Zp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),u=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),C=react.useCallback((h,p,k)=>{e.moveCard(h,p,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:u,updateCard:b,deleteCard:y,moveCard:C,getCard:g,getCardsByColumn:v}}function eu(e){let{cards:t}=dn();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function tu(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=td.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},qv=new hs;function ru({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let C=e[y.index];if(!C)return null;let g=m?m(C,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(C,y.index)},g)})})})}function ou(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 su({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),u=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:u.map(C=>{let g=e[C.index];if(!g)return null;let v=m?m(g,C.index):C.index,h={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":C.index,children:o(g,C.index)},v)})})})}function iu(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 lu(e,t=10){return e>t}var Dl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Sl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},El={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Pl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ml={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Al={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ll={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)"},Il={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)"},Bl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Rl={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}},Ol={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}},ys={spacing:Dl,borderRadius:Sl,fontSize:El,fontWeight:Pl,lineHeight:Ml,zIndex:Fl,duration:Al,easing:Ll,shadows:Il,opacity:Bl,kanban:Rl,gantt:Ol};function du(e,t,a){return e[t]??a}function $l(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?$l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zl(e="asakaa"){let t=$l(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Zv(o);a.push(` ${s}: ${n};`);}return `:root {
389
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function br(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Yi(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 u=new Date(r);return u.setDate(u.getDate()+1),u}if(a==="yesterday"||a==="ayer"){let u=new Date(r);return u.setDate(u.getDate()-1),u}if(a==="next week"||a==="la pr\xF3xima semana"){let u=new Date(r);return u.setDate(u.getDate()+7),u}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 b={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(b!==void 0){let y=new Date(r),C=y.getDay(),g=b-C;return g<=0&&(g+=7),y.setDate(y.getDate()+g),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),b=s[2].toLowerCase(),y=new Date(r);return b==="day"||b==="d\xEDa"||b==="dias"?y.setDate(y.getDate()+u):b==="week"||b==="semana"||b==="semanas"?y.setDate(y.getDate()+u*7):(b==="month"||b==="mes"||b==="meses")&&y.setMonth(y.getMonth()+u),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let u=parseInt(d[1],10),b=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,b,u)}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},i=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(i&&i[1]&&i[2]){let u=parseInt(i[1],10),b=m[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(b!==void 0)return new Date(y,b,u)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let u=c[l[1].toLowerCase()],b=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(u!==void 0)return new Date(y,u,b)}return null}function qi(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 Xi(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 pm(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 um(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 i=r[1].trim(),c=r[2].trim(),l=br(t,i),u=Yi(c);if(!l)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let b=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(u);return y.setDate(y.getDate()+b),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:u,endDate:y},message:`Moved "${l.name}" to ${u.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),l=br(t,i),u=qi(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let b=new Date(l.endDate);return b.setDate(b.getDate()+u),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:b},message:`Extended "${l.name}" by ${u} days. New end date: ${b.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),c=s[2].trim(),l=br(t,i),u=Xi(c);return l?u===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:u},message:`Set "${l.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),l=br(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=br(t,i),u=br(t,c);return l?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:l.id,dependencyTo:u.id,message:`Linked "${l.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=br(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function gm(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 S0(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 E0(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Qn(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(u=>u.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Qn(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:S0(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function fm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:E0(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Qn(r,e,t))}var Ji={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"}},Zi={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"}},es={en:Ji,es:Zi};function Qi(e){return es[e]||es.en}function ts(e,t){let a=Qi(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}var el=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-blue-500"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-green-500"}];function hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let u=b=>{d.current&&!d.current.contains(b.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let m=el[0],i=el.find(u=>u.value===e)??m,c=i.icon,l=u=>{switch(u){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(c,{className:f("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:l(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:el.map(u=>{let b=u.icon;return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),t(u.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===u.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(b,{className:f("w-4 h-4",u.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:l(u.value)})]},u.value)})})]})}var tl=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function vm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=tl.find(c=>c.value===e)??tl[4],i=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:f("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:tl.map(c=>jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:f("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-2 h-2 rounded-full",c.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function os(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ns(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function km({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=react.useState(false),[m,i]=react.useState(""),c=react.useRef(null);react.useEffect(()=>{let y=C=>{c.current&&!c.current.contains(C.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]);let l=t.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())||y.email?.toLowerCase().includes(m.toLowerCase())),u=y=>e.some(C=>C.name===y),b=y=>{if(a)if(u(y.name))a(e.filter(C=>C.name!==y.name));else {let C={name:y.name,initials:os(y.name),color:y.color||ns(y.name).replace("bg-","").replace("-500",""),avatar:y.avatarUrl};a([...e,C]);}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,title:y.name,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>3&&jsxRuntime.jsxs("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),d(!n);},className:f("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:f("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((y,C)=>jsxRuntime.jsx("div",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!y.avatar&&ns(y.name)),style:y.color&&!y.avatar?{backgroundColor:y.color}:void 0,children:y.avatar?jsxRuntime.jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials||os(y.name)},`${y.name}-${C}`)),e.length>2&&jsxRuntime.jsxs("span",{className:f("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-64",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsxRuntime.jsx("input",{type:"text",value:m,onChange:y=>i(y.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:f("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:y=>y.stopPropagation()})}),jsxRuntime.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):l.map(y=>jsxRuntime.jsxs("button",{onClick:C=>{C.stopPropagation(),b(y);},className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!y.avatarUrl&&ns(y.name)),children:y.avatarUrl?jsxRuntime.jsx("img",{src:y.avatarUrl,alt:y.name,className:"w-full h-full rounded-full object-cover"}):os(y.name)}),jsxRuntime.jsxs("div",{className:"flex-1 text-left",children:[jsxRuntime.jsx("div",{className:r?"text-white":"text-gray-900",children:y.name}),y.email&&jsxRuntime.jsx("div",{className:f("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:y.email})]}),u(y.name)&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-green-500"})]},y.id))}),e.length>0&&jsxRuntime.jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((y,C)=>jsxRuntime.jsxs("span",{className:f("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[y.name,jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),a(e.filter(v=>v.name!==y.name));},className:"hover:text-red-500",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},`${y.name}-${C}`))})]})]})}var Z0={en:["January","February","March","April","May","June","July","August","September","October","November","December"],es:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},Q0={en:["Su","Mo","Tu","We","Th","Fr","Sa"],es:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"]};function ss({value:e,onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(()=>{if(e){let g=e instanceof Date?e:new Date(e);return new Date(g.getFullYear(),g.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),i=react.useRef(null),c=e?e instanceof Date?e:new Date(e):null,l=r==="es"?"es":"en";react.useEffect(()=>{let g=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let u=g=>g?g.toLocaleDateString(r==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-",b=(g,v)=>new Date(g,v+1,0).getDate(),y=(g,v)=>new Date(g,v,1).getDay(),C=()=>{let g=d.getFullYear(),v=d.getMonth(),h=b(g,v),p=y(g,v),k=new Date,x=[];for(let D=0;D<p;D++)x.push(jsxRuntime.jsx("div",{className:"w-8 h-8"},`empty-${D}`));for(let D=1;D<=h;D++){let T=new Date(g,v,D),w=c&&c.getDate()===D&&c.getMonth()===v&&c.getFullYear()===g,A=k.getDate()===D&&k.getMonth()===v&&k.getFullYear()===g;x.push(jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),t?.(T),n(false);},className:f("w-8 h-8 rounded-full text-sm transition-colors",w?"bg-[#3B82F6] text-white":A?a?"bg-white/10 text-white":"bg-gray-100 text-gray-900":a?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-900"),children:D},D));}return x};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:f("w-4 h-4",a?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u(c)})]}),s&&jsxRuntime.jsxs("div",{className:f("absolute z-50 top-full left-0 mt-1 p-3 rounded-lg shadow-lg border",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()-1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})}),jsxRuntime.jsxs("span",{className:f("text-sm font-medium",a?"text-white":"text-gray-900"),children:[Z0[l][d.getMonth()]," ",d.getFullYear()]}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m(new Date(d.getFullYear(),d.getMonth()+1,1));},className:f("p-1 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",a?"text-white":"text-gray-600")})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:Q0[l].map(g=>jsxRuntime.jsx("div",{className:f("w-8 h-6 text-xs flex items-center justify-center",a?"text-[#6B7280]":"text-gray-400"),children:g},g))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:C()}),jsxRuntime.jsxs("div",{className:"mt-3 pt-3 border-t flex gap-2",style:{borderColor:a?"rgba(255,255,255,0.1)":"#E5E7EB"},children:[jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),t?.(new Date),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation();let v=new Date;v.setDate(v.getDate()+1),t?.(v),n(false);},className:f("flex-1 py-1.5 text-xs rounded",a?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:r==="es"?"Ma\xF1ana":"Tomorrow"})]})]})]})}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsxRuntime.jsx("div",{onClick:s=>{if(r||!t)return;s.stopPropagation();let n=s.currentTarget.getBoundingClientRect(),d=s.clientX-n.left,m=Math.round(d/n.width*100),i=Math.max(0,Math.min(100,m));t(i);},className:f("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:f("h-full rounded-full transition-all",e===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${e}%`}})}),jsxRuntime.jsxs("span",{className:f("text-xs w-8 text-right",a?"text-[#9CA3AF]":"text-gray-500"),children:[e,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[d,m]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(m(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:f("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:d,onChange:u=>m(u.target.value),onBlur:c,onKeyDown:l,onClick:u=>u.stopPropagation(),className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:u=>{u.stopPropagation(),n(true);},className:f("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false}){let[d,m]=react.useState(false),[i,c]=react.useState(e?.toString()||""),l=react.useRef(null);react.useEffect(()=>{d&&l.current&&(l.current.focus(),l.current.select());},[d]),react.useEffect(()=>{c(e?.toString()||"");},[e]);let u=()=>{let y=parseFloat(i);if(!isNaN(y)){let C=y;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&t?.(C);}m(false);},b=y=>{y.key==="Enter"?u():y.key==="Escape"&&(c(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:f("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:e!==void 0?e:r}):d?jsxRuntime.jsx("input",{ref:l,type:"number",value:i,onChange:y=>c(y.target.value),onBlur:u,onKeyDown:b,onClick:y=>y.stopPropagation(),min:o,max:s,className:f("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),m(true);},className:f("text-sm text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",e===void 0&&(a?"text-[#6B7280]":"text-gray-400")),children:e!==void 0?e:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=react.useState(false),m=react.useRef(null);return react.useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsxRuntime.jsx("span",{className:f("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:f("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:f("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:f("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:f("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxRuntime.jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:f("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false}){return jsxRuntime.jsx("button",{onClick:s=>{s.stopPropagation(),!r&&t&&t(!e);},disabled:r||!t,className:f("w-5 h-5 rounded border-2 flex items-center justify-center transition-colors",e?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed"),children:e&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:f("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:f("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function ky(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wy(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Hm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=react.useRef(null),u=r==="es"?zm.es:zm.en;if(react.useEffect(()=>{let v=p=>{l.current&&!l.current.contains(p.target)&&t();},h=p=>{p.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let b=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:u.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:u.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:u.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:u.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:u.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:u.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:u.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:u.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:u.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:u.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:u.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let p=e.task.assignees||[],x=p.some(D=>D.name===h.name)?p.filter(D=>D.name!==h.name):[...p,{name:h.name,initials:ky(h.name),color:h.color||wy(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:x}),t();}}))})),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:u.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:u.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},y=()=>{if(!e.columnId)return [];let v=[];return i&&(v.push({id:"sort-asc",label:u.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:u.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:u.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),v},C=e.type==="task"?b():y(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:l,style:g,className:f("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:C.map(v=>v.separator?jsxRuntime.jsx("div",{className:f("my-1 h-px",a?"bg-white/10":"bg-gray-200")},v.id):v.submenu?jsxRuntime.jsx(Cy,{item:v,isDark:a},v.id):jsxRuntime.jsxs("button",{onClick:v.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:f(v.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Cy({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:f("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxRuntime.jsxs("button",{onClick:d.onClick,className:f("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsxRuntime.jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var zm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var _m={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"})},zy=["name","status","priority","assignees","startDate","endDate","progress","tags"];function jm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=react.useState(""),c=react.useRef(null),l=d==="es"?Vm.es:Vm.en;if(react.useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let h=k=>{c.current&&!c.current.contains(k.target)&&t();},p=k=>{k.key==="Escape"&&t();};document.addEventListener("mousedown",h),document.addEventListener("keydown",p),c._cleanup=()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",p);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[e,t]),!e)return null;let u=v=>l.columns[v]||v,b=v=>{if(v==="name")return;let h=a.map(p=>p.id===v?{...p,visible:!p.visible}:p);o(h);},y=(v,h)=>{let p=a.find(x=>x.type===v&&(!h||x.customFieldId===h));if(p){b(p.id);return}let k={id:h||v,type:v,label:h?r.find(x=>x.id===h)?.name||v:u(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:h};o([...a,k]);},C=zy.filter(v=>u(v).toLowerCase().includes(m.toLowerCase())),g=r.filter(v=>v.name.toLowerCase().includes(m.toLowerCase()));return jsxRuntime.jsxs("div",{ref:c,className:f("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:f("font-medium",n?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsx("div",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:m,onChange:v=>i(v.target.value),placeholder:l.searchPlaceholder,className:f("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.standardFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:C.map(v=>{let h=a.find(x=>x.type===v&&!x.customFieldId),p=h?.visible??false,k=v==="name";return jsxRuntime.jsxs("button",{onClick:()=>{k||(h?b(h.id):y(v));},disabled:k,className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",k&&"opacity-50 cursor-not-allowed"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v]}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:u(v)})]},v)})})]}),g.length>0&&jsxRuntime.jsxs("div",{className:"px-3 pb-2",children:[jsxRuntime.jsx("h4",{className:f("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:l.customFields}),jsxRuntime.jsx("div",{className:"space-y-1",children:g.map(v=>{let p=a.find(k=>k.customFieldId===v.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>y(v.type,v.id),className:f("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded border flex items-center justify-center",p?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:p&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:_m[v.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{className:n?"text-white":"text-gray-900",children:v.name})]},v.id)})})]}),s&&jsxRuntime.jsx("div",{className:f("p-3 border-t",n?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:s,className:f("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-colors",n?"bg-[#3B82F6]/20 text-[#3B82F6] hover:bg-[#3B82F6]/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.createField]})})]})}var Vm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",createField:"Create custom field",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",createField:"Crear campo personalizado",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Yy=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function qm({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[d,m]=react.useState("text"),[i,c]=react.useState([""]),l=o==="es"?Ym.es:Ym.en;react.useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),react.useEffect(()=>{let g=v=>{v.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let u=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(v=>v.trim())),a(g),t();},b=()=>{c([...i,""]);},y=(g,v)=>{let h=[...i];h[g]=v,c(h);},C=g=>{i.length>1&&c(i.filter((v,h)=>h!==g));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:f("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:f("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:f("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsxRuntime.jsx("button",{onClick:t,className:f("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:f("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:f("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:Yy.map(g=>jsxRuntime.jsxs("button",{onClick:()=>m(g.type),className:f("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsxRuntime.jsx("span",{className:f("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:f("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((g,v)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:g,onChange:h=>y(v,h.target.value),placeholder:`${l.option} ${v+1}`,className:f("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsxRuntime.jsx("button",{onClick:()=>C(v),className:f("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},v)),jsxRuntime.jsxs("button",{onClick:b,className:f("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:f("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsxRuntime.jsx("button",{onClick:u,disabled:!s.trim(),className:f("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Ym={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Zm={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function Qm({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=react.useState(false),m=react.useRef(null),i=react.useRef(0),c=s==="es"?Zm.es:Zm.en;react.useEffect(()=>{if(!n)return;let b=C=>{Date.now()-i.current<100||m.current&&!m.current.contains(C.target)&&d(false);},y=C=>{C.key==="Escape"&&d(false);};return document.addEventListener("mousedown",b),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:f("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),c.filters,u&&jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:f("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:f("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsxRuntime.jsx("span",{className:f("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:l.map(b=>{let y=e===b.value&&!t,C=()=>b.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):b.icon;return jsxRuntime.jsxs("button",{onClick:g=>{g.preventDefault(),g.stopPropagation(),a(b.value),r(false),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",y&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f(y?b.color:"text-gray-400","flex-shrink-0"),children:C()}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:b.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},b.value)})}),jsxRuntime.jsx("div",{className:f("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:b=>{b.preventDefault(),b.stopPropagation();let y=!t;r(y),y&&a("all"),d(false);},className:f("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:f("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("span",{className:f("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:f("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var mv=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function op(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(...op(r.subtasks,t+1));return a}function pv({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 np({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:u=true,showHierarchy:b=true,tableColumns:y,allowColumnCustomization:C=true,allowColumnResize:g=true,enableContextMenu:v=true,showCreateTaskButton:h=false,onCreateTask:p}=t,k=ts(c,l),x=i==="dark",[D,T]=react.useState("startDate"),[w,A]=react.useState("asc"),[I,N]=react.useState(""),[H,U]=react.useState("all"),[j,ce]=react.useState(false),[ee,te]=react.useState(y||mv),[me,pe]=react.useState(false),[Ae,F]=react.useState(false),[R,S]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[B,_]=react.useState(null),[ae,ne]=react.useState(0),[de,Me]=react.useState(0),Z=react.useRef(null);react.useEffect(()=>{y&&te(y);},[y]);let Ye=react.useMemo(()=>{let G=new Set;function Y(He){for(let Re of He)Re.subtasks?.length&&(Re.isExpanded!==false&&G.add(Re.id),Y(Re.subtasks));}return Y(e),G},[e]),Te=react.useMemo(()=>ee.filter(G=>G.visible),[ee]),Ke=react.useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),Tt=react.useCallback(G=>{D===G?A(Y=>Y==="asc"?"desc":"asc"):(T(G),A("asc")),a.onSortChange?.({column:G,direction:w==="asc"?"desc":"asc"});},[D,w,a]),Et=react.useCallback(G=>{te(G),a.onColumnsChange?.(G);},[a]),Ze=react.useCallback(G=>{let Y=ee.map(He=>He.id===G?{...He,visible:false}:He);Et(Y);},[ee,Et]),vt=react.useCallback((G,Y)=>{T(G),A(Y);},[]),bt=react.useCallback((G,Y,He)=>{v&&(G.preventDefault(),S({isOpen:true,x:G.clientX,y:G.clientY,type:Y?"task":"header",task:Y,columnId:He}));},[v]),Gt=react.useCallback(()=>{S(G=>({...G,isOpen:false}));},[]),ue=react.useCallback((G,Y)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let He=ee.find(Re=>Re.id===Y);He&&(_(Y),ne(G.clientX),Me(He.width));},[ee,g]);react.useEffect(()=>{if(!B)return;let G=He=>{let Re=He.clientX-ae,je=Math.max(50,de+Re),We=ee.map(le=>le.id===B?{...le,width:je}:le);te(We);},Y=()=>{B&&a.onColumnsChange?.(ee),_(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y);}},[B,ae,de,ee,a]);let L=react.useCallback(async G=>{if(a.onCreateCustomField){let Y={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}F(false);},[a]),se=react.useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),ge=react.useMemo(()=>{let G=op(e);if(I.trim()){let Y=I.toLowerCase();G=G.filter(He=>He.name.toLowerCase().includes(Y));}return H!=="all"&&(G=G.filter(Y=>se(Y)===H)),j&&(G=G.filter(Y=>se(Y)!=="completed")),G.sort((Y,He)=>{let Re,je;switch(D){case "name":Re=Y.name.toLowerCase(),je=He.name.toLowerCase();break;case "startDate":Re=Y.startDate?.getTime()||0,je=He.startDate?.getTime()||0;break;case "endDate":Re=Y.endDate?.getTime()||0,je=He.endDate?.getTime()||0;break;case "progress":Re=Y.progress||0,je=He.progress||0;break;case "status":Re=Y.status||"todo",je=He.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};Re=We[Y.priority]??4,je=We[He.priority]??4;break;default:return 0}return Re<je?w==="asc"?-1:1:Re>je?w==="asc"?1:-1:0}),G},[e,I,H,j,D,w,se]),$e=react.useCallback((G,Y)=>{let He=We=>{a.onTaskUpdate?.({...G,...We});},Re=We=>We?G.customFields?.find(Le=>Le.fieldId===We)?.value:void 0,je=(We,le)=>{if(!We)return;let Q=[...G.customFields||[]],_e=Q.findIndex(Na=>Na.fieldId===We);_e>=0?Q[_e]={fieldId:We,value:le}:Q.push({fieldId:We,value:le}),He({customFields:Q});};switch(Y.type){case "name":return null;case "status":return jsxRuntime.jsx(hm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:le=>{He({status:le,progress:le==="completed"?100:le==="in-progress"?50:0});},isDark:x,locale:c,translations:k.status});case "priority":return jsxRuntime.jsx(vm,{value:G.priority,onChange:le=>He({priority:le}),isDark:x,locale:c});case "assignees":return jsxRuntime.jsx(km,{value:G.assignees||[],availableUsers:d,onChange:le=>He({assignees:le}),isDark:x,locale:c});case "startDate":return jsxRuntime.jsx(ss,{value:G.startDate,onChange:le=>He({startDate:le}),isDark:x,locale:c});case "endDate":return jsxRuntime.jsx(ss,{value:G.endDate,onChange:le=>He({endDate:le}),isDark:x,locale:c});case "progress":return jsxRuntime.jsx(Nm,{value:G.progress||0,onChange:le=>{let Le=le===100?"completed":le>0?"in-progress":"todo";He({progress:le,status:Le});},isDark:x});case "tags":return jsxRuntime.jsx(Om,{value:G.tags||[],isDark:x});case "text":return jsxRuntime.jsx(Em,{value:Re(Y.customFieldId)||"",onChange:le=>je(Y.customFieldId,le),isDark:x});case "number":return jsxRuntime.jsx(Fm,{value:Re(Y.customFieldId)||0,onChange:le=>je(Y.customFieldId,le),isDark:x});case "date":let We=Re(Y.customFieldId);return jsxRuntime.jsx(ss,{value:We?new Date(We):void 0,onChange:le=>je(Y.customFieldId,le),isDark:x,locale:c});case "dropdown":return jsxRuntime.jsx(Am,{value:Re(Y.customFieldId)||"",options:Y.options||[],onChange:le=>je(Y.customFieldId,le),isDark:x});case "checkbox":return jsxRuntime.jsx(Im,{value:Re(Y.customFieldId)||false,onChange:le=>je(Y.customFieldId,le),isDark:x});default:return jsxRuntime.jsx("span",{className:f("text-sm",x?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,x,c,d,k]),X=react.useCallback(G=>({name:k.columns.name,status:k.columns.status,priority:k.columns.priority,assignees:k.columns.assignees,startDate:k.columns.startDate,endDate:k.columns.endDate,progress:k.columns.progress})[G.type]||G.label,[k]),Be=react.useMemo(()=>Te.reduce((G,Y)=>G+Y.width,0)+(C?48:0),[Te,C]);return r?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",s),style:n,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:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.empty.noTasks}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:Z,className:f("flex-1 flex flex-col w-full h-full overflow-hidden",x?"bg-[#0F1117]":"bg-white",B&&"select-none",s),style:n,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"border-white/10":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Qm,{value:H,hideCompleted:j,onChange:U,onHideCompletedChange:ce,isDark:x,locale:c}),jsxRuntime.jsxs("div",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[ge.length," ",k.pagination.tasks]}),u&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:f("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:I,onChange:G=>N(G.target.value),placeholder:k.toolbar.searchPlaceholder,className:f("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",x?"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.jsx("div",{className:"flex-1"}),h&&p&&jsxRuntime.jsxs(framerMotion.motion.button,{onClick:p,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-4 h-4"}),jsxRuntime.jsx("span",{children:k.toolbar.newTask})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsxs("div",{style:{minWidth:Be},children:[jsxRuntime.jsxs("div",{className:f("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",x?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Te.map(G=>jsxRuntime.jsxs("div",{className:f("relative flex items-center gap-2 px-4 py-3",x?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:Y=>bt(Y,void 0,G.id),children:[G.sortable?jsxRuntime.jsxs("button",{onClick:()=>Tt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[X(G),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:f("w-3 h-3",D===G.id&&"text-[#3B82F6]")})]}):jsxRuntime.jsx("span",{children:X(G)}),g&&G.resizable&&jsxRuntime.jsx("div",{className:f("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",B===G.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ue(Y,G.id)})]},G.id)),C&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsxRuntime.jsx("button",{onClick:G=>{G.stopPropagation(),pe(Y=>!Y);},className:f("p-1.5 rounded-lg transition-colors",x?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",me&&(x?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(jm,{isOpen:me,onClose:()=>pe(false),columns:ee,customFields:m,onColumnsChange:Et,onCreateCustomField:()=>{pe(false),F(true);},isDark:x,locale:c})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ge.map((G,Y)=>{let He=Ye.has(G.id);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:Y*.02},className:f("flex items-center border-b transition-colors",x?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Re=>bt(Re,G),children:[Te.map(Re=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Re.width,minWidth:Re.minWidth},children:Re.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&G.level>0&&jsxRuntime.jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),b&&G.hasChildren&&jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),Ke(G.id);},className:f("p-0.5 rounded flex-shrink-0",x?"hover:bg-white/10":"hover:bg-gray-200"),children:He?jsxRuntime.jsx(lucideReact.ChevronDown,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-4 h-4",x?"text-[#9CA3AF]":"text-gray-400")})}),b&&!G.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsx("button",{onClick:je=>{je.stopPropagation(),a.onTaskUpdate?.({...G,progress:G.progress===100?0:100,status:G.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsxRuntime.jsx(pv,{status:G.status,progress:G.progress})}),jsxRuntime.jsx("span",{className:f("truncate font-medium",x?"text-white":"text-gray-900",G.progress===100&&(x?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):$e(G,Re)},Re.id)),C&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),ge.length===0&&I&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:f("w-12 h-12 mx-auto mb-4",x?"text-[#6B7280]":"text-gray-400")}),jsxRuntime.jsx("p",{className:f(x?"text-[#9CA3AF]":"text-gray-600"),children:k.empty.noResults})]})})]})}),jsxRuntime.jsx(Hm,{state:R,onClose:Gt,isDark:x,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ze,onColumnSort:vt,availableUsers:d}),jsxRuntime.jsx(qm,{isOpen:Ae,onClose:()=>F(false),onSave:L,isDark:x,locale:c})]})}var sp=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:120,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true}],ip=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"}],lp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var il={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"},ll={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"},dl={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"},ds={dark:il,light:ll,neutral:dl};function dp(e){return ds[e]||ds.dark}var cl={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"}},ml={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"}},cs={en:cl,es:ml};function tn(e){return cs[e]||cs.en}function ms(e,t){let a=tn(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 cp(e){let t=tn(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 mp(e,t=0,a=true){let r=tn(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 bp(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 ul(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 hp({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 vp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C,onTaskOpen:g}){let{theme:v="dark",locale:h="en",customTranslations:p}=t,k=ms(h,p),x=v==="dark",[D,T]=react.useState(r||new Date),[w,A]=react.useState(null),[I,N]=react.useState(null),[H,U]=react.useState({}),j=4,ce=3,[ee,te]=react.useState(null),[me,pe]=react.useState(""),[Ae,F]=react.useState(void 0),[R,S]=react.useState(null),[B,_]=react.useState(false),[ae,ne]=react.useState(false),[de,Me]=react.useState(null),[Z,Ye]=react.useState(false),[Te,Ke]=react.useState(new Date),Tt=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()-1,1));},[D]),Et=react.useCallback(()=>{T(new Date(D.getFullYear(),D.getMonth()+1,1));},[D]),Ze=react.useCallback(()=>{T(new Date);},[]),vt=react.useMemo(()=>{let ue=D.getFullYear(),L=D.getMonth(),se=new Date(ue,L,1),ge=new Date(ue,L+1,0),$e=se.getDay(),X=ge.getDate(),Be=bp(e),G=new Date;G.setHours(0,0,0,0);let Y=[],He=$e,Re=new Date(ue,L,0).getDate();for(let We=He-1;We>=0;We--){let le=new Date(ue,L-1,Re-We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Le=>ul(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}for(let We=1;We<=X;We++){let le=new Date(ue,L,We),Le=le.getTime()===G.getTime();Y.push({date:le,isCurrentMonth:true,isToday:Le,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Q=>ul(le,Q)).map(Q=>({id:Q.id,title:Q.name,start:Q.startDate,end:Q.endDate,task:Q}))});}let je=42-Y.length;for(let We=1;We<=je;We++){let le=new Date(ue,L+1,We);Y.push({date:le,isCurrentMonth:false,isToday:false,isWeekend:le.getDay()===0||le.getDay()===6,events:Be.filter(Le=>ul(le,Le)).map(Le=>({id:Le.id,title:Le.name,start:Le.startDate,end:Le.endDate,task:Le}))});}return Y},[D,e]),bt=h==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Gt=D.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxRuntime.jsxs("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:[k.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:f("flex-1 flex items-center justify-center",x?"bg-[#0F1117]":"bg-white",n),style:d,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsxRuntime.jsx("h3",{className:f("text-lg font-semibold mb-2",x?"text-white":"text-gray-900"),children:k.labels.noEvents}),jsxRuntime.jsx("p",{className:f("text-sm",x?"text-[#9CA3AF]":"text-gray-600"),children:k.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:f("flex-1 flex flex-col w-full h-full overflow-auto",x?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsxRuntime.jsx("div",{className:f("flex-shrink-0 px-6 py-4 border-b",x?"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:f("text-xl font-semibold capitalize",x?"text-white":"text-gray-900"),children:Gt}),jsxRuntime.jsx("button",{onClick:Ze,className:f("px-3 py-1.5 text-sm rounded-lg transition-colors",x?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:k.navigation.today})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:Tt,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:f("w-5 h-5",x?"text-[#9CA3AF]":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:Et,className:f("p-2 rounded-lg transition-colors",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:f("w-5 h-5",x?"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:bt.map(ue=>jsxRuntime.jsx("div",{className:f("py-2 text-center text-xs font-medium uppercase",x?"text-[#9CA3AF]":"text-gray-500"),children:ue},ue))}),jsxRuntime.jsx("div",{className:f("grid grid-cols-7 auto-rows-min gap-px rounded-lg",x?"bg-[#2D2D2D]":"bg-gray-300"),children:vt.map((ue,L)=>{let se=ue.date.getDay()===0||ue.date.getDay()===6;return jsxRuntime.jsxs("div",{className:f("min-h-[120px] p-2 transition-colors flex flex-col relative group",x?se?"bg-[#1C1F26]":ue.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":se?"bg-gray-100":ue.isCurrentMonth?"bg-white":"bg-gray-50",ue.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let ge=H[L]||j,$e=ue.events.slice(0,ge),X=ue.events.length-ge;return jsxRuntime.jsxs("div",{className:"space-y-1 flex-1",children:[$e.map(Be=>jsxRuntime.jsx("div",{className:"relative group",children:jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{A(Be.task),a.onEventClick?.(Be),g?.(Be.task.id);},whileHover:{scale:1.02},className:f("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Be.task.progress===100?x?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":x?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsxRuntime.jsx(hp,{task:Be.task}),jsxRuntime.jsx("span",{className:"truncate",children:Be.title})]})},Be.id)),X>0&&jsxRuntime.jsxs("button",{onClick:Be=>{Be.stopPropagation(),U(G=>({...G,[L]:ge+ce}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",h==="es"?"M\xC1S":"MORE"]}),ge>j&&ue.events.length>j&&jsxRuntime.jsx("button",{onClick:Be=>{Be.stopPropagation(),U(G=>({...G,[L]:j}));},className:f("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",x?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:h==="es"?"MENOS":"LESS"})]})})(),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let ge=L>=28,$e=L%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ee===L?te(null):(te(L),pe(""),F(void 0),S(null),Me(null),_(false),ne(false),Ye(false),Ke(ue.date));},className:f("w-5 h-5 rounded flex items-center justify-center transition-all",ee===L?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",x?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:f("w-3.5 h-3.5 transition-transform",ee===L&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ee===L&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{te(null),pe(""),F(void 0),S(null),Me(null),_(false),ne(false),Ye(false);}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:ge?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ge?-5:5,scale:.95},transition:{duration:.12},className:f("absolute w-[320px] rounded-lg shadow-2xl z-50",ge?"bottom-full mb-1":"top-full mt-1",$e?"right-0":"left-0",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),_(false),ne(false),Ye(false);},children:[jsxRuntime.jsx("div",{className:"p-2.5",children:jsxRuntime.jsx("input",{type:"text",value:me,onChange:X=>pe(X.target.value),placeholder:h==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:f("w-full bg-transparent text-sm outline-none placeholder:opacity-40",x?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&me.trim()){let Be=t.availableUsers?.find(Y=>Y.id===R),G=de||ue.date;a.onTaskCreate?.({name:me.trim(),startDate:G,endDate:G,priority:Ae,assignees:Be?[Be]:void 0}),pe(""),F(void 0),S(null),Me(null),te(null);}X.key==="Escape"&&(te(null),pe(""),F(void 0),S(null),Me(null));}})}),jsxRuntime.jsxs("div",{className:f("px-2.5 py-2 flex items-center justify-between border-t",x?"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:X=>{X.stopPropagation(),_(!B),ne(false);},className:f("p-1 rounded transition-colors",Ae?Ae==="urgent"||Ae==="high"?"text-red-400 bg-red-500/20":Ae==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":x?"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:B&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:h==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:h==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:h==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:h==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:h==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxRuntime.jsxs("button",{onClick:()=>{F(X.id),_(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",Ae===X.id&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:f("w-2 h-2 rounded-full",X.color)}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{onClick:X=>{X.stopPropagation(),Ye(!Z),_(false),ne(false),Ke(de||ue.date);},className:f("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",de?"bg-[#7C3AED]/20 text-[#7C3AED]":x?"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"}),(de||ue.date).toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Z&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsx("div",{className:f("w-40 py-2 border-r",x?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Be=new Date(X);Be.setDate(X.getDate()+1);let G=new Date(X);G.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Y=new Date(X);Y.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let He=new Date(X);He.setDate(X.getDate()+14);let Re=new Date(X);return Re.setDate(X.getDate()+28),[{label:h==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Ma\xF1ana":"Tomorrow",date:Be,display:Be.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:h==="es"?"Este fin de semana":"This weekend",date:G,display:h==="es"?"s\xE1b.":"sat."},{label:h==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:h==="es"?"lun.":"mon."},{label:h==="es"?"2 semanas":"2 weeks",date:He,display:He.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:h==="es"?"4 semanas":"4 weeks",date:Re,display:Re.toLocaleDateString(h==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((We,le)=>jsxRuntime.jsxs("button",{className:f("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",x?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{Me(We.date),Ye(false);},children:[jsxRuntime.jsx("span",{children:We.label}),jsxRuntime.jsx("span",{className:f("text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:We.display})]},le))})()}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("span",{className:f("text-xs font-medium",x?"text-white":"text-gray-900"),children:Te.toLocaleDateString(h==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>Ke(new Date),className:f("px-1.5 py-0.5 rounded text-[10px] transition-colors",x?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:h==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()-1)),className:f("p-0.5 rounded",x?"hover:bg-white/10":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:()=>Ke(new Date(Te.getFullYear(),Te.getMonth()+1)),className:f("p-0.5 rounded",x?"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:(h==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsxRuntime.jsx("div",{className:f("w-6 h-6 flex items-center justify-center text-[10px]",x?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=Te.getFullYear(),Be=Te.getMonth(),G=new Date(X,Be,1).getDay(),Y=new Date(X,Be+1,0).getDate(),He=new Date(X,Be,0).getDate(),Re=new Date,je=[];for(let le=G-1;le>=0;le--)je.push({dayNum:He-le,isCurrentMonth:false,date:new Date(X,Be-1,He-le)});for(let le=1;le<=Y;le++)je.push({dayNum:le,isCurrentMonth:true,date:new Date(X,Be,le)});let We=42-je.length;for(let le=1;le<=We;le++)je.push({dayNum:le,isCurrentMonth:false,date:new Date(X,Be+1,le)});return je.map((le,Le)=>{let Q=le.date.toDateString()===Re.toDateString(),_e=(de||ue.date).toDateString()===le.date.toDateString();return jsxRuntime.jsx("button",{className:f("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!le.isCurrentMonth&&(x?"text-[#4B5563]":"text-gray-300"),le.isCurrentMonth&&(x?"text-white":"text-gray-900"),Q&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(x?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{Me(le.date),Ye(false);},children:le.dayNum},Le)})})()})]})]})})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:X=>{X.stopPropagation(),ne(!ae),_(false);},className:f("p-1 rounded transition-colors",R?"text-[#7C3AED] bg-[#7C3AED]/20":x?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:R?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(X=>X.id===R)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===R)?.initials||t.availableUsers?.find(X=>X.id===R)?.name?.slice(0,2).toUpperCase()}):jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ae&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:f("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",x?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxRuntime.jsxs("button",{onClick:()=>{S(null),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",!R&&(x?"bg-white/5":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:f("w-5 h-5 rounded-full flex items-center justify-center",x?"bg-white/10":"bg-gray-200"),children:jsxRuntime.jsx(lucideReact.User,{className:"w-3 h-3 text-gray-400"})}),jsxRuntime.jsx("span",{className:x?"text-[#9CA3AF]":"text-gray-500",children:h==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxRuntime.jsxs("button",{onClick:()=>{S(X.id),ne(false);},className:f("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",x?"hover:bg-white/5":"hover:bg-gray-50",R===X.id&&(x?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsxRuntime.jsx("span",{className:x?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsxRuntime.jsx("div",{className:f("px-3 py-2 text-xs",x?"text-[#6B7280]":"text-gray-400"),children:h==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsxRuntime.jsx("button",{onClick:()=>{if(me.trim()){let X=t.availableUsers?.find(G=>G.id===R),Be=de||ue.date;a.onTaskCreate?.({name:me.trim(),startDate:Be,endDate:Be,priority:Ae,assignees:X?[X]:void 0}),pe(""),F(void 0),S(null),Me(null),te(null);}},disabled:!me.trim(),className:f("px-2.5 py-1 rounded text-xs font-medium transition-colors",me.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":x?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:h==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsxRuntime.jsx("span",{className:f("text-sm font-medium",ue.isToday?"text-[#3B82F6]":ue.isCurrentMonth?x?"text-white":"text-gray-900":x?"text-[#6B7280]":"text-gray-400"),children:ue.date.getDate()})]})]},L)})})]})}),jsxRuntime.jsx(mr,{task:w,isOpen:!!w,onClose:()=>A(null),onTaskUpdate:ue=>{a.onTaskUpdate?.(ue),A(ue);},theme:v==="dark"?"dark":"light",locale:h,availableUsers:t.availableUsers?.map(ue=>({id:ue.id,name:ue.name,avatar:ue.avatar,initials:ue.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:w?c?.get(w.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:bp(e).filter(ue=>ue.id!==w?.id),comments:l?.filter(ue=>ue.taskId===w?.id).map(ue=>({...ue,createdAt:ue.createdAt instanceof Date?ue.createdAt:new Date(ue.createdAt),updatedAt:ue.updatedAt instanceof Date?ue.updatedAt:ue.updatedAt?new Date(ue.updatedAt):void 0})),onAddComment:u,currentUser:b,mentionableUsers:y,onUploadCommentAttachments:C}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>N(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:f("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",x?"bg-[#1A1D25]":"bg-white"),children:[jsxRuntime.jsxs("div",{className:f("px-4 py-3 border-b flex items-center justify-between",x?"border-white/10":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:f("font-medium",x?"text-white":"text-gray-900"),children:I.date.toLocaleDateString(h==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>N(null),className:f("p-1 rounded",x?"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:I.events.map(ue=>jsxRuntime.jsxs("button",{onClick:()=>{N(null),A(ue.task),g?.(ue.task.id);},className:f("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",x?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsxRuntime.jsx(hp,{task:ue.task}),jsxRuntime.jsx("span",{className:f("text-sm truncate flex-1",x?"text-white":"text-gray-900"),children:ue.title}),ue.task.priority==="high"||ue.task.priority==="urgent"?jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},ue.id))})]})]})})]})}var gl={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"},fl={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"},bl={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"},ps={dark:gl,light:fl,neutral:bl};function xp(e){return ps[e]||ps.dark}function wv({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=react.useState(false),c=react.useMemo(()=>t.filter(b=>e.cardIds.includes(b.id)),[t,e.cardIds]),l=react.useMemo(()=>{let b=c.length,y=new Set(c.flatMap(v=>v.assignedUserIds||[])).size,C=c.map(v=>v.priority).filter(Boolean),g=new Set(c.flatMap(v=>v.labels||[])).size;return {totalCards:b,uniqueAssignees:y,priorities:C,labels:g}},[c]),u=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:f("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,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:f("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:l.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),m&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:b=>{b.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:c.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:c.map(b=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(b),children:a(b)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(b),children:[jsxRuntime.jsx("h4",{children:b.title}),b.description&&jsxRuntime.jsxs("p",{children:[b.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,b.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"})]})})]},b.id))})})]})}var wp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rn(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 on(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 Cp(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 Tp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=react.useMemo(()=>({...wp,...n}),[n]),[i,c]=react.useState(new Set),l=react.useRef(null),u=react.useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(p=>{let k=p.timestamp.toISOString().split("T")[0],x=h.get(k);x?x.push(p):h.set(k,[p]);}),Array.from(h.entries()).sort((p,k)=>k[0].localeCompare(p[0])).map(([p,k])=>({date:new Date(p),events:k.sort((x,D)=>D.timestamp.getTime()-x.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:b,uniqueTypes:y}=react.useMemo(()=>{let h=new Set,p=new Set;return e.forEach(k=>{h.add(k.userId),p.add(k.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(p)}},[e]),C=h=>{c(p=>{let k=new Set(p);return k.has(h)?k.delete(h):k.add(h),k});},g=h=>{let k=new Date().getTime()-h.getTime(),x=Math.floor(k/6e4),D=Math.floor(k/36e5),T=Math.floor(k/864e5);return x<1?"just now":x<60?`${x}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},v=react.useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return react.useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:f("history-timeline-empty",d),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:f("history-timeline",m.compact&&"compact",d),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:h=>{let p=h.target.value;a({...t,types:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(h=>jsxRuntime.jsxs("option",{value:h,children:[on(h)," ",h.replace("_"," ")]},h))]}),b.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let p=h.target.value;a({...t,users:p?[p]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),b.map(h=>jsxRuntime.jsx("option",{value:h,children:h},h))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),v>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",v,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:l,children:u.map(h=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:h.events.map((p,k)=>{let x=i.has(p.id),D=s===p.id,T=Cp(p.type);return jsxRuntime.jsxs("div",{"data-event-id":p.id,className:f("history-timeline-event",x&&"expanded",D&&"selected"),onClick:()=>o?.(p),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:on(p.type)})}),k<h.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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&&p.userAvatar&&jsxRuntime.jsx("img",{src:p.userAvatar,alt:p.userName||p.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:p.userName||p.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:rn(p)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(p.timestamp):p.timestamp.toLocaleString()})]}),Object.keys(p.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),C(p.id);},children:[x?"\u25BC":"\u25B6"," Show changes"]}),x&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(p.changes).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},w)),p.metadata&&Object.keys(p.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(p.metadata).map(([w,A])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},w))]})]})]})]},p.id)})})]},h.date?.toISOString()||"all"))})]})}function Dp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:f("history-replay-empty",i),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:f("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:l&&on(l.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:l&&rn(l)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:b=>d(parseInt(b.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((b,y)=>jsxRuntime.jsx("div",{className:f("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rn(b)},b.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,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:c.map(b=>jsxRuntime.jsxs("button",{className:f("history-replay-speed-btn",e.speed===b&&"active"),onClick:()=>m(b),children:[b,"x"]},b))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(b=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:b},b))})]})]})]})]}):jsxRuntime.jsxs("div",{className:f("history-replay-start",i),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 hl(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 yl(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 Sp(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 Ep(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ev(e,t,a,r,o,s=100){let n=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})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,u=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(u-c.y)*o.centerForce*i,n.forEach(b=>{if(c.id===b.id)return;let y=c.x-b.x,C=c.y-b.y,g=Math.sqrt(y*y+C*C)||1,v=o.chargeStrength*i/(g*g);c.vx+=y/g*v,c.vy+=C/g*v;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),u=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!u)return;let b=u.x-l.x,y=u.y-l.y,C=Math.sqrt(b*b+y*y)||1,g=(C-o.linkDistance)/C*o.forceStrength*i;l.vx+=b*g,l.vy+=y*g,u.vx-=b*g,u.vy-=y*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Pp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=react.useRef(null),[c,l]=react.useState([]),[u,b]=react.useState(null),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(1),[k,x]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let U=Ev(e,t,a.width,a.height,a,150);l(U);},[e,t,a]);let D=react.useCallback((U,j)=>{a.enableDragging&&(j.stopPropagation(),b(U));},[a.enableDragging]),T=react.useCallback(U=>{if(!u||!i.current)return;let ce=i.current.getBoundingClientRect(),ee=(U.clientX-ce.left-k.x)/h,te=(U.clientY-ce.top-k.y)/h;l(me=>me.map(pe=>pe.id===u?{...pe,x:ee,y:te,fx:ee,fy:te}:pe));},[u,h,k]),w=react.useCallback(()=>{b(null);},[]),A=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"node-click",node:U,position:{x:j.clientX,y:j.clientY}});},[d]),I=react.useCallback((U,j)=>{j.stopPropagation(),d?.({type:"edge-click",edge:U,position:{x:j.clientX,y:j.clientY}});},[d]),N=react.useCallback(U=>{let j=c.find(ce=>ce.id===U);return j?{x:j.x,y:j.y}:{x:0,y:0}},[c]),H=react.useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let j=U.card.priority;return j==="URGENT"?"#ef4444":j==="HIGH"?"#f59e0b":j==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:f("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:f("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:n.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:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(U=>Math.min(U+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>p(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{p(1),x({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:hl(U)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Sp(U)," ",yl(U)]})]},U))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:w,onMouseLeave:w,children:[jsxRuntime.jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${h})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let j=N(typeof U.source=="string"?U.source:U.source.id),ce=N(typeof U.target=="string"?U.target:U.target.id),ee=Ep(U.type),te=g===U.id,me=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-edge",te&&"hovered",me&&"critical"),onMouseEnter:()=>v(U.id),onMouseLeave:()=>v(null),onClick:pe=>I(U,pe),children:[jsxRuntime.jsx("line",{x1:j.x,y1:j.y,x2:ce.x,y2:ce.y,stroke:hl(U.type),strokeWidth:me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:te?1:.6,markerEnd:ee?"url(#arrowhead)":void 0}),a.showEdgeLabels&&te&&jsxRuntime.jsx("text",{x:(j.x+ce.x)/2,y:(j.y+ce.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:yl(U.type)})]},U.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:c.map(U=>{let j=y===U.id,ce=U.onCriticalPath;return jsxRuntime.jsxs("g",{className:f("relationships-graph-node",j&&"hovered",ce&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:ee=>D(U.id,ee),onMouseEnter:()=>C(U.id),onMouseLeave:()=>C(null),onClick:ee=>A(U,ee),children:[jsxRuntime.jsx("circle",{r:ce?a.nodeSize*1.2:a.nodeSize,fill:H(U),stroke:ce?"#fbbf24":"#ffffff",strokeWidth:ce?3:2,opacity:j?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 Ap({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[d,m]=react.useState(false),[i,c]=react.useState(null),[l,u]=react.useState(null),b=react.useRef(null),y=d||o;react.useEffect(()=>{e&&b.current&&b.current.focus();},[e]),react.useEffect(()=>{let h=p=>{p.key==="Escape"&&!y&&C();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,y]);let C=()=>{y||(n(""),c(null),u(null),t());},g=async()=>{if(!(!s.trim()||y)){m(true),c(null),u(null);try{let h=await r(s.trim());u(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},v=()=>{l&&(a(l),C());};return e?jsxRuntime.jsxs(it,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),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:h=>h.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:C,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,p)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,p)=>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:h.title}),h.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},p)),l.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:b,value:s,onChange:h=>n(h.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:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,p)=>jsxRuntime.jsx("button",{onClick:()=>n(h),disabled:y,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:h},p))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&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:C,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),l?jsxRuntime.jsx("button",{onClick: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 Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!s.trim()||y,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:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vl={"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 Mv={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Fv={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 Av(e,t,a){let r=vl[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function nn(e){return `$${e.toFixed(4)}`}var xl=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Av(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,u)=>l+u.cost,0),s=a.reduce((l,u)=>l+u.inputTokens,0),n=a.reduce((l,u)=>l+u.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,u)=>l+u.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=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)}},no=new xl;function Bp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(no.getStats()),[s,n]=react.useState(no.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(no.getStats()),n(no.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),react.useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let d=no.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:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:nn(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,i])=>{let c=r.costsByFeature[m]||0,l=r.totalOperations>0?i/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:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:nn(c)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},m)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.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:nn(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 $p({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=react.useState(""),[m,i]=react.useState(""),[c,l]=react.useState(""),[u,b]=react.useState(false),[y,C]=react.useState(null),[g,v]=react.useState(null),[h,p]=react.useState(null),k=react.useRef(null),x=u||o;react.useEffect(()=>{e&&k.current&&k.current.focus();},[e]),react.useEffect(()=>{let I=N=>{N.key==="Escape"&&!x&&D();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,x]);let D=()=>{x||(d(""),i(""),l(""),C(null),v(null),p(null),t());},T=async()=>{if(!(!n.trim()||x)){b(true),C(null),v(null),p(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});v(I.tasks.tasks),p({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){C(I instanceof Error?I.message:"Failed to generate tasks");}finally{b(false);}}},w=()=>{g&&(a(g),D());};if(!e)return null;let A=h?.similarity?((h.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:I=>I.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:x,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:g?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:[h?.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"}),h?.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 (",A,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,N)=>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:["#",N+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:k,value:n,onChange:I=>d(I.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:x}),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:I=>i(I.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:x})]}),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:c,onChange:I=>l(I.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:x})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((I,N)=>jsxRuntime.jsx("button",{onClick:()=>d(I),disabled:x,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:I},N))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:x&&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:x,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"}),g?jsxRuntime.jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:T,disabled:!n.trim()||x,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:x?"Generating...":"Generate Tasks"})]})]})]})})]})}function fs({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(g=>{t&&bn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(v,h,p)=>{console.warn(`Retry attempt ${h} after ${p}ms: ${v.message}`);}}).then(v=>{v.success||console.error(`Failed to persist board after ${v.attempts} attempts:`,v.error);});},[t]),s=react.useCallback(async(g,v,h)=>{r(p=>{let k=p.cards.find(I=>I.id===g);if(!k)return p;let x=k.columnId,D={...k,columnId:v,position:h},T=p.cards.map(I=>I.id===g?D:I),w=p.columns.map(I=>{if(I.id===x)return {...I,cardIds:I.cardIds.filter(N=>N!==g)};if(I.id===v){let N=T.filter(H=>H.columnId===v).sort((H,U)=>H.position-U.position);return {...I,cardIds:N.map(H=>H.id)}}return I}),A={...p,cards:T,columns:w};return o(A),A});},[o]),n=react.useCallback(async(g,v)=>{r(h=>{let p=h.cards.map(x=>x.id===g?{...x,...v}:x),k={...h,cards:p};return o(k),k});},[o]),d=react.useCallback(async g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v},k=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,v]}:D),x={...h,cards:[...h.cards,p],columns:k};return o(x),x});},[o]),m=react.useCallback(async g=>{r(v=>{let h=v.cards.find(D=>D.id===g);if(!h)return v;let p=v.cards.filter(D=>D.id!==g),k=v.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),x={...v,cards:p,columns:k};return o(x),x});},[o]),i=react.useCallback(async g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let p={...g,id:v,cardIds:[]},k={...h,columns:[...h.columns,p]};return o(k),k});},[o]),c=react.useCallback(async(g,v)=>{r(h=>{let p=h.columns.map(x=>x.id===g?{...x,...v}:x),k={...h,columns:p};return o(k),k});},[o]),l=react.useCallback(async g=>{r(v=>{let h=v.cards.filter(x=>x.columnId!==g),p=v.columns.filter(x=>x.id!==g),k={...v,cards:h,columns:p};return o(k),k});},[o]),u=react.useCallback(g=>{let v=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),v},[d]),b=react.useCallback(g=>{let v=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),v},[i]),y=react.useCallback(()=>{r(g=>{let v={...g,cards:[],columns:[]};return o(v),v});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:u,addColumn:b,deleteCard:m,deleteColumn:l,clearBoard:y}}}function Up({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=fs({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var sn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Wp={by:"none",order:"asc"};function Gp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...sn,...e}),[s,n]=react.useState({...Wp,...t}),d=react.useCallback(C=>{o(g=>({...g,...C}));},[]),m=react.useCallback(C=>{n(g=>({...g,...C}));},[]),i=react.useCallback(()=>{o(sn),n(Wp);},[]),c=react.useCallback(()=>{a&&o({...sn,assignees:[a]});},[a]),l=react.useCallback(()=>{o({...sn,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{o({...sn,priorities:["HIGH","URGENT"]});},[]),b=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(C=>{let g=[...C];if(r.search){let v=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(v)||h.description?.toLowerCase().includes(v));}if(r.dateFilter!=="all"){let v=new Date,h=v.getFullYear(),p=String(v.getMonth()+1).padStart(2,"0"),k=String(v.getDate()).padStart(2,"0"),x=`${h}-${p}-${k}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let w;if(typeof T=="string")w=T.split("T")[0]||T;else {let A=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),N=String(T.getUTCDate()).padStart(2,"0");w=`${A}-${I}-${N}`;}switch(r.dateFilter){case "overdue":return w<x;case "today":return w===x;case "this-week":let A=new Date(x+"T00:00:00"),I=new Date(w+"T00:00:00"),N=new Date(A);return N.setDate(N.getDate()+7),I>=A&&I<=N;case "custom":if(r.dateRange){let H=typeof T=="string"?new Date(T):T;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(v=>v.priority&&r.priorities.includes(v.priority))),r.assignees.length>0&&(g=g.filter(v=>(v.assignedUserIds||(v.assigneeId?[v.assigneeId]:[])).some(p=>r.assignees.includes(p)))),r.labels.length>0&&(g=g.filter(v=>v.labels&&v.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(v=>r.columns.includes(v.columnId))),s.by!=="none"&&g.sort((v,h)=>{let p=0;switch(s.by){case "created":let k=v.createdAt?new Date(v.createdAt).getTime():0,x=h.createdAt?new Date(h.createdAt).getTime():0;p=k-x;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[v.priority||"LOW"],w=D[h.priority||"LOW"];p=T-w;break;case "dueDate":let A=v.endDate||v.dueDate,I=h.endDate||h.dueDate;if(!A)return 1;if(!I)return -1;let N=typeof A=="string"?new Date(A).getTime():A.getTime(),H=typeof I=="string"?new Date(I).getTime():I.getTime();p=N-H;break;case "title":p=v.title.localeCompare(h.title);break;case "estimate":let U=v.estimatedTime||0,j=h.estimatedTime||0;p=U-j;break;default:p=0;}return s.order==="asc"?p:-p}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:u,applyFilters:y,hasActiveFilters:b}}var Vp,jp;if(typeof window<"u")try{let e=un("ai");Vp=e.generateObject,jp=e.generateText;}catch{}function Kp(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(Vp&&jp&&e.apiKey),n=react.useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let b=u instanceof Error?u:new Error("Failed to generate plan");throw o(b),b}finally{a(false);}},[s]),d=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let b=u instanceof Error?u:new Error("Failed to suggest assignee");throw o(b),b}finally{a(false);}},[s]),m=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let b=u instanceof Error?u:new Error("Failed to predict risks");throw o(b),b}finally{a(false);}},[s]),i=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(u){let b=u instanceof Error?u:new Error("Failed to generate subtasks");throw o(b),b}finally{a(false);}},[s]),c=react.useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(u){let b=u instanceof Error?u:new Error("Failed to estimate effort");throw o(b),b}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function wl(){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 Yp(e){let{cards:t}=e,[a,r]=wl(),o=react.useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=react.useCallback((l,u)=>{if(!u){r({selectedCardIds:[l],lastSelectedCardId:l});return}let b=u.ctrlKey||u.metaKey,y=u.shiftKey;if(b)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(C=>C!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let C=t.find(v=>v.id===l),g=t.find(v=>v.id===a.lastSelectedCardId);if(C&&g&&C.columnId===g.columnId){let v=t.filter(w=>w.columnId===C.columnId).sort((w,A)=>w.position-A.position),h=v.findIndex(w=>w.id===a.lastSelectedCardId),p=v.findIndex(w=>w.id===l),[k,x]=h<p?[h,p]:[p,h],D=v.slice(k,x+1).map(w=>w.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=react.useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(u=>u!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=react.useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=react.useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=react.useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Xp(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...qp,...a}),[a]),[s,n]=react.useState([]),d=react.useCallback((C,g,v,h,p)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:C,cardIds:g,columnId:v,strategy:h,color:p,isExpanded:true,position:s.filter(x=>x.columnId===v).length,createdAt:new Date};n(x=>[...x,k]);},[o.minCardsPerStack,s]),m=react.useCallback(C=>{n(g=>g.filter(v=>v.id!==C));},[]),i=react.useCallback(C=>{n(g=>g.map(v=>v.id===C?{...v,isExpanded:!v.isExpanded}:v));},[]),c=react.useCallback((C,g)=>{n(v=>v.map(h=>h.id===C&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=react.useCallback((C,g)=>{n(v=>v.map(h=>{if(h.id===C){let p=h.cardIds.filter(k=>k!==g);return p.length<o.minCardsPerStack?null:{...h,cardIds:p}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),u=react.useCallback(C=>s.filter(g=>g.columnId===C).sort((g,v)=>g.position-v.position),[s]),b=react.useCallback(async C=>{let g=t.filter(x=>x.columnId===C);if(g.length<o.minCardsPerStack*2)return [];let v=[],h=new Map;g.forEach(x=>{x.labels&&x.labels.length>0&&x.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(x);});}),h.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"labels",color:"#3b82f6"},reason:`${x.length} cards with label "${D}"`,confidence:.85});});let p=new Map;g.forEach(x=>{x.assignedUserIds&&x.assignedUserIds.length>0&&x.assignedUserIds.forEach(D=>{p.has(D)||p.set(D,[]),p.get(D).push(x);});}),p.forEach((x,D)=>{x.length>=o.minCardsPerStack&&v.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:x.map(T=>T.id),columnId:C,strategy:"assignee",color:"#8b5cf6"},reason:`${x.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(g.forEach(x=>{x.priority&&(k.has(x.priority)||k.set(x.priority,[]),k.get(x.priority).push(x));}),k.forEach((x,D)=>{if(x.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";v.push({stack:{title:`${T} ${D} Priority`,cardIds:x.map(w=>w.id),columnId:C,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${x.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let x of g){let T=(await r.findSimilar(x,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let w=[x.id,...T.map(I=>I.card.id)],A=T.reduce((I,N)=>I+N.similarity,0)/T.length;v.push({stack:{title:`\u2728 Similar to "${x.title.substring(0,30)}${x.title.length>30?"...":""}"`,cardIds:w,columnId:C,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:A});}}return v.filter(x=>x.confidence>=o.autoStackConfidenceThreshold).sort((x,D)=>D.confidence-x.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(C=>{d(C.stack.title,C.stack.cardIds,C.stack.columnId,C.stack.strategy,C.stack.color);},[d]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let v=await b(g),h=v[0];v.length>0&&h&&h.confidence>=.9&&y(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:u,getSuggestions:b,applySuggestion:y,config:o}}var Jp=react.createContext(null);function Zp({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=un("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=un("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=un("@libxai/core");d=new m(t.board);}r.current=new core.BoardStore({board:d,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(Jp.Provider,{value:{store:o},children:e})}function bs(){let e=react.useContext(Jp);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function dn(){let e=bs(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=react.useCallback(h=>{e.updateBoard(h);},[e]),m=react.useCallback(h=>{e.addColumn(h);},[e]),i=react.useCallback((h,p)=>{e.updateColumn(h,p);},[e]),c=react.useCallback(h=>{e.deleteColumn(h);},[e]),l=react.useCallback(h=>e.getColumn(h),[e]),u=react.useCallback(h=>{e.addCard(h);},[e]),b=react.useCallback((h,p)=>{e.updateCard(h,p);},[e]),y=react.useCallback(h=>{e.deleteCard(h);},[e]),C=react.useCallback((h,p,k)=>{e.moveCard(h,p,k);},[e]),g=react.useCallback(h=>e.getCard(h),[e]),v=react.useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:u,updateCard:b,deleteCard:y,moveCard:C,getCard:g,getCardsByColumn:v}}function eu(e){let{cards:t}=dn();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function tu(e="position",t="asc"){let{cards:a}=dn();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=m-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var hs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=td.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},qv=new hs;function ru({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=react.useRef(null),c=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},b=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:o,children:jsxRuntime.jsx("div",{style:b,children:l.map(y=>{let C=e[y.index];if(!C)return null;let g=m?m(C,y.index):y.index,v={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:v,"data-index":y.index,children:r(C,y.index)},g)})})})}function ou(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 su({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=react.useRef(null),l=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),u=l.getVirtualItems(),b={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:c,style:b,className:s,children:jsxRuntime.jsx("div",{style:y,children:u.map(C=>{let g=e[C.index];if(!g)return null;let v=m?m(g,C.index):C.index,h={position:"absolute",top:0,left:C.start,width:C.size,height:"100%"};return jsxRuntime.jsx("div",{style:h,"data-index":C.index,children:o(g,C.index)},v)})})})}function iu(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 lu(e,t=10){return e>t}var Dl={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Sl={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},El={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Pl={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ml={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Fl={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Al={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ll={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)"},Il={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)"},Bl={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Rl={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}},Ol={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}},ys={spacing:Dl,borderRadius:Sl,fontSize:El,fontWeight:Pl,lineHeight:Ml,zIndex:Fl,duration:Al,easing:Ll,shadows:Il,opacity:Bl,kanban:Rl,gantt:Ol};function du(e,t,a){return e[t]??a}function $l(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?$l(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Zv(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zl(e="asakaa"){let t=$l(ys),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Zv(o);a.push(` ${s}: ${n};`);}return `:root {
390
390
  ${a.join(`
391
391
  `)}
392
392
  }`}function cn(e,t="asakaa"){let a=[],r=$l(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {