@libxai/board 1.5.1 → 1.5.2

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.js CHANGED
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function um(e){return
410
410
  ${pm(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(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Qr(e,t){let a=pm(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 c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function bd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 g={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(g!==void 0){let y=new Date(r),b=y.getDay(),v=g-b;return v<=0&&(v+=7),y.setDate(y.getDate()+v),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 m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),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 m=parseInt(d[1],10),g=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,g,m)}let c={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 m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 m=u[l[1].toLowerCase()],g=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function hd(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 yd(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 mm(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 gm(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(),u=r[2].trim(),l=Qr(t,i),m=bd(u);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(!m)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:y},message:`Moved "${l.name}" to ${m.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(),u=o[2].trim(),l=Qr(t,i),m=hd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.name}" by ${m} days. New end date: ${g.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(),u=s[2].trim(),l=Qr(t,i),m=yd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.name}" progress to ${m}%.`,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(),u=n[2].trim(),l=Qr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,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(),u=d[2].trim(),l=Qr(t,i),m=Qr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Qr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 fm(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 Ov(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 $v(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function xi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>xi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:Ov(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 bm(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:$v(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>xi(r,e,t))}var xd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},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"}},vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},vi={en:xd,es:vd};function wd(e){return vi[e]||vi.en}function wi(e,t){let a=wd(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 kd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#007BFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#32D74B]"}];function ym(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=kd[0],u=kd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(g=>{let y=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:p("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Cd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=Cd.find(u=>u.value===e)??Cd[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Cd.map(u=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function qn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Td(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[c,i]=useState(""),u=useRef(null),l=useRef(null);useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),y=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:qn(b.name),color:b.color||Td(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):qn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=useState(false),[l,m]=useState(o),[g,y]=useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let x=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),A=new Date(D,T,1),S=new Date(D,T+1,0).getDate(),R=A.getDay(),O=[],P=new Date(D,T,0).getDate();for(let ye=R-1;ye>=0;ye--)O.push({date:new Date(D,T-1,P-ye),isCurrentMonth:false});for(let ye=1;ye<=S;ye++)O.push({date:new Date(D,T,ye),isCurrentMonth:true});let q=42-O.length;for(let ye=1;ye<=q;ye++)O.push({date:new Date(D,T+1,ye),isCurrentMonth:false});return O},[g]),h=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),u(false);else if(l==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),u(false);}},k=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let A=new Date(D);A.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let B=new Date(D);B.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let S=new Date(D);S.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let R=new Date(D);R.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:A,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:B,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:R,display:R.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let D=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:x(D)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&y(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:x(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((D,T)=>jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>h(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let A=D.date.toDateString()===new Date().toDateString(),B=v?.toDateString()===D.date.toDateString(),S=f?.toDateString()===D.date.toDateString(),R=B||S,O=!r&&v&&f&&D.date>=v&&D.date<=f;return jsx("button",{onClick:()=>h(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),A&&"ring-2 ring-[#007BFF]",B&&"bg-[#007BFF] text-white",S&&!B&&"bg-[#7C3AED] text-white",O&&!R&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Ti({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ni(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,y=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),w=Math.round(l+g*x);n(w),b===o&&(c(false),n(m));},y*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Pm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let y=Date.now();i.current=setInterval(()=>{let b=Date.now()-y,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ni(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),y=m.clientX-g.left,b=Math.round(y/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[l,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ni(e,{enabled:d&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let h=parseFloat(l);if(!isNaN(h)){let k=h;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=h=>{h.key==="Enter"?x():h.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:l,onChange:h=>m(h.target.value),onBlur:x,onKeyDown:w,onClick:h=>h.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:h=>{h.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),c=useRef(null);return useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:p("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Pm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function v2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function w2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Ro({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=useState(false),[m,g]=useState(""),y=useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:v2(e,r);useEffect(()=>{u&&y.current&&(y.current.focus(),y.current.select());},[u]),useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,u]);let w=()=>{let C=w2(m);C!==e&&(t?.(C),n&&v()),l(false);},h=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:x})]}):u?jsx("input",{ref:y,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:h,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:x})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function qm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=F=>l?`$${Math.round(F*i).toLocaleString("en-US")}`:`${F}h`,[g,y]=useState(false),[b,v]=useState(false),[f,x]=useState(null),w=useRef(null),h=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,D=Math.round(h/60*10)/10,T=Math.round(k/60*10)/10,A=Math.round(C/60*10)/10,B=k>0?h/k*100:0,S=B>100?Math.round((h-k)/60*10)/10:0,R=B>100?"#FF453A":B>=80?"#FFD60A":"#32D74B";useEffect(()=>{if(!b&&!f)return;let F=W=>{w.current&&!w.current.contains(W.target)&&(v(false),x(null));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[b,f]);let O=F=>{if(F.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){v(W=>!W),x(null);return}d&&d(e);},le=F=>{v(false),x(F);},P=async(F,W)=>{f==="log"&&r&&F?r(e,F,W):f==="estimate"&&o?o(e,F):f==="quoted"&&s&&s(e,F),x(null);},q=r||o||s||d,ye=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(F=>F.show),ze=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&h===0&&C===0?jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),children:[jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:O,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:u?"Tiempo":"Time"}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:ye.map(F=>jsxs("button",{onClick:W=>{W.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:ze||void 0,onSave:P,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(D)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),S>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(S)," ",u?"Exceso":"Over"]})]}),k>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(B,100)}%`,backgroundColor:R,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(A)})]})]}),q&&jsxs("button",{onClick:O,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsx(Plus,{className:"w-3 h-3"}),u?"Tiempo":"Time"]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:ye.map(F=>jsxs("button",{onClick:W=>{W.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:ze||void 0,onSave:P,onClose:()=>x(null)})})})})]})}function Xm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var E2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Qm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",E2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function j2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function K2(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 ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let y=useRef(null),b=r==="es"?eg.es:eg.en;if(useEffect(()=>{let h=C=>{y.current&&!y.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",h),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let h=[];return o&&h.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),h.push({id:"sep1",label:"",icon:null,separator:true}),d&&(h.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(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:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),h.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&h.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(A=>A.name===k.name)?C.filter(A=>A.name!==k.name):[...C,{name:k.name,initials:j2(k.name),color:k.color||K2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&h.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&h.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&h.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),h.push({id:"sep2",label:"",icon:null,separator:true}),s&&h.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&h.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),h},f=()=>{if(!e.columnId)return [];let h=[];return i&&(h.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),h.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(h.push({id:"sep-hide",label:"",icon:null,separator:true}),h.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),h},x=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:y,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(h=>h.separator?jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},h.id):h.submenu?jsx(Y2,{item:h,isDark:a},h.id):jsxs("button",{onClick:h.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",h.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:p(h.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:h.icon}),h.label]},h.id))})}function Y2({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var eg={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var cg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},u1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function pg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=useState(""),[u,l]=useState(null),m=useRef(null),g=d==="es"?ug.es:ug.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let h=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),D=window.innerHeight-k.top-20;l(Math.max(300,D));};return requestAnimationFrame(h),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[e]),useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let k=D=>{m.current&&!m.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(h),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let y=h=>g.columns[h]||h,b=h=>{if(h==="name")return;let k=a.map(C=>C.id===h?{...C,visible:!C.visible}:C);o(k);},v=(h,k)=>{let C=a.find(T=>T.type===h&&(!k||T.customFieldId===k));if(C){b(C.id);return}let D={id:k||h,type:h,label:k?r.find(T=>T.id===k)?.name||h:y(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,D]);},f=u1.filter(h=>y(h).toLowerCase().includes(c.toLowerCase())),x=r.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",h.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:h=>i(h.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:h=>{h&&h.style.setProperty("--focus-border",w);},onFocus:h=>{h.currentTarget.style.borderColor=w,h.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:h=>{h.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",h.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:h=>h.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(h=>{let k=a.find(T=>T.type===h&&!T.customFieldId),C=k?.visible??false,D=h==="name";return jsxs("button",{onClick:()=>{D||(k?b(k.id):v(h));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[h]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(h)})]},h)})})]}),x.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:x.map(h=>{let C=a.find(D=>D.customFieldId===h.id)?.visible??false;return jsxs("button",{onClick:()=>v(h.type,h.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[h.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:h.name})]},h.id)})})]})]})]})}var ug={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var v1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function fg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,c]=useState("text"),[i,u]=useState([""]),l=o==="es"?gg.es:gg.en;useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},y=(v,f)=>{let x=[...i];x[v]=f,u(x);},b=v=>{i.length>1&&u(i.filter((f,x)=>x!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:v1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:x=>y(f,x.target.value),placeholder:`${l.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>b(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var gg={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 yg={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 xg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?yg.es:yg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},y=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,m&&jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:l.map(g=>{let y=e===g.value&&!t,b=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:p(y?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function vg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function wg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF453A":d>=80?"#FFD60A":"#32D74B";return jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF453A]":t?"text-white/80":"text-gray-800"),children:vg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:vg(n)})]}),n>0&&jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#32D74B]/15 text-[#32D74B]",d&&"bg-[#FF453A]/15 text-[#FF453A]",!n&&!d&&"bg-[#007BFF]/15 text-[#007BFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF453A":s.utilizationPercent>=80?"#FFD60A":s.color||"#32D74B";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var B1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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 Dg(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(...Dg(r.subtasks,t+1));return a}function R1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function O1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Hd(e){if(!e.subtasks?.length)return {spent:0,allocated:0};let t=0,a=0;for(let r of e.subtasks)if(t+=r.timeLoggedMinutes??0,a+=r.effortMinutes??0,r.subtasks?.length){let o=Hd(r);t+=o.spent,a+=o.allocated;}return {spent:t,allocated:a}}function Mi(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Sg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:w=false,onCreateTask:h,persistFilter:k=false,financialBlur:C,healthSidebar:D,lens:T="hours",hourlyRate:A=0,aggregateParentHours:B=false}=t,S=wi(l,m),R=u==="dark",O=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let z=localStorage.getItem(k);if(z){let fe=JSON.parse(z);return {statusFilter:fe.statusFilter||"all",hideCompleted:fe.hideCompleted||!1}}}catch(z){console.error("Error loading persisted filter:",z);}return {statusFilter:"all",hideCompleted:false}},[k]),le=useMemo(()=>{function z(fe){let Ce=0,Ke=0;for(let qe of fe)if(qe.subtasks&&qe.subtasks.length>0){let ge=z(qe.subtasks);Ce+=ge.spent,Ke+=ge.allocated;}else Ce+=qe.timeLoggedMinutes??0,Ke+=qe.effortMinutes??0;return {spent:Ce,allocated:Ke}}return z(e)},[e]),P=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:le.spent,totalHoursAllocatedMinutes:le.allocated}},[D,le]),[q,ye]=useState(true),[ze,F]=useState("startDate"),[W,re]=useState("asc"),[ke,$]=useState(""),[X,J]=useState(()=>O().statusFilter),[pe,Be]=useState(()=>O().hideCompleted),[Ue,it]=useState(b||B1),[nt,ne]=useState(false),[ct,Re]=useState(false),[yt,ft]=useState({isOpen:false,x:0,y:0,type:"task"}),[pt,Te]=useState(null),[Xe,ot]=useState(0),[Qe,H]=useState(0),se=useRef(null);useEffect(()=>{b&&it(b);},[b]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:X,hideCompleted:pe}));}catch(z){console.error("Error persisting filter state:",z);}},[k,X,pe]);let N=useMemo(()=>{let z=new Set;function fe(Ce){for(let Ke of Ce)Ke.subtasks?.length&&(Ke.isExpanded!==false&&z.add(Ke.id),fe(Ke.subtasks));}return fe(e),z},[e]),Y=useMemo(()=>Ue.filter(z=>z.visible),[Ue]),ie=useCallback(z=>{a.onTaskToggleExpand?.(z);},[a]),he=useCallback(z=>{ze===z?re(fe=>fe==="asc"?"desc":"asc"):(F(z),re("asc")),a.onSortChange?.({column:z,direction:W==="asc"?"desc":"asc"});},[ze,W,a]),_=useCallback(z=>{it(z),a.onColumnsChange?.(z);},[a]),ee=useCallback(z=>{let fe=Ue.map(Ce=>Ce.id===z?{...Ce,visible:false}:Ce);_(fe);},[Ue,_]),_e=useCallback((z,fe)=>{F(z),re(fe);},[]),ve=useCallback((z,fe,Ce)=>{x&&(z.preventDefault(),ft({isOpen:true,x:z.clientX,y:z.clientY,type:fe?"task":"header",task:fe,columnId:Ce}));},[x]),We=useCallback(()=>{ft(z=>({...z,isOpen:false}));},[]),Pe=useCallback((z,fe)=>{if(!f)return;z.preventDefault(),z.stopPropagation();let Ce=Ue.find(Ke=>Ke.id===fe);Ce&&(Te(fe),ot(z.clientX),H(Ce.width));},[Ue,f]);useEffect(()=>{if(!pt)return;let z=Ce=>{let Ke=Ce.clientX-Xe,qe=Math.max(50,Qe+Ke),ge=Ue.map(te=>te.id===pt?{...te,width:qe}:te);it(ge);},fe=()=>{pt&&a.onColumnsChange?.(Ue),Te(null);};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe);}},[pt,Xe,Qe,Ue,a]);let He=useCallback(async z=>{if(a.onCreateCustomField){let fe={...z,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(fe);}Re(false);},[a]),lt=useCallback(z=>z.progress===100||z.status==="completed"?"completed":z.progress&&z.progress>0||z.status==="in-progress"?"in-progress":"todo",[]),st=useMemo(()=>{let z=Dg(e);if(ke.trim()){let fe=ke.toLowerCase();z=z.filter(Ce=>Ce.name.toLowerCase().includes(fe));}return X!=="all"&&(z=z.filter(fe=>lt(fe)===X)),pe&&(z=z.filter(fe=>lt(fe)!=="completed")),z.sort((fe,Ce)=>{let Ke,qe;switch(ze){case "name":Ke=fe.name.toLowerCase(),qe=Ce.name.toLowerCase();break;case "startDate":Ke=fe.startDate?.getTime()||0,qe=Ce.startDate?.getTime()||0;break;case "endDate":Ke=fe.endDate?.getTime()||0,qe=Ce.endDate?.getTime()||0;break;case "progress":Ke=fe.progress||0,qe=Ce.progress||0;break;case "status":Ke=fe.status||"todo",qe=Ce.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};Ke=ge[fe.priority]??4,qe=ge[Ce.priority]??4;break;default:return 0}return Ke<qe?W==="asc"?-1:1:Ke>qe?W==="asc"?1:-1:0}),z},[e,ke,X,pe,ze,W,lt]),dt=useCallback((z,fe)=>{let Ce=ge=>{a.onTaskUpdate?.({...z,...ge});},Ke=ge=>ge?z.customFields?.find(V=>V.fieldId===ge)?.value:void 0,qe=(ge,te)=>{if(!ge)return;let me=[...z.customFields||[]],Z=me.findIndex(L=>L.fieldId===ge);Z>=0?me[Z]={fieldId:ge,value:te}:me.push({fieldId:ge,value:te}),Ce({customFields:me});};switch(fe.type){case "name":return null;case "status":return jsx(xm,{value:z.status||(z.progress===100?"completed":z.progress&&z.progress>0?"in-progress":"todo"),onChange:te=>{Ce({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:R,locale:l,translations:S.status});case "priority":return jsx(wm,{value:z.priority,onChange:te=>Ce({priority:te}),isDark:R,locale:l});case "assignees":return jsx(Nm,{value:z.assignees||[],availableUsers:d,onChange:te=>Ce({assignees:te}),isDark:R,locale:l});case "startDate":return jsx(Ti,{value:z.startDate,onChange:te=>Ce({startDate:te}),isDark:R,locale:l,dateField:"start",startDate:z.startDate,endDate:z.endDate});case "endDate":return jsx(Ti,{value:z.endDate,onChange:te=>Ce({endDate:te}),isDark:R,locale:l,dateField:"end",startDate:z.startDate,endDate:z.endDate});case "progress":return jsx(Am,{value:z.progress||0,onChange:te=>{let V=te===100?"completed":te>0?"in-progress":"todo";Ce({progress:te,status:V});},isDark:R});case "tags":return jsx(Vm,{value:z.tags||[],isDark:R});case "text":return jsx(Bm,{value:Ke(fe.customFieldId)||"",onChange:te=>qe(fe.customFieldId,te),isDark:R});case "number":return jsx($m,{value:Ke(fe.customFieldId)||0,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "date":let ge=Ke(fe.customFieldId);return jsx(Ti,{value:ge?new Date(ge):void 0,onChange:te=>qe(fe.customFieldId,te),isDark:R,locale:l});case "dropdown":return jsx(Hm,{value:Ke(fe.customFieldId)||"",options:fe.options||[],onChange:te=>qe(fe.customFieldId,te),isDark:R});case "checkbox":return jsx(Um,{value:Ke(fe.customFieldId)||false,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "estimatedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.estimatedTime,onChange:V=>Ce({estimatedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "quotedTime":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(Ro,{value:z.quotedTime,onChange:me=>Ce({quotedTime:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:A})}case "elapsedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.elapsedTime,onChange:V=>Ce({elapsedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "effortMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.effortMinutes,onChange:V=>Ce({effortMinutes:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "timeLoggedMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.timeLoggedMinutes,onChange:a.onLogTime?V=>{a.onLogTime?.(z,V);}:void 0,isDark:R,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:A})}case "soldEffortMinutes":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(Ro,{value:z.soldEffortMinutes,onChange:me=>Ce({soldEffortMinutes:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:A})}case "scheduleVariance":return jsx(Ym,{startDate:z.startDate,endDate:z.endDate,scheduleVariance:z.scheduleVariance,isDark:R,locale:l});case "hoursBar":{if(B&&z.hasChildren){let{spent:te,allocated:V}=Hd(z),me=te>V&&V>0;return jsxs("span",{className:p("text-[11px] font-mono",R?"text-white/50":"text-gray-500"),children:[jsx("span",{className:p("font-bold",me?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Mi(te)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Mi(V)})]})}return jsx(qm,{task:z,isDark:R,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:A})}case "teamLoad":return jsx(Xm,{task:z,isDark:R});case "blockers":return jsx(Qm,{blockers:z.blockers,isDark:R,locale:l});default:return jsx("span",{className:p("text-sm",R?"text-white/60":"text-gray-500"),children:"-"})}},[a,R,l,d,S,B]),mt=useCallback(z=>{let Ce={name:S.columns.name,status:S.columns.status,priority:S.columns.priority,assignees:S.columns.assignees,startDate:S.columns.startDate,endDate:S.columns.endDate,progress:S.columns.progress,tags:S.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:S.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:S.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:S.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:S.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:S.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:S.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:S.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:S.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:S.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:S.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[z.type]||z.label;return typeof Ce=="string"?Ce:String(Ce||z.type)},[S,l]),It=useMemo(()=>{let Ce=Y.reduce((qe,ge)=>qe+ge.width,0)+(v?48:0),Ke={};for(let qe of Y)Ke[qe.id]=`${qe.width/Ce*100}%`;return Ke},[Y,v]);return r?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[S.empty.noTasks,"..."]})]})}):o?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:S.empty.noTasks}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:S.empty.addFirstTask})]})}):jsxs("div",{ref:se,className:p(R?"bg-[#0D0D0D]":"bg-white",pt&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",R?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(xg,{value:X,hideCompleted:pe,onChange:J,onHideCompletedChange:Be,isDark:R,locale:l}),jsxs("div",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[st.length," ",S.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",R?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ke,onChange:z=>$(z.target.value),placeholder:S.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",R?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),P?.enabled&&P.data&&!q&&jsx("button",{onClick:()=>ye(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",R?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:l==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&h&&jsxs(motion.button,{onClick:h,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:S.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",R?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Y.map(z=>jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2",R?"text-white/60":"text-gray-500"),style:{width:It[z.id],minWidth:z.minWidth},onContextMenu:fe=>ve(fe,void 0,z.id),children:[z.sortable?jsxs("button",{onClick:()=>he(z.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[mt(z),jsx(ArrowUpDown,{className:p("w-3 h-3",ze===z.id&&"text-[#007BFF]")})]}):jsx("span",{children:mt(z)}),f&&z.resizable&&jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",pt===z.id&&"bg-[#007BFF]"),onMouseDown:fe=>Pe(fe,z.id)})]},z.id)),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:z=>{z.stopPropagation(),ne(fe=>!fe);},className:p("p-0.5 rounded transition-colors",R?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",nt&&(R?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(pg,{isOpen:nt,onClose:()=>ne(false),columns:Ue,customFields:c,onColumnsChange:_,onCreateCustomField:()=>{ne(false),Re(true);},isDark:R,locale:l})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:st.map((z,fe)=>{let Ce=N.has(z.id),Ke=Math.min(fe*.01,.2),qe=z.hasChildren&&z.level===0,ge=z.subtasks?.length||0;return qe?jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-y cursor-pointer",R?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>ie(z.id),children:jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsx("button",{onClick:te=>{te.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")})}),Ce?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}),z.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"},children:z.wbsCode}),jsx("span",{className:p("text-xs font-bold font-mono uppercase tracking-wide truncate",R?"text-gray-200":"text-gray-800"),children:z.name}),jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",R?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",l==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),jsx("div",{className:"flex-1"}),(()=>{let te=R1(z),V=O1(z),{spent:me,allocated:Z}=Hd(z),L=me>0||Z>0,j=me>Z&&Z>0;return jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[L&&jsxs("span",{className:p("text-[10px] font-mono",R?"text-white/50":"text-gray-500"),children:["Total:"," ",jsx("span",{className:p("font-bold",j?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Mi(me)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Mi(Z)})]}),te!==null&&jsxs("span",{className:p("text-[10px] font-mono",te>=1?"text-[#32D74B]":te>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",te.toFixed(2)]}),V>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",V]}),z.progress!=null&&z.progress>0&&jsxs("span",{className:p("text-[10px] font-mono",z.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[z.progress,"%"]})]})})()]})},z.id):jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-b transition-colors",R?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(z),onDoubleClick:()=>a.onTaskDoubleClick?.(z),onContextMenu:te=>ve(te,z),children:[Y.map(te=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:It[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&z.level>0&&jsx("div",{style:{width:`${z.level*24}px`},className:"flex-shrink-0"}),y&&z.hasChildren&&jsx("button",{onClick:V=>{V.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")})}),y&&!z.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(z.wbsCode||z.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[z.wbsCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-[#007BFF]":"text-blue-600"),children:z.wbsCode}),z.taskCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-white/40":"text-gray-400"),children:z.taskCode})]}),jsx("span",{className:p("truncate font-bold text-[13px]",R?"text-white":"text-gray-900",z.progress===100&&(R?"line-through text-white/30":"line-through text-gray-400")),children:z.name}),z.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${z.tags[0].color}20`,color:z.tags[0].color},children:z.tags[0].name})]})]}):dt(z,te)},te.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},z.id)})}),st.length===0&&ke&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:p("w-12 h-12 mx-auto mb-4",R?"text-white/30":"text-gray-400")}),jsx("p",{className:p(R?"text-white/60":"text-gray-600"),children:S.empty.noResults})]})})]})}),P?.enabled&&P.data&&q&&jsx(wg,{data:P.data,isDark:R,locale:l,onClose:()=>ye(false)})]}),jsx(ag,{state:yt,onClose:We,isDark:R,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ee,onColumnSort:_e,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(fg,{isOpen:ct,onClose:()=>Re(false),onSave:He,isDark:R,locale:l})]})}var Eg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Pg=[{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"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"}],Fg=[{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 zd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},Ud={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Wd={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Ai={dark:zd,light:Ud,neutral:Wd};function Mg(e){return Ai[e]||Ai.dark}var Gd={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Vd={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Li={en:Gd,es:Vd};function Zn(e){return Li[e]||Li.en}function Ii(e,t){let a=Zn(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 Ag(e){let t=Zn(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 Lg(e,t=0,a=true){let r=Zn(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 ts(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 jd(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 Rg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Hg=26,_1=22,j1=10;function Og(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Kd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function zg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function $g(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function K1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?Kd(c.effortMinutes,n,d):null,f=m?zg(c,n,d):null,x=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${u*Hg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${_1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:l?"3px":void 0,borderLeftColor:l?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&l&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),x&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",x.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Ug({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:w,timerState:h,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:A,onDiscardTimer:B,blurFinancials:S=false,suppressDetailModal:R=false,lens:O="hours",hourlyRate:le=0}){let{theme:P="dark",locale:q="en",customTranslations:ye,showBacklog:ze=true}=t,F=Ii(q,ye),W=P==="dark"||P==="neutral",[re,ke]=useState(r||new Date),[$,X$1]=useState(null),[J,pe]=useState(null),[Be,Ue]=useState(null),[it,nt]=useState({}),ne=3,ct=3,Re=useCallback(_=>{pe(_.id),R||X$1(_),v?.(_.id);},[R,v]),[yt,ft]=useState(null),pt=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),Te=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),Xe=useCallback(()=>{ke(new Date);},[]),ot=useMemo(()=>{let _=re.getFullYear(),ee=re.getMonth(),_e=new Date(_,ee,1),ve=new Date(_,ee+1,0),We=_e.getDay(),Pe=ve.getDate(),He=ts(e),lt=new Date;lt.setHours(0,0,0,0);let st=[],dt=We,mt=new Date(_,ee,0).getDate();for(let z=dt-1;z>=0;z--){let fe=new Date(_,ee-1,mt-z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>jd(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}for(let z=1;z<=Pe;z++){let fe=new Date(_,ee,z),Ce=fe.getTime()===lt.getTime();st.push({date:fe,isCurrentMonth:true,isToday:Ce,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ke=>jd(fe,Ke)).map(Ke=>({id:Ke.id,title:Ke.name,start:Ke.startDate,end:Ke.endDate,task:Ke}))});}let It=42-st.length;for(let z=1;z<=It;z++){let fe=new Date(_,ee+1,z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>jd(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}return st},[re,e]),Qe=useMemo(()=>ts(e).filter(_=>!_.startDate||!_.endDate),[e]),H=useMemo(()=>{let _=ts(e),ee=0,_e=0,ve=0,We=0,Pe=0;_.forEach(mt=>{mt.effortMinutes&&(ee+=mt.effortMinutes),mt.soldEffortMinutes&&(_e+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ve+=mt.scheduleVariance,We++),mt.soldEffortMinutes&&mt.effortMinutes&&(Pe+=mt.soldEffortMinutes-mt.effortMinutes);});let He=_e>0?Math.min(100,Math.round(ee/_e*100)):0,lt=We>0?Math.round(ve/We):0,dt=`${Pe<0?"-":"+"}${$g(Pe,O,le)}`;return {budgetUtil:He,avgVariance:lt,costDisplay:dt,hasCostData:_e>0}},[e,O,le]),se=useMemo(()=>{let _=[0,0,0,0,0,0];return ot.forEach((ee,_e)=>{let ve=Math.floor(_e/7);ee.events.forEach(We=>{if(We.task.startDate&&We.task.soldEffortMinutes){let Pe=new Date(We.task.startDate),He=ee.date;Pe.getFullYear()===He.getFullYear()&&Pe.getMonth()===He.getMonth()&&Pe.getDate()===He.getDate()&&ve<_.length&&(_[ve]-=We.task.soldEffortMinutes);}});}),_},[ot]),N=useMemo(()=>{let _=ts(e),ee=new Map,_e=new Set,ve=[0,0,0,0,0,0];if(ot.length===0)return {segmentsByCell:ee,multiDayTaskIds:_e,maxLanesPerRow:ve};let We=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Pe=We(ot[0].date),He=We(ot[ot.length-1].date),lt=[];for(let dt of _){if(!dt.startDate||!dt.endDate)continue;let mt=We(dt.startDate),It=We(dt.endDate);if(mt.getTime()===It.getTime()||It<Pe||mt>He)continue;let z=mt<Pe?Pe:mt,fe=It>He?He:It,Ce=Og(z,Pe),Ke=Og(fe,Pe);Ce<0||Ce>41||Ke<0||Ke>41||Ce!==Ke&&(_e.add(dt.id),lt.push({task:dt,startIdx:Ce,endIdx:Ke}));}lt.sort((dt,mt)=>dt.startIdx!==mt.startIdx?dt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(dt.endIdx-dt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:dt,startIdx:mt,endIdx:It}of lt){let z=Math.floor(mt/7),fe=Math.floor(It/7),Ce=We(dt.startDate),Ke=We(dt.endDate),qe=false;for(let ge=z;ge<=fe;ge++){let te=ge===z?mt%7:0,V=ge===fe?It%7:6,me=V-te+1,Z=0,L=st[ge]??[];for(st[ge]||(st[ge]=L);Z<L.length&&(L[Z]??-1)>=te;)Z++;if(Z>=j1){qe=true;break}Z>=L.length?L.push(V):L[Z]=V,ve[ge]=Math.max(ve[ge]??0,Z+1);let j=ge===z&&Ce>=Pe,ae=ge===fe&&Ke<=He,Ne=ge*7+te,Fe={taskId:dt.id,task:dt,rowIndex:ge,startCol:te,endCol:V,spanCols:me,lane:Z,isStart:j,isEnd:ae};ee.has(Ne)||ee.set(Ne,[]),ee.get(Ne).push(Fe);}qe&&(_e.delete(dt.id),ee.forEach((ge,te)=>{let V=ge.filter(me=>me.taskId!==dt.id);V.length===0?ee.delete(te):ee.set(te,V);}));}return {segmentsByCell:ee,multiDayTaskIds:_e,maxLanesPerRow:ve}},[ot,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=re.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),he=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:p("text-sm font-mono",W?"text-white/30":"text-gray-600"),children:[F.labels.noEvents,"..."]})]})}):s?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",W?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",W?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",W?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:p("w-8 h-8",W?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:F.labels.noEvents}),jsx("p",{className:p("text-sm",W?"text-white/30":"text-gray-600"),children:F.labels.newTask})]})}):jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",W?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",W?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:p("w-3.5 h-3.5",W?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:p("font-medium",W?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:pt,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",W?"text-white":"text-gray-900"),children:he}),jsx("button",{onClick:Te,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:Xe,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",W?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:F.navigation.today})]})]}),jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(_=>jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",W?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",W?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>pe(null),children:ot.map((_,ee)=>{let _e=ee%7===6,ve=ee>=35;return jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!_e&&(W?"border-r border-[#222]":"border-r border-gray-200"),!ve&&(W?"border-b border-[#222]":"border-b border-gray-200"),W?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&W&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!W&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?W?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?W?"text-white/60":"text-gray-900":W?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let We=Math.floor(ee/7),Pe=(N.maxLanesPerRow[We]??0)*Hg,He=N.segmentsByCell.get(ee);return Pe===0&&!He?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Pe}px`,zIndex:5},children:He?.map(lt=>jsx(K1,{segment:lt,isDark:W,blurFinancials:S,isSelected:J===lt.taskId,t:F,lens:O,hourlyRate:le,onClick:()=>{Re(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let We=_.events.filter(Pe=>Pe.task.isMilestone&&!N.multiDayTaskIds.has(Pe.id));return We.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[We.slice(0,4).map(Pe=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Pe.title,onClick:He=>{He.stopPropagation(),Re(Pe.task);}},Pe.id)),We.length>4&&jsxs("span",{className:p("text-[8px] font-mono",W?"text-white/30":"text-gray-400"),children:["+",We.length-4]})]})})(),(()=>{let We=[];_.events.forEach(He=>{He.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&We.push({taskId:He.id,type:lt.type,severity:lt.severity,variance:He.task.scheduleVariance});});});let Pe=We[0];return Pe?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Pe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[F.labels.risk,": ",Pe.type,Pe.variance?` (+${Math.abs(Pe.variance)}d ${F.labels.delay})`:""]})]})}):null})(),(()=>{let We=_.events.filter(st=>!N.multiDayTaskIds.has(st.id)),Pe=it[ee]||ne,He=We.slice(0,Pe),lt=We.length-Pe;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(st=>jsxs(motion.button,{onClick:()=>{Re(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?W?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":W?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:W?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:p("flex-shrink-0 text-[9px]",st.task.isMilestone?W?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":W?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),lt>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:Pe+ct}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",q==="es"?"m\xE1s":"more"]}),Pe>ne&&We.length>ne&&jsx("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:ne}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let We=ee>=28,Pe=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:He=>{He.stopPropagation(),ft(yt===ee?null:ee);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",yt===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",W?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:p("w-3.5 h-3.5 transition-transform",yt===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:yt===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(null)}),jsx(motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",Pe?"right-0":"left-0",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),ft(null);},onCancel:()=>ft(null),availableUsers:t.availableUsers,isDark:W,locale:q==="es"?"es":"en",defaultDate:_.date,dropdownDirection:We?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let We=Math.floor(ee/7),Pe=se[We];if(!Pe||Pe===0)return null;let He=$g(Pe,O,le);return jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Pe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[F.labels.cashOut,": ",Pe<0?"-":"+",He]})})()]},ee)})})})]}),ze&&jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",W?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",W?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:F.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:p("text-[10px] font-mono tabular-nums",W?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",W?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:p("w-5 h-5",W?"text-white/20":"text-gray-400")})}),jsx("p",{className:p("text-xs font-mono",W?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(_=>jsxs("button",{onClick:()=>{Re(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",W?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",W?"bg-white/20":"bg-gray-300")}),jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",W?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),_.tags.length>3&&jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",W?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",W?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[Kd(_.effortMinutes,O,le)&&jsxs("span",{children:[F.labels.estimate,": ",Kd(_.effortMinutes,O,le)]}),(()=>{let ee=zg(_,O,le);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsx(Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(Rg,{task:_,isDark:W})]}),_.assignees&&_.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((ee,_e)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},_e))})]})]},_.id))}),a.onTaskCreate&&jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:F.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",W?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),H.hasCostData&&jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:["\u25C8 ",F.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-[10px] font-mono",W?"text-white/40":"text-gray-500"),children:F.labels.budgetUtil}),jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",W?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",W?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:F.labels.variance}),jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":W?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",F.labels.days]})]}),jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:F.labels.cost}),jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!R&&jsx(jr,{task:$,isOpen:!!$,onClose:()=>X$1(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),X$1(_);},theme:P==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:$?u?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ts(e).filter(_=>_.id!==$?.id),comments:l?.filter(_=>_.taskId===$?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:w,isTimerRunning:h?.isRunning,timerElapsedSeconds:h?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:A,onTimerDiscard:B,blurFinancials:S}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("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",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",W?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:p("font-medium text-sm",W?"text-white/90":"text-gray-900"),children:Be.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ue(null),className:p("p-1 rounded",W?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Be.events.map(_=>jsxs("button",{onClick:()=>{Ue(null),Re(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",W?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Rg,{task:_.task,isDark:W}),jsx("span",{className:p("text-sm truncate flex-1",W?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Yd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},qd={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},Xd={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Oi={dark:Yd,light:qd,neutral:Xd};function Wg(e){return Oi[e]||Oi.dark}function q1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=useMemo(()=>{let g=u.length,y=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:p("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:l.totalCards}),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"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var Vg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rs(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 os(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 _g(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 jg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=useMemo(()=>({...Vg,...n}),[n]),[i,u]=useState(new Set),l=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(w=>{let h=w.timestamp.toISOString().split("T")[0],k=x.get(h);k?k.push(w):x.set(h,[w]);}),Array.from(x.entries()).sort((w,h)=>h[0].localeCompare(w[0])).map(([w,h])=>({date:new Date(w),events:h.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let x=new Set,w=new Set;return e.forEach(h=>{x.add(h.userId),w.add(h.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(w)}},[e]),b=x=>{u(w=>{let h=new Set(w);return h.has(x)?h.delete(x):h.add(x),h});},v=x=>{let h=new Date().getTime()-x.getTime(),k=Math.floor(h/6e4),C=Math.floor(h/36e5),D=Math.floor(h/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:x.toLocaleDateString()},f=useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return useEffect(()=>{if(s&&l.current){let x=l.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:p("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:x=>{let w=x.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(x=>jsxs("option",{value:x,children:[os(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let w=x.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(x=>jsx("option",{value:x,children:x},x))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:m.map(x=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&x.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:x.events.map((w,h)=>{let k=i.has(w.id),C=s===w.id,D=_g(w.type);return jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:os(w.type)})}),h<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:rs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,A])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,A])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},T))]})]})]})]},w.id)})})]},x.date?.toISOString()||"all"))})]})}function Yg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:p("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:p("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&os(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&rs(l)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:p("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rs(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:p("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Jd(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 Qd(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 qg(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 Xg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function t5(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let y=u.x-g.x,b=u.y-g.y,v=Math.sqrt(y*y+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=y/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,y=m.y-l.y,b=Math.sqrt(g*g+y*y)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=y*v,m.vx-=g*v,m.vy-=y*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Jg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=useRef(null),[u,l]=useState([]),[m,g]=useState(null),[y,b]=useState(null),[v,f]=useState(null),[x,w]=useState(1),[h,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=t5(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let C=useCallback((O,le)=>{a.enableDragging&&(le.stopPropagation(),g(O));},[a.enableDragging]),D=useCallback(O=>{if(!m||!i.current)return;let P=i.current.getBoundingClientRect(),q=(O.clientX-P.left-h.x)/x,ye=(O.clientY-P.top-h.y)/x;l(ze=>ze.map(F=>F.id===m?{...F,x:q,y:ye,fx:q,fy:ye}:F));},[m,x,h]),T=useCallback(()=>{g(null);},[]),A=useCallback((O,le)=>{le.stopPropagation(),d?.({type:"node-click",node:O,position:{x:le.clientX,y:le.clientY}});},[d]),B=useCallback((O,le)=>{le.stopPropagation(),d?.({type:"edge-click",edge:O,position:{x:le.clientX,y:le.clientY}});},[d]),S=useCallback(O=>{let le=u.find(P=>P.id===O);return le?{x:le.x,y:le.y}:{x:0,y:0}},[u]),R=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let le=O.card.priority;return le==="URGENT"?"#ef4444":le==="HIGH"?"#f59e0b":le==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:p("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:p("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[qg(O)," ",Qd(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${h.x}, ${h.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let le=S(typeof O.source=="string"?O.source:O.source.id),P=S(typeof O.target=="string"?O.target:O.target.id),q=Xg(O.type),ye=v===O.id,ze=O.onCriticalPath;return jsxs("g",{className:p("relationships-graph-edge",ye&&"hovered",ze&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:F=>B(O,F),children:[jsx("line",{x1:le.x,y1:le.y,x2:P.x,y2:P.y,stroke:Jd(O.type),strokeWidth:ze?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ye?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ye&&jsx("text",{x:(le.x+P.x)/2,y:(le.y+P.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let le=y===O.id,P=O.onCriticalPath;return jsxs("g",{className:p("relationships-graph-node",le&&"hovered",P&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>C(O.id,q),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:q=>A(O,q),children:[jsx("circle",{r:P?a.nodeSize*1.2:a.nodeSize,fill:R(O),stroke:P?"#fbbf24":"#ffffff",strokeWidth:P?3:2,opacity:le?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function e0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,c]=useState(false),[i,u]=useState(null),[l,m]=useState(null),g=useRef(null),y=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=w=>{w.key==="Escape"&&!y&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,y]);let b=()=>{y||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||y)){c(true),u(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){u(x instanceof Error?x.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:x=>x.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((x,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((x,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:x.title}),x.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},w)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:x=>n(x.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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((x,w)=>jsx("button",{onClick:()=>n(x),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:x},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,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?jsx("button",{onClick:f,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"}):jsx("button",{onClick:v,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, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Zd={"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 r5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},o5={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 n5(e,t,a){let r=Zd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ns(e){return `$${e.toFixed(4)}`}var ec=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=n5(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,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/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(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,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)}},$o=new ec;function r0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState($o.getStats()),[s,n]=useState($o.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let d=$o.getRecentOperations(5);return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ns(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ns(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:d.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ns(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 s0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[c,i]=useState(""),[u,l]=useState(""),[m,g]=useState(false),[y,b]=useState(null),[v,f]=useState(null),[x,w]=useState(null),h=useRef(null),k=m||o;useEffect(()=>{e&&h.current&&h.current.focus();},[e]),useEffect(()=>{let B=S=>{S.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(B.tasks.tasks),w({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){b(B instanceof Error?B.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let A=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:B=>B.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[x?.mock_mode&&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"}),x?.from_cache?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)"]}):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"}),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:[x?.tokens_used||0," tokens"]}),x?.tokens_saved&&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:[x.tokens_saved," tokens saved"]}),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:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((B,S)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:B.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),B.start," \u2192 ",B.end]}),jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:h,value:n,onChange:B=>d(B.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:B=>i(B.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:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:B=>l(B.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:k})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((B,S)=>jsx("button",{onClick:()=>d(B),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:B},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:C,disabled:k,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"}),v?jsx("button",{onClick:T,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"}):jsx("button",{onClick:D,disabled:!n.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function zi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&ws(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,w)=>{console.warn(`Retry attempt ${x} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,x)=>{r(w=>{let h=w.cards.find(B=>B.id===v);if(!h)return w;let k=h.columnId,C={...h,columnId:f,position:x},D=w.cards.map(B=>B.id===v?C:B),T=w.columns.map(B=>{if(B.id===k)return {...B,cardIds:B.cardIds.filter(S=>S!==v)};if(B.id===f){let S=D.filter(R=>R.columnId===f).sort((R,O)=>R.position-O.position);return {...B,cardIds:S.map(R=>R.id)}}return B}),A={...w,cards:D,columns:T};return o(A),A});},[o]),n=useCallback(async(v,f)=>{r(x=>{let w=x.cards.map(k=>k.id===v?{...k,...f}:k),h={...x,cards:w};return o(h),h});},[o]),d=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let w={...v,id:f},h=x.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...x,cards:[...x.cards,w],columns:h};return o(k),k});},[o]),c=useCallback(async v=>{r(f=>{let x=f.cards.find(C=>C.id===v);if(!x)return f;let w=f.cards.filter(C=>C.id!==v),h=f.columns.map(C=>C.id===x.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==v)}:C),k={...f,cards:w,columns:h};return o(k),k});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let w={...v,id:f,cardIds:[]},h={...x,columns:[...x.columns,w]};return o(h),h});},[o]),u=useCallback(async(v,f)=>{r(x=>{let w=x.columns.map(k=>k.id===v?{...k,...f}:k),h={...x,columns:w};return o(h),h});},[o]),l=useCallback(async v=>{r(f=>{let x=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),h={...f,cards:x,columns:w};return o(h),h});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),y=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:y}}}function l0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=zi({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var ss={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},c0={by:"none",order:"asc"};function u0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ss,...e}),[s,n]=useState({...c0,...t}),d=useCallback(b=>{o(v=>({...v,...b}));},[]),c=useCallback(b=>{n(v=>({...v,...b}));},[]),i=useCallback(()=>{o(ss),n(c0);},[]),u=useCallback(()=>{a&&o({...ss,assignees:[a]});},[a]),l=useCallback(()=>{o({...ss,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...ss,priorities:["HIGH","URGENT"]});},[]),g=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=useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),h=String(f.getDate()).padStart(2,"0"),k=`${x}-${w}-${h}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let A=D.getUTCFullYear(),B=String(D.getUTCMonth()+1).padStart(2,"0"),S=String(D.getUTCDate()).padStart(2,"0");T=`${A}-${B}-${S}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let A=new Date(k+"T00:00:00"),B=new Date(T+"T00:00:00"),S=new Date(A);return S.setDate(S.getDate()+7),B>=A&&B<=S;case "custom":if(r.dateRange){let R=typeof D=="string"?new Date(D):D;return R>=r.dateRange.start&&R<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,x)=>{let w=0;switch(s.by){case "created":let h=f.createdAt?new Date(f.createdAt).getTime():0,k=x.createdAt?new Date(x.createdAt).getTime():0;w=h-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[f.priority||"LOW"],T=C[x.priority||"LOW"];w=D-T;break;case "dueDate":let A=f.endDate||f.dueDate,B=x.endDate||x.dueDate;if(!A)return 1;if(!B)return -1;let S=typeof A=="string"?new Date(A).getTime():A.getTime(),R=typeof B=="string"?new Date(B).getTime():B.getTime();w=S-R;break;case "title":w=f.title.localeCompare(x.title);break;case "estimate":let O=f.estimatedTime||0,le=x.estimatedTime||0;w=O-le;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var m0,g0;if(typeof window<"u")try{let e=ys("ai");m0=e.generateObject,g0=e.generateText;}catch{}function f0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(m0&&g0&&e.apiKey),n=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(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=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(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=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(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=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(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=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(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function ac(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function b0(e){let{cards:t}=e,[a,r]=ac(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,A)=>T.position-A.position),x=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[h,k]=x<w?[x,w]:[w,x],C=f.slice(h,k+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=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:c,toggleCard:i,getSelectedCards:u}}var h0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function y0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...h0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,v,f,x,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let h={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:x,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,h]);},[o.minCardsPerStack,s]),c=useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=useCallback((b,v)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(v)?{...x,cardIds:[...x.cardIds,v]}:x));},[]),l=useCallback((b,v)=>{n(f=>f.map(x=>{if(x.id===b){let w=x.cardIds.filter(h=>h!==v);return w.length<o.minCardsPerStack?null:{...x,cardIds:w}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{x.has(C)||x.set(C,[]),x.get(C).push(k);});}),x.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let h=new Map;if(v.forEach(k=>{k.priority&&(h.has(k.priority)||h.set(k.priority,[]),h.get(k.priority).push(k));}),h.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let D=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[k.id,...D.map(B=>B.card.id)],A=D.reduce((B,S)=>B+S.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:A});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),y=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),x=f[0];f.length>0&&x&&x.confidence>=.9&&y(x);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var x0=createContext(null);function v0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=ys("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=ys("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=ys("@libxai/core");d=new c(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(x0.Provider,{value:{store:o},children:e})}function Ui(){let e=useContext(x0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ls(){let e=Ui(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(x=>{e.updateBoard(x);},[e]),c=useCallback(x=>{e.addColumn(x);},[e]),i=useCallback((x,w)=>{e.updateColumn(x,w);},[e]),u=useCallback(x=>{e.deleteColumn(x);},[e]),l=useCallback(x=>e.getColumn(x),[e]),m=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,w)=>{e.updateCard(x,w);},[e]),y=useCallback(x=>{e.deleteCard(x);},[e]),b=useCallback((x,w,h)=>{e.moveCard(x,w,h);},[e]),v=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:y,moveCard:b,getCard:v,getCardsByColumn:f}}function k0(e){let{cards:t}=ls();return 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 C0(e="position",t="asc"){let{cards:a}=ls();return 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},c=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=c-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 Wi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Gc.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);}},k5=new Wi;function N0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:m,className:o,children:jsx("div",{style:g,children:l.map(y=>{let b=e[y.index];if(!b)return null;let v=c?c(b,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(b,y.index)},v)})})})}function D0(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function E0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={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 jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:y,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:x,"data-index":b.index,children:o(v,b.index)},f)})})})}function P0(e){let t=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 F0(e,t=10){return e>t}var sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ic={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},dc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mc={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)"},gc={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)"},fc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bc={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}},hc={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}},Gi={spacing:sc,borderRadius:ic,fontSize:lc,fontWeight:dc,lineHeight:cc,zIndex:uc,duration:pc,easing:mc,shadows:gc,opacity:fc,kanban:bc,gantt:hc};function M0(e,t,a){return e[t]??a}function yc(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)?yc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function N5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xc(e="asakaa"){let t=yc(Gi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=N5(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function pm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Qr(e,t){let a=pm(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 c=d.name.toLowerCase();return n.every(i=>c.includes(i))})}function bd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}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 g={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(g!==void 0){let y=new Date(r),b=y.getDay(),v=g-b;return v<=0&&(v+=7),y.setDate(y.getDate()+v),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 m=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+m):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+m),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 m=parseInt(d[1],10),g=parseInt(d[2],10)-1,y=parseInt(d[3],10);return new Date(y,g,m)}let c={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 m=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,m)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},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 m=u[l[1].toLowerCase()],g=parseInt(l[2],10),y=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(y,m,g)}return null}function hd(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 yd(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 mm(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 gm(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(),u=r[2].trim(),l=Qr(t,i),m=bd(u);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(!m)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(m);return y.setDate(y.getDate()+g),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:m,endDate:y},message:`Moved "${l.name}" to ${m.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(),u=o[2].trim(),l=Qr(t,i),m=hd(u);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!m||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(l.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:g},message:`Extended "${l.name}" by ${m} days. New end date: ${g.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(),u=s[2].trim(),l=Qr(t,i),m=yd(u);return l?m===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:m},message:`Set "${l.name}" progress to ${m}%.`,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(),u=n[2].trim(),l=Qr(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:u},message:`Renamed "${l.name}" to "${u}".`,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(),u=d[2].trim(),l=Qr(t,i),m=Qr(t,u);return l?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:l.id,dependencyTo:m.id,message:`Linked "${l.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Qr(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 fm(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 Ov(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 $v(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function xi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let l=a.find(m=>m.id===u);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>xi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let n=u=>{if(u)return typeof u=="string"?new Date(u):u},d=n(e.startDate),c=n(e.endDate),i=e.metadata?.isMilestone===true||d&&c&&Math.abs(c.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:c,progress:e.progress||0,status:Ov(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 bm(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:$v(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function hm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>xi(r,e,t))}var xd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},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"}},vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},vi={en:xd,es:vd};function wd(e){return vi[e]||vi.en}function wi(e,t){let a=wd(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 kd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#007BFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#32D74B]"}];function ym(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function xm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=ym(e),i=kd[0],u=kd.find(g=>g.value===c)??i,l=u.icon,m=g=>{switch(ym(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(l,{className:p("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:p("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(g=>{let y=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:p("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Cd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF453A]",bg:"bg-[#FF453A]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#007BFF]",bg:"bg-[#007BFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function wm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let u=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let c=Cd.find(u=>u.value===e)??Cd[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),n(!s);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:p("w-4 h-4",c.color)}),jsx("span",{className:p("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:p("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:p("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Cd.map(u=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(u.value),n(false);},className:p("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:p("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function qn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Td(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 Nm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[c,i]=useState(""),u=useRef(null),l=useRef(null);useEffect(()=>{let b=v=>{u.current&&!u.current.contains(v.target)&&(d(false),i(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&l.current&&l.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),g=b=>e.some(v=>v.name===b),y=b=>{if(a){if(g(b.name))a(e.filter(v=>v.name!==b.name));else {let v={name:b.name,initials:qn(b.name),color:b.color||Td(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,v]);}d(false),i("");}};return s||!a?e.length===0?jsx("span",{className:p("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,v)=>jsx("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>3&&jsxs("div",{className:p("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:p("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:p("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:p("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,v)=>jsx("div",{className:p("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)},`${b.name}-${v}`)),e.length>2&&jsxs("span",{className:p("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:l,type:"text",value:c,onChange:b=>i(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,v)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||qn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${b.name}-${v}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let v=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:v?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{v||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{v||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):qn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),v&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},b.id)})})]})]})}function Em({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:c}){let[i,u]=useState(false),[l,m]=useState(o),[g,y]=useState(()=>{let D=o==="start"?e:t;if(D){let T=D instanceof Date?D:new Date(D);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),v=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=T=>{b.current&&!b.current.contains(T.target)&&u(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&m(r?o:"start");},[i,r,o]);let x=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),T=g.getMonth(),A=new Date(D,T,1),S=new Date(D,T+1,0).getDate(),R=A.getDay(),O=[],P=new Date(D,T,0).getDate();for(let ye=R-1;ye>=0;ye--)O.push({date:new Date(D,T-1,P-ye),isCurrentMonth:false});for(let ye=1;ye<=S;ye++)O.push({date:new Date(D,T,ye),isCurrentMonth:true});let q=42-O.length;for(let ye=1;ye<=q;ye++)O.push({date:new Date(D,T+1,ye),isCurrentMonth:false});return O},[g]),h=D=>{if(r)o==="start"?a(D,f||void 0):a(v||void 0,D),u(false);else if(l==="start"){let T=f&&D>f?D:f;a(D,T||void 0),m("end");}else {let T=v&&D<v?D:v;a(T||void 0,D),u(false);}},k=()=>{let D=new Date,T=new Date(D);T.setDate(D.getDate()+1);let A=new Date(D);A.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let B=new Date(D);B.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let S=new Date(D);S.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let R=new Date(D);R.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:A,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:B,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:R,display:R.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let D=r&&o==="start"?v:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:x(D)})]})}let C=r&&o==="start"?v:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),u(!i);let T=o==="start"?v:f;T&&y(new Date(T.getFullYear(),T.getMonth(),1));},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:p("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm",s?"text-white/60":"text-gray-500"),children:x(C)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(false)}),jsxs("div",{className:p("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:p("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[k().map((D,T)=>jsxs("button",{className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>h(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:p("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},T)),jsx("div",{className:p("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(v||void 0,void 0):a(void 0,void 0),u(false);},className:p("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:p("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:l==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:p("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:p("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:p("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:p("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:p("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,T)=>{let A=D.date.toDateString()===new Date().toDateString(),B=v?.toDateString()===D.date.toDateString(),S=f?.toDateString()===D.date.toDateString(),R=B||S,O=!r&&v&&f&&D.date>=v&&D.date<=f;return jsx("button",{onClick:()=>h(new Date(D.date)),className:p("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),A&&"ring-2 ring-[#007BFF]",B&&"bg-[#007BFF] text-white",S&&!B&&"bg-[#7C3AED] text-white",O&&!R&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!R&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},T)})})]})]})]})]})}function Ti({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Em,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function yn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ni(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,m=e,g=m-l,y=r/o;c(true);for(let b=1;b<=o;b++){let v=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),w=Math.round(l+g*x);n(w),b===o&&(c(false),n(m));},y*b);u.current.push(v);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Pm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),d(0);let y=Date.now();i.current=setInterval(()=>{let b=Date.now()-y,v=Math.min(b/a*100,100);d(v);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),d(0);},a);},[a,e]),l=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:u,cancelChange:l}}function Am({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=yn(),{displayValue:c,isAnimating:i}=Ni(e,{enabled:o,duration:300,steps:6}),u=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),y=m.clientX-g.left,b=Math.round(y/g.width*100),v=Math.max(0,Math.min(100,b));v!==e&&(t(v),s&&d());},l=c??e;return jsxs("div",{className:p("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#32D74B]/30":"bg-[#32D74B]/20")),children:[jsx("div",{onClick:u,className:p("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:p("h-full rounded-full transition-[width]",l===100?"bg-[#32D74B]":"bg-[#007BFF]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxs("span",{className:p("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Bm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{d!==e&&t?.(d),n(false);},l=m=>{m.key==="Enter"?u():m.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:p("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:d,onChange:m=>c(m.target.value),onBlur:u,onKeyDown:l,onClick:m=>m.stopPropagation(),className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:p("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function $m({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[l,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:b}=yn(),{displayValue:v,isAnimating:f}=Ni(e,{enabled:d&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let h=parseFloat(l);if(!isNaN(h)){let k=h;o!==void 0&&(k=Math.max(o,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&b());}u(false);},w=h=>{h.key==="Enter"?x():h.key==="Escape"&&(m(e?.toString()||""),u(false));};return n||!t?jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:v!==void 0?v:r}):i?jsx("input",{ref:g,type:"number",value:l,onChange:h=>m(h.target.value),onBlur:x,onKeyDown:w,onClick:h=>h.stopPropagation(),min:o,max:s,className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:h=>{h.stopPropagation(),u(true);},className:p("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",v===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:v!==void 0?v:r})}function Hm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),c=useRef(null);return useEffect(()=>{let i=u=>{c.current&&!c.current.contains(u.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:p("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:p("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:p("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:p("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:p("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:p("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),d(false);},className:p("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function Um({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:c,startChange:i,cancelChange:u}=Pm(t,{delay:s}),l=g=>{g.stopPropagation(),!r&&t&&(o?d?u():i(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:l,disabled:r||!t,className:p("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:p("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Vm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:p("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:p("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function v2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function w2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),c=parseInt(a[2],10);return d*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Ro({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:c="hours",hourlyRate:i=0}){let[u,l]=useState(false),[m,g]=useState(""),y=useRef(null),{isFlashing:b,triggerFlash:v}=yn(),f=c==="financial"&&i>0,x=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:v2(e,r);useEffect(()=>{u&&y.current&&(y.current.focus(),y.current.select());},[u]),useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?g(`${C}h ${D}m`):C>0?g(`${C}h`):g(`${D}m`);}else g("");},[e,u]);let w=()=>{let C=w2(m);C!==e&&(t?.(C),n&&v()),l(false);},h=C=>{C.key==="Enter"?w():C.key==="Escape"&&l(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let k=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(k,{className:p("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:p("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:x})]}):u?jsx("input",{ref:y,type:"text",value:m,onChange:C=>g(C.target.value),onBlur:w,onKeyDown:h,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:p("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),l(true);},className:p("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(k,{className:p("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:x})]})}function Ym({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:p("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#007BFF"},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#32D74B"},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF453A"},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:p("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function qm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:c="hours",hourlyRate:i=0}){let u=a==="es",l=c==="financial"&&i>0,m=F=>l?`$${Math.round(F*i).toLocaleString("en-US")}`:`${F}h`,[g,y]=useState(false),[b,v]=useState(false),[f,x]=useState(null),w=useRef(null),h=e.timeLoggedMinutes||0,k=e.effortMinutes||0,C=e.soldEffortMinutes||0,D=Math.round(h/60*10)/10,T=Math.round(k/60*10)/10,A=Math.round(C/60*10)/10,B=k>0?h/k*100:0,S=B>100?Math.round((h-k)/60*10)/10:0,R=B>100?"#FF453A":B>=80?"#FFD60A":"#32D74B";useEffect(()=>{if(!b&&!f)return;let F=W=>{w.current&&!w.current.contains(W.target)&&(v(false),x(null));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[b,f]);let O=F=>{if(F.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){v(W=>!W),x(null);return}d&&d(e);},le=F=>{v(false),x(F);},P=async(F,W)=>{f==="log"&&r&&F?r(e,F,W):f==="estimate"&&o?o(e,F):f==="quoted"&&s&&s(e,F),x(null);},q=r||o||s||d,ye=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(F=>F.show),ze=f==="estimate"?k:f==="quoted"?C:void 0;return k===0&&h===0&&C===0?jsxs("div",{ref:w,className:"relative flex items-center gap-2",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),children:[jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:O,className:"px-2 py-0.5 rounded-full text-[9px] font-mono uppercase bg-[#007BFF]/15 text-[#007BFF] hover:bg-[#007BFF]/25 transition-colors",children:u?"Tiempo":"Time"}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:ye.map(F=>jsxs("button",{onClick:W=>{W.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:ze||void 0,onSave:P,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:w,className:"relative flex items-center gap-2 w-full",onClick:F=>F.stopPropagation(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(D)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),S>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF453A"},children:["+",m(S)," ",u?"Exceso":"Over"]})]}),k>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(B,100)}%`,backgroundColor:R,borderRadius:2,transition:"width 0.3s"}})}),C>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[u?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(A)})]})]}),q&&jsxs("button",{onClick:O,className:"flex-shrink-0 flex items-center gap-1 px-3 py-1.5 rounded-lg text-[11px] font-mono transition-colors",style:{border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB",color:t?"rgba(255,255,255,0.7)":"#374151"},children:[jsx(Plus,{className:"w-3 h-3"}),u?"Tiempo":"Time"]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:ye.map(F=>jsxs("button",{onClick:W=>{W.stopPropagation(),le(F.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(F.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),F.label]},F.mode))})}),jsx(AnimatePresence,{children:f&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Ir,{mode:f,locale:a,isDark:t,currentValue:ze||void 0,onSave:P,onClose:()=>x(null)})})})})]})}function Xm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:p("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF453A]/15 text-[#FF453A]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#32D74B]/15 text-[#32D74B]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:p("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:p("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:p("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var E2={critical:"bg-[#FF453A]/15 text-[#FF453A]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#007BFF]/15 text-[#007BFF]"};function Qm({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:p("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:p("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",E2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function j2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function K2(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 ag({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:l,onReportBlocker:m,onCopyTaskLink:g}){let y=useRef(null),b=r==="es"?eg.es:eg.en;if(useEffect(()=>{let h=C=>{y.current&&!y.current.contains(C.target)&&t();},k=C=>{C.key==="Escape"&&t();};return document.addEventListener("mousedown",h),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",k);}},[t]),!e.isOpen)return null;let v=()=>{if(!e.task)return [];let h=[];return o&&h.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),h.push({id:"sep1",label:"",icon:null,separator:true}),d&&(h.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(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:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),h.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),u.length>0&&h.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(k=>({id:`assign-${k.id}`,label:k.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:k.name.charAt(0).toUpperCase()}),onClick:()=>{let C=e.task.assignees||[],T=C.some(A=>A.name===k.name)?C.filter(A=>A.name!==k.name):[...C,{name:k.name,initials:j2(k.name),color:k.color||K2(k.name),avatar:k.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),l&&h.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{l(e.task),t();}}),m&&h.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&h.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),h.push({id:"sep2",label:"",icon:null,separator:true}),s&&h.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&h.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),h},f=()=>{if(!e.columnId)return [];let h=[];return i&&(h.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),h.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(h.push({id:"sep-hide",label:"",icon:null,separator:true}),h.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),h},x=e.type==="task"?v():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:y,style:w,className:p("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(h=>h.separator?jsx("div",{className:p("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},h.id):h.submenu?jsx(Y2,{item:h,isDark:a},h.id):jsxs("button",{onClick:h.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",h.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:p(h.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:h.icon}),h.label]},h.id))})}function Y2({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:p("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:p("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:p("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var eg={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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var cg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},u1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function pg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[c,i]=useState(""),[u,l]=useState(null),m=useRef(null),g=d==="es"?ug.es:ug.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let h=()=>{if(!m.current)return;let k=m.current.getBoundingClientRect(),D=window.innerHeight-k.top-20;l(Math.max(300,D));};return requestAnimationFrame(h),window.addEventListener("resize",h),()=>window.removeEventListener("resize",h)},[e]),useEffect(()=>{if(!e)return;let h=setTimeout(()=>{let k=D=>{m.current&&!m.current.contains(D.target)&&t();},C=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",C),m._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C);};},100);return ()=>{clearTimeout(h),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let y=h=>g.columns[h]||h,b=h=>{if(h==="name")return;let k=a.map(C=>C.id===h?{...C,visible:!C.visible}:C);o(k);},v=(h,k)=>{let C=a.find(T=>T.type===h&&(!k||T.customFieldId===k));if(C){b(C.id);return}let D={id:k||h,type:h,label:k?r.find(T=>T.id===k)?.name||h:y(h),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};o([...a,D]);},f=u1.filter(h=>y(h).toLowerCase().includes(c.toLowerCase())),x=r.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...u?{maxHeight:`${u}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",h.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:h=>i(h.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:h=>{h&&h.style.setProperty("--focus-border",w);},onFocus:h=>{h.currentTarget.style.borderColor=w,h.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:h=>{h.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",h.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:h=>h.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(h=>{let k=a.find(T=>T.type===h&&!T.customFieldId),C=k?.visible??false,D=h==="name";return jsxs("button",{onClick:()=>{D||(k?b(k.id):v(h));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:T=>{D||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[h]}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(h)})]},h)})})]}),x.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:x.map(h=>{let C=a.find(D=>D.customFieldId===h.id)?.visible??false;return jsxs("button",{onClick:()=>v(h.type,h.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:C?w:"transparent",border:C?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:C?`0 0 6px ${w}40`:"none"},children:C&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:C?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cg[h.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:C?500:400,color:C?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:h.name})]},h.id)})})]})]})]})}var ug={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var v1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function fg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,c]=useState("text"),[i,u]=useState([""]),l=o==="es"?gg.es:gg.en;useEffect(()=>{e&&(n(""),c("text"),u([""]));},[e]),useEffect(()=>{let v=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,t]);let m=()=>{if(!s.trim())return;let v={name:s.trim(),type:d};d==="dropdown"&&(v.options=i.filter(f=>f.trim())),a(v),t();},g=()=>{u([...i,""]);},y=(v,f)=>{let x=[...i];x[v]=f,u(x);},b=v=>{i.length>1&&u(i.filter((f,x)=>x!==v));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:p("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:p("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:p("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:p("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:p("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldName}),jsx("input",{type:"text",value:s,onChange:v=>n(v.target.value),placeholder:l.fieldNamePlaceholder,className:p("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:v1.map(v=>jsxs("button",{onClick:()=>c(v.type),className:p("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===v.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:v.icon}),jsx("span",{className:p("text-xs",d===v.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:l.types[v.type]})]},v.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:p("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((v,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:v,onChange:x=>y(f,x.target.value),placeholder:`${l.option} ${f+1}`,className:p("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>b(f),className:p("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:p("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxs("div",{className:p("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:p("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var gg={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 yg={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 xg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?yg.es:yg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-i.current<100||c.current&&!c.current.contains(b.target)&&d(false);},y=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let l=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),d(y=>!y);},className:p("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-[#222] hover:bg-white/[0.05] text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#007BFF]/20 border-[#007BFF]/50 text-[#007BFF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,m&&jsx("span",{className:p("w-2 h-2 rounded-full",o?"bg-[#007BFF]":"bg-blue-500")})]}),n&&jsxs("div",{className:p("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:p("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:p("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:l.map(g=>{let y=e===g.value&&!t,b=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:p(y?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:p("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:p("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:p("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:p("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:p("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function vg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function wg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:p("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:p("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:p("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:p("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,c=s>n&&n>0,i=c?"#FF453A":d>=80?"#FFD60A":"#32D74B";return jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:p("text-[11px] font-mono font-bold",c?"text-[#FF453A]":t?"text-white/80":"text-gray-800"),children:vg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:p("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:vg(n)})]}),n>0&&jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:i}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:p("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF453A]/15 text-[#FF453A]":"bg-[#32D74B]/15 text-[#32D74B]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:p("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#32D74B]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:p("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,c=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:p("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#32D74B]/15 text-[#32D74B]",d&&"bg-[#FF453A]/15 text-[#FF453A]",!n&&!d&&"bg-[#007BFF]/15 text-[#007BFF]"),children:c})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:p("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF453A":s.utilizationPercent>=80?"#FFD60A":s.color||"#32D74B";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:p("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:p("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var B1=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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 Dg(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(...Dg(r.subtasks,t+1));return a}function R1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(u<=0)continue;let l=(s.progress||0)/u;r+=l,o++;}return o>0?r/o:null}function O1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Hd(e){if(!e.subtasks?.length)return {spent:0,allocated:0};let t=0,a=0;for(let r of e.subtasks)if(t+=r.timeLoggedMinutes??0,a+=r.effortMinutes??0,r.subtasks?.length){let o=Hd(r);t+=o.spent,a+=o.allocated;}return {spent:t,allocated:a}}function Mi(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Sg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:c=[],toolbarRightContent:i}){let{theme:u="dark",locale:l="en",customTranslations:m,showSearch:g=true,showHierarchy:y=true,tableColumns:b,allowColumnCustomization:v=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:w=false,onCreateTask:h,persistFilter:k=false,financialBlur:C,healthSidebar:D,lens:T="hours",hourlyRate:A=0,aggregateParentHours:B=false}=t,S=wi(l,m),R=u==="dark",O=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let z=localStorage.getItem(k);if(z){let fe=JSON.parse(z);return {statusFilter:fe.statusFilter||"all",hideCompleted:fe.hideCompleted||!1}}}catch(z){console.error("Error loading persisted filter:",z);}return {statusFilter:"all",hideCompleted:false}},[k]),le=useMemo(()=>{function z(fe){let Ce=0,Ke=0;for(let qe of fe)if(qe.subtasks&&qe.subtasks.length>0){let ge=z(qe.subtasks);Ce+=ge.spent,Ke+=ge.allocated;}else Ce+=qe.timeLoggedMinutes??0,Ke+=qe.effortMinutes??0;return {spent:Ce,allocated:Ke}}return z(e)},[e]),P=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:le.spent,totalHoursAllocatedMinutes:le.allocated}},[D,le]),[q,ye]=useState(true),[ze,F]=useState("startDate"),[W,re]=useState("asc"),[ke,$]=useState(""),[X,J]=useState(()=>O().statusFilter),[pe,Be]=useState(()=>O().hideCompleted),[Ue,it]=useState(b||B1),[nt,ne]=useState(false),[ct,Re]=useState(false),[yt,ft]=useState({isOpen:false,x:0,y:0,type:"task"}),[pt,Te]=useState(null),[Xe,ot]=useState(0),[Qe,H]=useState(0),se=useRef(null);useEffect(()=>{b&&it(b);},[b]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:X,hideCompleted:pe}));}catch(z){console.error("Error persisting filter state:",z);}},[k,X,pe]);let N=useMemo(()=>{let z=new Set;function fe(Ce){for(let Ke of Ce)Ke.subtasks?.length&&(Ke.isExpanded!==false&&z.add(Ke.id),fe(Ke.subtasks));}return fe(e),z},[e]),Y=useMemo(()=>Ue.filter(z=>z.visible),[Ue]),ie=useCallback(z=>{a.onTaskToggleExpand?.(z);},[a]),he=useCallback(z=>{ze===z?re(fe=>fe==="asc"?"desc":"asc"):(F(z),re("asc")),a.onSortChange?.({column:z,direction:W==="asc"?"desc":"asc"});},[ze,W,a]),_=useCallback(z=>{it(z),a.onColumnsChange?.(z);},[a]),ee=useCallback(z=>{let fe=Ue.map(Ce=>Ce.id===z?{...Ce,visible:false}:Ce);_(fe);},[Ue,_]),_e=useCallback((z,fe)=>{F(z),re(fe);},[]),ve=useCallback((z,fe,Ce)=>{x&&(z.preventDefault(),ft({isOpen:true,x:z.clientX,y:z.clientY,type:fe?"task":"header",task:fe,columnId:Ce}));},[x]),We=useCallback(()=>{ft(z=>({...z,isOpen:false}));},[]),Pe=useCallback((z,fe)=>{if(!f)return;z.preventDefault(),z.stopPropagation();let Ce=Ue.find(Ke=>Ke.id===fe);Ce&&(Te(fe),ot(z.clientX),H(Ce.width));},[Ue,f]);useEffect(()=>{if(!pt)return;let z=Ce=>{let Ke=Ce.clientX-Xe,qe=Math.max(50,Qe+Ke),ge=Ue.map(te=>te.id===pt?{...te,width:qe}:te);it(ge);},fe=()=>{pt&&a.onColumnsChange?.(Ue),Te(null);};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",fe),()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",fe);}},[pt,Xe,Qe,Ue,a]);let He=useCallback(async z=>{if(a.onCreateCustomField){let fe={...z,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(fe);}Re(false);},[a]),lt=useCallback(z=>z.progress===100||z.status==="completed"?"completed":z.progress&&z.progress>0||z.status==="in-progress"?"in-progress":"todo",[]),st=useMemo(()=>{let z=Dg(e);if(ke.trim()){let fe=ke.toLowerCase();z=z.filter(Ce=>Ce.name.toLowerCase().includes(fe));}return X!=="all"&&(z=z.filter(fe=>lt(fe)===X)),pe&&(z=z.filter(fe=>lt(fe)!=="completed")),z.sort((fe,Ce)=>{let Ke,qe;switch(ze){case "name":Ke=fe.name.toLowerCase(),qe=Ce.name.toLowerCase();break;case "startDate":Ke=fe.startDate?.getTime()||0,qe=Ce.startDate?.getTime()||0;break;case "endDate":Ke=fe.endDate?.getTime()||0,qe=Ce.endDate?.getTime()||0;break;case "progress":Ke=fe.progress||0,qe=Ce.progress||0;break;case "status":Ke=fe.status||"todo",qe=Ce.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};Ke=ge[fe.priority]??4,qe=ge[Ce.priority]??4;break;default:return 0}return Ke<qe?W==="asc"?-1:1:Ke>qe?W==="asc"?1:-1:0}),z},[e,ke,X,pe,ze,W,lt]),dt=useCallback((z,fe)=>{let Ce=ge=>{a.onTaskUpdate?.({...z,...ge});},Ke=ge=>ge?z.customFields?.find(V=>V.fieldId===ge)?.value:void 0,qe=(ge,te)=>{if(!ge)return;let me=[...z.customFields||[]],Z=me.findIndex(L=>L.fieldId===ge);Z>=0?me[Z]={fieldId:ge,value:te}:me.push({fieldId:ge,value:te}),Ce({customFields:me});};switch(fe.type){case "name":return null;case "status":return jsx(xm,{value:z.status||(z.progress===100?"completed":z.progress&&z.progress>0?"in-progress":"todo"),onChange:te=>{Ce({status:te,progress:te==="completed"?100:te==="in-progress"?50:0});},isDark:R,locale:l,translations:S.status});case "priority":return jsx(wm,{value:z.priority,onChange:te=>Ce({priority:te}),isDark:R,locale:l});case "assignees":return jsx(Nm,{value:z.assignees||[],availableUsers:d,onChange:te=>Ce({assignees:te}),isDark:R,locale:l});case "startDate":return jsx(Ti,{value:z.startDate,onChange:te=>Ce({startDate:te}),isDark:R,locale:l,dateField:"start",startDate:z.startDate,endDate:z.endDate});case "endDate":return jsx(Ti,{value:z.endDate,onChange:te=>Ce({endDate:te}),isDark:R,locale:l,dateField:"end",startDate:z.startDate,endDate:z.endDate});case "progress":return jsx(Am,{value:z.progress||0,onChange:te=>{let V=te===100?"completed":te>0?"in-progress":"todo";Ce({progress:te,status:V});},isDark:R});case "tags":return jsx(Vm,{value:z.tags||[],isDark:R});case "text":return jsx(Bm,{value:Ke(fe.customFieldId)||"",onChange:te=>qe(fe.customFieldId,te),isDark:R});case "number":return jsx($m,{value:Ke(fe.customFieldId)||0,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "date":let ge=Ke(fe.customFieldId);return jsx(Ti,{value:ge?new Date(ge):void 0,onChange:te=>qe(fe.customFieldId,te),isDark:R,locale:l});case "dropdown":return jsx(Hm,{value:Ke(fe.customFieldId)||"",options:fe.options||[],onChange:te=>qe(fe.customFieldId,te),isDark:R});case "checkbox":return jsx(Um,{value:Ke(fe.customFieldId)||false,onChange:te=>qe(fe.customFieldId,te),isDark:R});case "estimatedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.estimatedTime,onChange:V=>Ce({estimatedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "quotedTime":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("quotedTime"));return jsx(Ro,{value:z.quotedTime,onChange:me=>Ce({quotedTime:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:A})}case "elapsedTime":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.elapsedTime,onChange:V=>Ce({elapsedTime:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "effortMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.effortMinutes,onChange:V=>Ce({effortMinutes:V}),isDark:R,locale:l,disabled:te,lens:T,hourlyRate:A})}case "timeLoggedMinutes":{let te=z.status==="completed"||z.progress===100;return jsx(Ro,{value:z.timeLoggedMinutes,onChange:a.onLogTime?V=>{a.onLogTime?.(z,V);}:void 0,isDark:R,locale:l,placeholder:l==="es"?"Agregar":"Add",disabled:te,lens:T,hourlyRate:A})}case "soldEffortMinutes":{let te=z.status==="completed"||z.progress===100,V=C?.enabled&&(!C.columns||C.columns.includes("soldEffortMinutes"));return jsx(Ro,{value:z.soldEffortMinutes,onChange:me=>Ce({soldEffortMinutes:me}),isDark:R,locale:l,disabled:te,isBlurred:V,lens:T,hourlyRate:A})}case "scheduleVariance":return jsx(Ym,{startDate:z.startDate,endDate:z.endDate,scheduleVariance:z.scheduleVariance,isDark:R,locale:l});case "hoursBar":{if(B&&z.hasChildren){let{spent:te,allocated:V}=Hd(z),me=te>V&&V>0;return jsxs("span",{className:p("text-[11px] font-mono",R?"text-white/50":"text-gray-500"),children:[jsx("span",{className:p("font-bold",me?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Mi(te)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Mi(V)})]})}return jsx(qm,{task:z,isDark:R,locale:l,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:A})}case "teamLoad":return jsx(Xm,{task:z,isDark:R});case "blockers":return jsx(Qm,{blockers:z.blockers,isDark:R,locale:l});default:return jsx("span",{className:p("text-sm",R?"text-white/60":"text-gray-500"),children:"-"})}},[a,R,l,d,S,B]),mt=useCallback(z=>{let Ce={name:S.columns.name,status:S.columns.status,priority:S.columns.priority,assignees:S.columns.assignees,startDate:S.columns.startDate,endDate:S.columns.endDate,progress:S.columns.progress,tags:S.columns.tags||(l==="es"?"Etiquetas":"Tags"),estimatedTime:S.columns.estimatedTime||(l==="es"?"Estimado":"Estimated"),quotedTime:S.columns.quotedTime||(l==="es"?"Ofertado":"Quoted"),elapsedTime:S.columns.elapsedTime||(l==="es"?"Tiempo":"Time Spent"),effortMinutes:S.columns.effortMinutes||(l==="es"?"Estimado":"Estimated"),timeLoggedMinutes:S.columns.timeLoggedMinutes||(l==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:S.columns.soldEffortMinutes||(l==="es"?"Ofertado":"Quoted"),scheduleVariance:S.columns.scheduleVariance||(l==="es"?"Prog / Var":"Sched / Var"),hoursBar:S.columns.hoursBar||(l==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:S.columns.teamLoad||(l==="es"?"Carga Equipo":"Team Load"),blockers:S.columns.blockers||(l==="es"?"Bloqueantes":"Blockers")}[z.type]||z.label;return typeof Ce=="string"?Ce:String(Ce||z.type)},[S,l]),It=useMemo(()=>{let Ce=Y.reduce((qe,ge)=>qe+ge.width,0)+(v?48:0),Ke={};for(let qe of Y)Ke[qe.id]=`${qe.width/Ce*100}%`;return Ke},[Y,v]);return r?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[S.empty.noTasks,"..."]})]})}):o?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",R?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:p("text-lg font-semibold mb-2",R?"text-white":"text-gray-900"),children:S.empty.noTasks}),jsx("p",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:S.empty.addFirstTask})]})}):jsxs("div",{ref:se,className:p(R?"bg-[#0D0D0D]":"bg-white",pt&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:p("flex-shrink-0 px-6 py-4 border-b",R?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(xg,{value:X,hideCompleted:pe,onChange:J,onHideCompletedChange:Be,isDark:R,locale:l}),jsxs("div",{className:p("text-sm",R?"text-white/60":"text-gray-600"),children:[st.length," ",S.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:p("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",R?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ke,onChange:z=>$(z.target.value),placeholder:S.toolbar.searchPlaceholder,className:p("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",R?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),P?.enabled&&P.data&&!q&&jsx("button",{onClick:()=>ye(true),className:p("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",R?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:l==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),w&&h&&jsxs(motion.button,{onClick:h,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:S.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:p("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",R?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Y.map(z=>jsxs("div",{className:p("relative flex items-center gap-2 px-4 py-2",R?"text-white/60":"text-gray-500"),style:{width:It[z.id],minWidth:z.minWidth},onContextMenu:fe=>ve(fe,void 0,z.id),children:[z.sortable?jsxs("button",{onClick:()=>he(z.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[mt(z),jsx(ArrowUpDown,{className:p("w-3 h-3",ze===z.id&&"text-[#007BFF]")})]}):jsx("span",{children:mt(z)}),f&&z.resizable&&jsx("div",{className:p("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",pt===z.id&&"bg-[#007BFF]"),onMouseDown:fe=>Pe(fe,z.id)})]},z.id)),v&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:z=>{z.stopPropagation(),ne(fe=>!fe);},className:p("p-0.5 rounded transition-colors",R?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",nt&&(R?"bg-white/[0.05]":"bg-gray-200")),title:l==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(pg,{isOpen:nt,onClose:()=>ne(false),columns:Ue,customFields:c,onColumnsChange:_,onCreateCustomField:()=>{ne(false),Re(true);},isDark:R,locale:l})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:st.map((z,fe)=>{let Ce=N.has(z.id),Ke=Math.min(fe*.01,.2),qe=z.hasChildren&&z.level===0,ge=z.subtasks?.length||0;return qe?jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-y cursor-pointer",R?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>ie(z.id),children:jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 w-full",children:[jsx("button",{onClick:te=>{te.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/40":"text-gray-500")})}),Ce?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"}}),z.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:R?"#FFD60A":"#B45309"},children:z.wbsCode}),jsx("span",{className:p("text-[10px] font-semibold font-mono uppercase tracking-wide truncate",R?"text-gray-200":"text-gray-800"),children:z.name}),jsxs("span",{className:p("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",R?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",l==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),jsx("div",{className:"flex-1"}),(()=>{let te=R1(z),V=O1(z),{spent:me,allocated:Z}=Hd(z),L=me>0||Z>0,j=me>Z&&Z>0;return jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[L&&jsxs("span",{className:p("text-[10px] font-mono",R?"text-white/50":"text-gray-500"),children:["Total:"," ",jsx("span",{className:p("font-bold",j?"text-[#FF453A]":R?"text-white/80":"text-gray-800"),children:Mi(me)})," / ",jsx("span",{className:R?"text-white/60":"text-gray-600",children:Mi(Z)})]}),te!==null&&jsxs("span",{className:p("text-[10px] font-mono",te>=1?"text-[#32D74B]":te>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",te.toFixed(2)]}),V>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A]",children:[l==="es"?"Conflicto Recurso":"Resource Conflict",": ",V]}),z.progress!=null&&z.progress>0&&jsxs("span",{className:p("text-[10px] font-mono",z.progress===100?"text-[#32D74B]":"text-[#007BFF]"),children:[z.progress,"%"]})]})})()]})},z.id):jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ke},className:p("flex items-center border-b transition-colors",R?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(z),onDoubleClick:()=>a.onTaskDoubleClick?.(z),onContextMenu:te=>ve(te,z),children:[Y.map(te=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:It[te.id],minWidth:te.minWidth},children:te.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&z.level>0&&jsx("div",{style:{width:`${z.level*24}px`},className:"flex-shrink-0"}),y&&z.hasChildren&&jsx("button",{onClick:V=>{V.stopPropagation(),ie(z.id);},className:p("p-0.5 rounded flex-shrink-0",R?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Ce?jsx(ChevronDown,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:p("w-4 h-4",R?"text-white/60":"text-gray-400")})}),y&&!z.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(z.wbsCode||z.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[z.wbsCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-[#007BFF]":"text-blue-600"),children:z.wbsCode}),z.taskCode&&jsx("span",{className:p("text-[10px] font-mono",R?"text-white/40":"text-gray-400"),children:z.taskCode})]}),jsx("span",{className:p("truncate font-bold text-[13px]",R?"text-white":"text-gray-900",z.progress===100&&(R?"line-through text-white/30":"line-through text-gray-400")),children:z.name}),z.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${z.tags[0].color}20`,color:z.tags[0].color},children:z.tags[0].name})]})]}):dt(z,te)},te.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},z.id)})}),st.length===0&&ke&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:p("w-12 h-12 mx-auto mb-4",R?"text-white/30":"text-gray-400")}),jsx("p",{className:p(R?"text-white/60":"text-gray-600"),children:S.empty.noResults})]})})]})}),P?.enabled&&P.data&&q&&jsx(wg,{data:P.data,isDark:R,locale:l,onClose:()=>ye(false)})]}),jsx(ag,{state:yt,onClose:We,isDark:R,locale:l,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ee,onColumnSort:_e,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(fg,{isOpen:ct,onClose:()=>Re(false),onSave:He,isDark:R,locale:l})]})}var Eg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,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},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Pg=[{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"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"}],Fg=[{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 zd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF453A",neonGreen:"#32D74B",neonAmber:"#FFD60A",neonBlue:"#0A84FF"},Ud={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Wd={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Ai={dark:zd,light:Ud,neutral:Wd};function Mg(e){return Ai[e]||Ai.dark}var Gd={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Vd={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Li={en:Gd,es:Vd};function Zn(e){return Li[e]||Li.en}function Ii(e,t){let a=Zn(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 Ag(e){let t=Zn(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 Lg(e,t=0,a=true){let r=Zn(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 ts(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 jd(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 Rg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:p("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Hg=26,_1=22,j1=10;function Og(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Kd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function zg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function $g(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function K1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:c,spanCols:i,lane:u,isStart:l,isEnd:m}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,b=l&&m?"rounded":l?"rounded-l":m?"rounded-r":"",v=m?Kd(c.effortMinutes,n,d):null,f=m?zg(c,n,d):null,x=m?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:p("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${u*Hg}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${_1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:l?"3px":void 0,borderLeftColor:l?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&l&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),m&&(v||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[v&&jsxs("span",{children:[s.labels.estimate,": ",v]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:p(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),x&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",x.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function Ug({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:c=[],onCreateTag:i,attachmentsByTask:u,comments:l,onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,onTaskOpen:v,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:w,timerState:h,onLogTime:k,onUpdateEstimate:C,onUpdateSoldEffort:D,onStartTimer:T,onStopTimer:A,onDiscardTimer:B,blurFinancials:S=false,suppressDetailModal:R=false,lens:O="hours",hourlyRate:le=0}){let{theme:P="dark",locale:q="en",customTranslations:ye,showBacklog:ze=true}=t,F=Ii(q,ye),W=P==="dark"||P==="neutral",[re,ke]=useState(r||new Date),[$,X$1]=useState(null),[J,pe]=useState(null),[Be,Ue]=useState(null),[it,nt]=useState({}),ne=3,ct=3,Re=useCallback(_=>{pe(_.id),R||X$1(_),v?.(_.id);},[R,v]),[yt,ft]=useState(null),pt=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),Te=useCallback(()=>{ke(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),Xe=useCallback(()=>{ke(new Date);},[]),ot=useMemo(()=>{let _=re.getFullYear(),ee=re.getMonth(),_e=new Date(_,ee,1),ve=new Date(_,ee+1,0),We=_e.getDay(),Pe=ve.getDate(),He=ts(e),lt=new Date;lt.setHours(0,0,0,0);let st=[],dt=We,mt=new Date(_,ee,0).getDate();for(let z=dt-1;z>=0;z--){let fe=new Date(_,ee-1,mt-z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>jd(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}for(let z=1;z<=Pe;z++){let fe=new Date(_,ee,z),Ce=fe.getTime()===lt.getTime();st.push({date:fe,isCurrentMonth:true,isToday:Ce,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ke=>jd(fe,Ke)).map(Ke=>({id:Ke.id,title:Ke.name,start:Ke.startDate,end:Ke.endDate,task:Ke}))});}let It=42-st.length;for(let z=1;z<=It;z++){let fe=new Date(_,ee+1,z);st.push({date:fe,isCurrentMonth:false,isToday:false,isWeekend:fe.getDay()===0||fe.getDay()===6,events:He.filter(Ce=>jd(fe,Ce)).map(Ce=>({id:Ce.id,title:Ce.name,start:Ce.startDate,end:Ce.endDate,task:Ce}))});}return st},[re,e]),Qe=useMemo(()=>ts(e).filter(_=>!_.startDate||!_.endDate),[e]),H=useMemo(()=>{let _=ts(e),ee=0,_e=0,ve=0,We=0,Pe=0;_.forEach(mt=>{mt.effortMinutes&&(ee+=mt.effortMinutes),mt.soldEffortMinutes&&(_e+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ve+=mt.scheduleVariance,We++),mt.soldEffortMinutes&&mt.effortMinutes&&(Pe+=mt.soldEffortMinutes-mt.effortMinutes);});let He=_e>0?Math.min(100,Math.round(ee/_e*100)):0,lt=We>0?Math.round(ve/We):0,dt=`${Pe<0?"-":"+"}${$g(Pe,O,le)}`;return {budgetUtil:He,avgVariance:lt,costDisplay:dt,hasCostData:_e>0}},[e,O,le]),se=useMemo(()=>{let _=[0,0,0,0,0,0];return ot.forEach((ee,_e)=>{let ve=Math.floor(_e/7);ee.events.forEach(We=>{if(We.task.startDate&&We.task.soldEffortMinutes){let Pe=new Date(We.task.startDate),He=ee.date;Pe.getFullYear()===He.getFullYear()&&Pe.getMonth()===He.getMonth()&&Pe.getDate()===He.getDate()&&ve<_.length&&(_[ve]-=We.task.soldEffortMinutes);}});}),_},[ot]),N=useMemo(()=>{let _=ts(e),ee=new Map,_e=new Set,ve=[0,0,0,0,0,0];if(ot.length===0)return {segmentsByCell:ee,multiDayTaskIds:_e,maxLanesPerRow:ve};let We=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Pe=We(ot[0].date),He=We(ot[ot.length-1].date),lt=[];for(let dt of _){if(!dt.startDate||!dt.endDate)continue;let mt=We(dt.startDate),It=We(dt.endDate);if(mt.getTime()===It.getTime()||It<Pe||mt>He)continue;let z=mt<Pe?Pe:mt,fe=It>He?He:It,Ce=Og(z,Pe),Ke=Og(fe,Pe);Ce<0||Ce>41||Ke<0||Ke>41||Ce!==Ke&&(_e.add(dt.id),lt.push({task:dt,startIdx:Ce,endIdx:Ke}));}lt.sort((dt,mt)=>dt.startIdx!==mt.startIdx?dt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(dt.endIdx-dt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:dt,startIdx:mt,endIdx:It}of lt){let z=Math.floor(mt/7),fe=Math.floor(It/7),Ce=We(dt.startDate),Ke=We(dt.endDate),qe=false;for(let ge=z;ge<=fe;ge++){let te=ge===z?mt%7:0,V=ge===fe?It%7:6,me=V-te+1,Z=0,L=st[ge]??[];for(st[ge]||(st[ge]=L);Z<L.length&&(L[Z]??-1)>=te;)Z++;if(Z>=j1){qe=true;break}Z>=L.length?L.push(V):L[Z]=V,ve[ge]=Math.max(ve[ge]??0,Z+1);let j=ge===z&&Ce>=Pe,ae=ge===fe&&Ke<=He,Ne=ge*7+te,Fe={taskId:dt.id,task:dt,rowIndex:ge,startCol:te,endCol:V,spanCols:me,lane:Z,isStart:j,isEnd:ae};ee.has(Ne)||ee.set(Ne,[]),ee.get(Ne).push(Fe);}qe&&(_e.delete(dt.id),ee.forEach((ge,te)=>{let V=ge.filter(me=>me.taskId!==dt.id);V.length===0?ee.delete(te):ee.set(te,V);}));}return {segmentsByCell:ee,multiDayTaskIds:_e,maxLanesPerRow:ve}},[ot,e]),Y=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ie=re.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),he=ie.charAt(0).toUpperCase()+ie.slice(1);return o?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:p("text-sm font-mono",W?"text-white/30":"text-gray-600"),children:[F.labels.noEvents,"..."]})]})}):s?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:p("w-12 h-12 rounded-full flex items-center justify-center",W?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:p("text-sm",W?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:p("flex-1 flex items-center justify-center",W?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:p("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",W?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:p("w-8 h-8",W?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:p("text-lg font-semibold mb-2",W?"text-white/90":"text-gray-900"),children:F.labels.noEvents}),jsx("p",{className:p("text-sm",W?"text-white/30":"text-gray-600"),children:F.labels.newTask})]})}):jsxs("div",{className:p("flex-1 flex flex-col w-full h-full overflow-hidden",W?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:p("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:p("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",W?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:p("w-3.5 h-3.5",W?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:p("font-medium",W?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:pt,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:p("text-sm font-semibold tracking-tight min-w-[150px] text-center",W?"text-white":"text-gray-900"),children:he}),jsx("button",{onClick:Te,className:p("w-6 h-6 flex items-center justify-center rounded transition-colors",W?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:p("h-4 w-px",W?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:Xe,className:p("px-2.5 py-1 text-xs rounded-md transition-all font-medium",W?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:F.navigation.today})]})]}),jsx("div",{className:p("grid grid-cols-7 sticky top-0 z-10",W?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:Y.map(_=>jsx("div",{className:p("py-2 text-center text-[10px] font-bold uppercase tracking-widest",W?"text-white/60 font-mono":"text-gray-500"),children:_},_))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:p("grid grid-cols-7 min-h-[800px]",W?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>pe(null),children:ot.map((_,ee)=>{let _e=ee%7===6,ve=ee>=35;return jsxs("div",{className:p("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!_e&&(W?"border-r border-[#222]":"border-r border-gray-200"),!ve&&(W?"border-b border-[#222]":"border-b border-gray-200"),W?_.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":_.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",_.isToday&&W&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",_.isToday&&!W&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:p("text-xs font-mono select-none relative z-20",_.isToday?W?"text-[#007FFF] font-bold":"text-blue-600 font-bold":_.isCurrentMonth?W?"text-white/60":"text-gray-900":W?"text-white/20":"text-gray-400"),children:String(_.date.getDate()).padStart(2,"0")}),(()=>{let We=Math.floor(ee/7),Pe=(N.maxLanesPerRow[We]??0)*Hg,He=N.segmentsByCell.get(ee);return Pe===0&&!He?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Pe}px`,zIndex:5},children:He?.map(lt=>jsx(K1,{segment:lt,isDark:W,blurFinancials:S,isSelected:J===lt.taskId,t:F,lens:O,hourlyRate:le,onClick:()=>{Re(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let We=_.events.filter(Pe=>Pe.task.isMilestone&&!N.multiDayTaskIds.has(Pe.id));return We.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[We.slice(0,4).map(Pe=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Pe.title,onClick:He=>{He.stopPropagation(),Re(Pe.task);}},Pe.id)),We.length>4&&jsxs("span",{className:p("text-[8px] font-mono",W?"text-white/30":"text-gray-400"),children:["+",We.length-4]})]})})(),(()=>{let We=[];_.events.forEach(He=>{He.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&We.push({taskId:He.id,type:lt.type,severity:lt.severity,variance:He.task.scheduleVariance});});});let Pe=We[0];return Pe?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:p("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Pe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[F.labels.risk,": ",Pe.type,Pe.variance?` (+${Math.abs(Pe.variance)}d ${F.labels.delay})`:""]})]})}):null})(),(()=>{let We=_.events.filter(st=>!N.multiDayTaskIds.has(st.id)),Pe=it[ee]||ne,He=We.slice(0,Pe),lt=We.length-Pe;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[He.map(st=>jsxs(motion.button,{onClick:()=>{Re(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:p("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?W?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":W?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:W?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:p("flex-shrink-0 text-[9px]",st.task.isMilestone?W?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":W?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),lt>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:Pe+ct}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",q==="es"?"m\xE1s":"more"]}),Pe>ne&&We.length>ne&&jsx("button",{onClick:st=>{st.stopPropagation(),nt(dt=>({...dt,[ee]:ne}));},className:p("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",W?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),_.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let We=ee>=28,Pe=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:He=>{He.stopPropagation(),ft(yt===ee?null:ee);},className:p("w-5 h-5 rounded flex items-center justify-center transition-all",yt===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",W?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:p("w-3.5 h-3.5 transition-transform",yt===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:yt===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ft(null)}),jsx(motion.div,{initial:{opacity:0,y:We?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:We?-5:5,scale:.95},transition:{duration:.12},className:p("absolute w-[320px] rounded-lg shadow-2xl z-50",We?"bottom-full mb-1":"top-full mt-1",Pe?"right-0":"left-0",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Eo,{onSubmit:He=>{a.onTaskCreate?.({name:He.name,startDate:He.startDate||_.date,endDate:He.endDate||_.date,priority:He.priority,assignees:He.assignee?[He.assignee]:void 0}),ft(null);},onCancel:()=>ft(null),availableUsers:t.availableUsers,isDark:W,locale:q==="es"?"es":"en",defaultDate:_.date,dropdownDirection:We?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let We=Math.floor(ee/7),Pe=se[We];if(!Pe||Pe===0)return null;let He=$g(Pe,O,le);return jsxs("div",{className:p("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Pe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[F.labels.cashOut,": ",Pe<0?"-":"+",He]})})()]},ee)})})})]}),ze&&jsxs("aside",{className:p("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",W?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:p("flex-shrink-0 h-14 flex items-center justify-between px-4",W?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:F.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:p("text-[10px] font-mono tabular-nums",W?"text-white/20":"text-gray-400"),children:Qe.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Qe.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center mb-3",W?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:p("w-5 h-5",W?"text-white/20":"text-gray-400")})}),jsx("p",{className:p("text-xs font-mono",W?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Qe.map(_=>jsxs("button",{onClick:()=>{Re(_);},className:p("w-full text-left rounded-md p-3 transition-all group/card",W?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:p("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",W?"bg-white/20":"bg-gray-300")}),jsx("span",{className:p("text-sm font-medium leading-snug line-clamp-2",W?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:_.name})]}),_.tags&&_.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[_.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),_.tags.length>3&&jsxs("span",{className:p("text-[9px] font-mono px-1 py-0.5",W?"text-white/20":"text-gray-400"),children:["+",_.tags.length-3]})]}),(_.effortMinutes||_.soldEffortMinutes)&&jsxs("div",{className:p("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",W?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[Kd(_.effortMinutes,O,le)&&jsxs("span",{children:[F.labels.estimate,": ",Kd(_.effortMinutes,O,le)]}),(()=>{let ee=zg(_,O,le);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[_.priority&&jsx(Flag,{className:p("w-3 h-3",_.priority==="urgent"||_.priority==="high"?"text-red-400":_.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(Rg,{task:_,isDark:W})]}),_.assignees&&_.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:_.assignees.slice(0,2).map((ee,_e)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},_e))})]})]},_.id))}),a.onTaskCreate&&jsx("div",{className:p("flex-shrink-0 px-3 py-2.5 border-t",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:F.labels.typeToAdd,className:p("w-full text-[11px] font-mono bg-transparent outline-none",W?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:_=>{_.key==="Enter"&&_.target.value.trim()&&(a.onTaskCreate?.({name:_.target.value.trim()}),_.target.value="");}})}),H.hasCostData&&jsxs("div",{className:p("flex-shrink-0 px-4 py-3 border-t space-y-2.5",W?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:p("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",W?"text-white/40":"text-gray-500"),children:["\u25C8 ",F.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:p("text-[10px] font-mono",W?"text-white/40":"text-gray-500"),children:F.labels.budgetUtil}),jsxs("span",{className:p("text-[10px] font-mono font-bold tabular-nums",W?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:p("h-1.5 rounded-full overflow-hidden",W?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:F.labels.variance}),jsxs("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":W?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",F.labels.days]})]}),jsxs("div",{className:p("rounded-md px-2 py-1.5 text-center",W?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:p("text-[8px] font-mono uppercase tracking-wider mb-0.5",W?"text-white/25":"text-gray-400"),children:F.labels.cost}),jsx("div",{className:p("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!R&&jsx(jr,{task:$,isOpen:!!$,onClose:()=>X$1(null),onTaskUpdate:_=>{a.onTaskUpdate?.(_),X$1(_);},theme:P==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(_=>({id:_.id,name:_.name,avatar:_.avatar,initials:_.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:$?u?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ts(e).filter(_=>_.id!==$?.id),comments:l?.filter(_=>_.taskId===$?.id).map(_=>({..._,createdAt:_.createdAt instanceof Date?_.createdAt:new Date(_.createdAt),updatedAt:_.updatedAt instanceof Date?_.updatedAt:_.updatedAt?new Date(_.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:w,isTimerRunning:h?.isRunning,timerElapsedSeconds:h?.elapsedSeconds,onTimeLog:k,onEstimateUpdate:C,onSoldEffortUpdate:D,onTimerStart:T,onTimerStop:A,onTimerDiscard:B,blurFinancials:S}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ue(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:p("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",W?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:p("px-4 py-3 border-b flex items-center justify-between",W?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:p("font-medium text-sm",W?"text-white/90":"text-gray-900"),children:Be.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ue(null),className:p("p-1 rounded",W?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Be.events.map(_=>jsxs("button",{onClick:()=>{Ue(null),Re(_.task);},className:p("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",W?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Rg,{task:_.task,isDark:W}),jsx("span",{className:p("text-sm truncate flex-1",W?"text-white/80":"text-gray-900"),children:_.title}),(_.task.priority==="high"||_.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},_.id))})]})]})})]})}var Yd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},qd={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},Xd={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Oi={dark:Yd,light:qd,neutral:Xd};function Wg(e){return Oi[e]||Oi.dark}function q1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[c,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),l=useMemo(()=>{let g=u.length,y=new Set(u.flatMap(f=>f.assignedUserIds||[])).size,b=u.map(f=>f.priority).filter(Boolean),v=new Set(u.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:b,labels:v}},[u]),m=()=>{o?.(e.id);};return jsxs("div",{className:p("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:p("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:l.totalCards}),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"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var Vg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function rs(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 os(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 _g(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 jg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let c=useMemo(()=>({...Vg,...n}),[n]),[i,u]=useState(new Set),l=useRef(null),m=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(w=>{let h=w.timestamp.toISOString().split("T")[0],k=x.get(h);k?k.push(w):x.set(h,[w]);}),Array.from(x.entries()).sort((w,h)=>h[0].localeCompare(w[0])).map(([w,h])=>({date:new Date(w),events:h.sort((k,C)=>C.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let x=new Set,w=new Set;return e.forEach(h=>{x.add(h.userId),w.add(h.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(w)}},[e]),b=x=>{u(w=>{let h=new Set(w);return h.has(x)?h.delete(x):h.add(x),h});},v=x=>{let h=new Date().getTime()-x.getTime(),k=Math.floor(h/6e4),C=Math.floor(h/36e5),D=Math.floor(h/864e5);return k<1?"just now":k<60?`${k}m ago`:C<24?`${C}h ago`:D<7?`${D}d ago`:x.toLocaleDateString()},f=useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return useEffect(()=>{if(s&&l.current){let x=l.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:p("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:p("history-timeline",c.compact&&"compact",d),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:x=>{let w=x.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(x=>jsxs("option",{value:x,children:[os(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let w=x.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(x=>jsx("option",{value:x,children:x},x))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:m.map(x=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&x.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:x.events.map((w,h)=>{let k=i.has(w.id),C=s===w.id,D=_g(w.type);return jsxs("div",{"data-event-id":w.id,className:p("history-timeline-event",k&&"expanded",C&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:os(w.type)})}),h<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:rs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?v(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(w.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([T,A])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(A.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(A.to)})]})]},T)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([T,A])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(A)})]},T))]})]})]})]},w.id)})})]},x.date?.toISOString()||"all"))})]})}function Yg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],l=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:p("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:p("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&os(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&rs(l)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:p("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>d(y),title:rs(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxs("button",{className:p("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:p("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Jd(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 Qd(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 qg(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 Xg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function t5(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(u=>{let l=a/2,m=r/2;u.vx+=(l-u.x)*o.centerForce*i,u.vy+=(m-u.y)*o.centerForce*i,n.forEach(g=>{if(u.id===g.id)return;let y=u.x-g.x,b=u.y-g.y,v=Math.sqrt(y*y+b*b)||1,f=o.chargeStrength*i/(v*v);u.vx+=y/v*f,u.vy+=b/v*f;});}),t.forEach(u=>{let l=d.get(typeof u.source=="string"?u.source:u.source.id),m=d.get(typeof u.target=="string"?u.target:u.target.id);if(!l||!m)return;let g=m.x-l.x,y=m.y-l.y,b=Math.sqrt(g*g+y*y)||1,v=(b-o.linkDistance)/b*o.forceStrength*i;l.vx+=g*v,l.vy+=y*v,m.vx-=g*v,m.vy-=y*v;}),n.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return n}function Jg({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:c}){let i=useRef(null),[u,l]=useState([]),[m,g]=useState(null),[y,b]=useState(null),[v,f]=useState(null),[x,w]=useState(1),[h,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=t5(e,t,a.width,a.height,a,150);l(O);},[e,t,a]);let C=useCallback((O,le)=>{a.enableDragging&&(le.stopPropagation(),g(O));},[a.enableDragging]),D=useCallback(O=>{if(!m||!i.current)return;let P=i.current.getBoundingClientRect(),q=(O.clientX-P.left-h.x)/x,ye=(O.clientY-P.top-h.y)/x;l(ze=>ze.map(F=>F.id===m?{...F,x:q,y:ye,fx:q,fy:ye}:F));},[m,x,h]),T=useCallback(()=>{g(null);},[]),A=useCallback((O,le)=>{le.stopPropagation(),d?.({type:"node-click",node:O,position:{x:le.clientX,y:le.clientY}});},[d]),B=useCallback((O,le)=>{le.stopPropagation(),d?.({type:"edge-click",edge:O,position:{x:le.clientX,y:le.clientY}});},[d]),S=useCallback(O=>{let le=u.find(P=>P.id===O);return le?{x:le.x,y:le.y}:{x:0,y:0}},[u]),R=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let le=O.card.priority;return le==="URGENT"?"#ef4444":le==="HIGH"?"#f59e0b":le==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:p("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:p("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[qg(O)," ",Qd(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${h.x}, ${h.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let le=S(typeof O.source=="string"?O.source:O.source.id),P=S(typeof O.target=="string"?O.target:O.target.id),q=Xg(O.type),ye=v===O.id,ze=O.onCriticalPath;return jsxs("g",{className:p("relationships-graph-edge",ye&&"hovered",ze&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:F=>B(O,F),children:[jsx("line",{x1:le.x,y1:le.y,x2:P.x,y2:P.y,stroke:Jd(O.type),strokeWidth:ze?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ye?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ye&&jsx("text",{x:(le.x+P.x)/2,y:(le.y+P.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let le=y===O.id,P=O.onCriticalPath;return jsxs("g",{className:p("relationships-graph-node",le&&"hovered",P&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:q=>C(O.id,q),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:q=>A(O,q),children:[jsx("circle",{r:P?a.nodeSize*1.2:a.nodeSize,fill:R(O),stroke:P?"#fbbf24":"#ffffff",strokeWidth:P?3:2,opacity:le?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function e0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,c]=useState(false),[i,u]=useState(null),[l,m]=useState(null),g=useRef(null),y=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=w=>{w.key==="Escape"&&!y&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,y]);let b=()=>{y||(n(""),u(null),m(null),t());},v=async()=>{if(!(!s.trim()||y)){c(true),u(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){u(x instanceof Error?x.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{l&&(a(l),b());};return e?jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:x=>x.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((x,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((x,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:x.title}),x.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},w)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:x=>n(x.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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((x,w)=>jsx("button",{onClick:()=>n(x),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:x},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,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?jsx("button",{onClick:f,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"}):jsx("button",{onClick:v,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, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Zd={"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 r5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},o5={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 n5(e,t,a){let r=Zd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ns(e){return `$${e.toFixed(4)}`}var ec=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=n5(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,m)=>l+m.cost,0),s=a.reduce((l,m)=>l+m.inputTokens,0),n=a.reduce((l,m)=>l+m.outputTokens,0),d=a.filter(l=>l.success),c=a.reduce((l,m)=>l+m.duration,0),i={},u={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,u[l.feature]=(u[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/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(u=>u.timestamp>=n).length,c=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:c,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)}},$o=new ec;function r0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState($o.getStats()),[s,n]=useState($o.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o($o.getStats()),n($o.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let d=$o.getRecentOperations(5);return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ns(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,l=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ns(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:d.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ns(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 s0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[c,i]=useState(""),[u,l]=useState(""),[m,g]=useState(false),[y,b]=useState(null),[v,f]=useState(null),[x,w]=useState(null),h=useRef(null),k=m||o;useEffect(()=>{e&&h.current&&h.current.focus();},[e]),useEffect(()=>{let B=S=>{S.key==="Escape"&&!k&&C();};if(e)return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[e,k]);let C=()=>{k||(d(""),i(""),l(""),b(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||k)){g(true),b(null),f(null),w(null);try{let B=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});f(B.tasks.tasks),w({from_cache:B.from_cache,tokens_used:B.tokens_used,mock_mode:B.mock_mode,similarity:B.similarity,tokens_saved:B.tokens_saved});}catch(B){b(B instanceof Error?B.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{v&&(a(v),C());};if(!e)return null;let A=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(At,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:C}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:B=>B.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:C,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:v?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[x?.mock_mode&&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"}),x?.from_cache?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)"]}):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"}),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:[x?.tokens_used||0," tokens"]}),x?.tokens_saved&&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:[x.tokens_saved," tokens saved"]}),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:[v.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:v.map((B,S)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:B.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),B.start," \u2192 ",B.end]}),jsxs("span",{children:[B.duration," days"]}),B.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",B.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${B.priority==="high"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:B.priority})]})},B.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:h,value:n,onChange:B=>d(B.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:B=>i(B.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:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:B=>l(B.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:k})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((B,S)=>jsx("button",{onClick:()=>d(B),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:B},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:C,disabled:k,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"}),v?jsx("button",{onClick:T,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"}):jsx("button",{onClick:D,disabled:!n.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function zi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(v=>{t&&ws(()=>Promise.resolve(t(v)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,w)=>{console.warn(`Retry attempt ${x} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(v,f,x)=>{r(w=>{let h=w.cards.find(B=>B.id===v);if(!h)return w;let k=h.columnId,C={...h,columnId:f,position:x},D=w.cards.map(B=>B.id===v?C:B),T=w.columns.map(B=>{if(B.id===k)return {...B,cardIds:B.cardIds.filter(S=>S!==v)};if(B.id===f){let S=D.filter(R=>R.columnId===f).sort((R,O)=>R.position-O.position);return {...B,cardIds:S.map(R=>R.id)}}return B}),A={...w,cards:D,columns:T};return o(A),A});},[o]),n=useCallback(async(v,f)=>{r(x=>{let w=x.cards.map(k=>k.id===v?{...k,...f}:k),h={...x,cards:w};return o(h),h});},[o]),d=useCallback(async v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let w={...v,id:f},h=x.columns.map(C=>C.id===v.columnId?{...C,cardIds:[...C.cardIds,f]}:C),k={...x,cards:[...x.cards,w],columns:h};return o(k),k});},[o]),c=useCallback(async v=>{r(f=>{let x=f.cards.find(C=>C.id===v);if(!x)return f;let w=f.cards.filter(C=>C.id!==v),h=f.columns.map(C=>C.id===x.columnId?{...C,cardIds:C.cardIds.filter(D=>D!==v)}:C),k={...f,cards:w,columns:h};return o(k),k});},[o]),i=useCallback(async v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let w={...v,id:f,cardIds:[]},h={...x,columns:[...x.columns,w]};return o(h),h});},[o]),u=useCallback(async(v,f)=>{r(x=>{let w=x.columns.map(k=>k.id===v?{...k,...f}:k),h={...x,columns:w};return o(h),h});},[o]),l=useCallback(async v=>{r(f=>{let x=f.cards.filter(k=>k.columnId!==v),w=f.columns.filter(k=>k.id!==v),h={...f,cards:x,columns:w};return o(h),h});},[o]),m=useCallback(v=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(v),f},[d]),g=useCallback(v=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(v),f},[i]),y=useCallback(()=>{r(v=>{let f={...v,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:l},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:c,deleteColumn:l,clearBoard:y}}}function l0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=zi({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(l=>l.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var ss={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},c0={by:"none",order:"asc"};function u0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ss,...e}),[s,n]=useState({...c0,...t}),d=useCallback(b=>{o(v=>({...v,...b}));},[]),c=useCallback(b=>{n(v=>({...v,...b}));},[]),i=useCallback(()=>{o(ss),n(c0);},[]),u=useCallback(()=>{a&&o({...ss,assignees:[a]});},[a]),l=useCallback(()=>{o({...ss,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...ss,priorities:["HIGH","URGENT"]});},[]),g=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=useCallback(b=>{let v=[...b];if(r.search){let f=r.search.toLowerCase();v=v.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),h=String(f.getDate()).padStart(2,"0"),k=`${x}-${w}-${h}`;v=v.filter(C=>{if(!C.endDate&&!C.dueDate)return false;let D=C.endDate||C.dueDate;if(!D)return false;let T;if(typeof D=="string")T=D.split("T")[0]||D;else {let A=D.getUTCFullYear(),B=String(D.getUTCMonth()+1).padStart(2,"0"),S=String(D.getUTCDate()).padStart(2,"0");T=`${A}-${B}-${S}`;}switch(r.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let A=new Date(k+"T00:00:00"),B=new Date(T+"T00:00:00"),S=new Date(A);return S.setDate(S.getDate()+7),B>=A&&B<=S;case "custom":if(r.dateRange){let R=typeof D=="string"?new Date(D):D;return R>=r.dateRange.start&&R<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(v=v.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(v=v.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(v=v.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(v=v.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&v.sort((f,x)=>{let w=0;switch(s.by){case "created":let h=f.createdAt?new Date(f.createdAt).getTime():0,k=x.createdAt?new Date(x.createdAt).getTime():0;w=h-k;break;case "priority":let C={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=C[f.priority||"LOW"],T=C[x.priority||"LOW"];w=D-T;break;case "dueDate":let A=f.endDate||f.dueDate,B=x.endDate||x.dueDate;if(!A)return 1;if(!B)return -1;let S=typeof A=="string"?new Date(A).getTime():A.getTime(),R=typeof B=="string"?new Date(B).getTime():B.getTime();w=S-R;break;case "title":w=f.title.localeCompare(x.title);break;case "estimate":let O=f.estimatedTime||0,le=x.estimatedTime||0;w=O-le;break;default:w=0;}return s.order==="asc"?w:-w}),v},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:l,filterHighPriority:m,applyFilters:y,hasActiveFilters:g}}var m0,g0;if(typeof window<"u")try{let e=ys("ai");m0=e.generateObject,g0=e.generateText;}catch{}function f0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(m0&&g0&&e.apiKey),n=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(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=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(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=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(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=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(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),u=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(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function ac(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function b0(e){let{cards:t}=e,[a,r]=ac(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,m)=>{if(!m){r({selectedCardIds:[l],lastSelectedCardId:l});return}let g=m.ctrlKey||m.metaKey,y=m.shiftKey;if(g)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(y&&a.lastSelectedCardId){let b=t.find(f=>f.id===l),v=t.find(f=>f.id===a.lastSelectedCardId);if(b&&v&&b.columnId===v.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,A)=>T.position-A.position),x=f.findIndex(T=>T.id===a.lastSelectedCardId),w=f.findIndex(T=>T.id===l),[h,k]=x<w?[x,w]:[w,x],C=f.slice(h,k+1).map(T=>T.id),D=Array.from(new Set([...a.selectedCardIds,...C]));r({selectedCardIds:D,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),u=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:c,toggleCard:i,getSelectedCards:u}}var h0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function y0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...h0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,v,f,x,w)=>{if(v.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let h={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:v,columnId:f,strategy:x,color:w,isExpanded:true,position:s.filter(k=>k.columnId===f).length,createdAt:new Date};n(k=>[...k,h]);},[o.minCardsPerStack,s]),c=useCallback(b=>{n(v=>v.filter(f=>f.id!==b));},[]),i=useCallback(b=>{n(v=>v.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),u=useCallback((b,v)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(v)?{...x,cardIds:[...x.cardIds,v]}:x));},[]),l=useCallback((b,v)=>{n(f=>f.map(x=>{if(x.id===b){let w=x.cardIds.filter(h=>h!==v);return w.length<o.minCardsPerStack?null:{...x,cardIds:w}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(v=>v.columnId===b).sort((v,f)=>v.position-f.position),[s]),g=useCallback(async b=>{let v=t.filter(k=>k.columnId===b);if(v.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;v.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(C=>{x.has(C)||x.set(C,[]),x.get(C).push(k);});}),x.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${C}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${C}"`,confidence:.85});});let w=new Map;v.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(C=>{w.has(C)||w.set(C,[]),w.get(C).push(k);});}),w.forEach((k,C)=>{k.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${C.slice(-4)}`,cardIds:k.map(D=>D.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let h=new Map;if(v.forEach(k=>{k.priority&&(h.has(k.priority)||h.set(k.priority,[]),h.get(k.priority).push(k));}),h.forEach((k,C)=>{if(k.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[C.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${C} Priority`,cardIds:k.map(T=>T.id),columnId:b,strategy:"priority",color:C==="high"||C==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${C} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let k of v){let D=(await r.findSimilar(k,v)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let T=[k.id,...D.map(B=>B.card.id)],A=D.reduce((B,S)=>B+S.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:A});}}return f.filter(k=>k.confidence>=o.autoStackConfidenceThreshold).sort((k,C)=>C.confidence-k.confidence).slice(0,5)},[t,o,r]),y=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(v=>v.columnId)).forEach(async v=>{let f=await g(v),x=f[0];f.length>0&&x&&x.confidence>=.9&&y(x);});},[]),{stacks:s,createStack:d,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:l,getStacksForColumn:m,getSuggestions:g,applySuggestion:y,config:o}}var x0=createContext(null);function v0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=ys("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=ys("@libxai/core");n.set(c.id,new i(c));});let d=null;if(t?.board){let{Board:c}=ys("@libxai/core");d=new c(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(x0.Provider,{value:{store:o},children:e})}function Ui(){let e=useContext(x0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ls(){let e=Ui(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(x=>{e.updateBoard(x);},[e]),c=useCallback(x=>{e.addColumn(x);},[e]),i=useCallback((x,w)=>{e.updateColumn(x,w);},[e]),u=useCallback(x=>{e.deleteColumn(x);},[e]),l=useCallback(x=>e.getColumn(x),[e]),m=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,w)=>{e.updateCard(x,w);},[e]),y=useCallback(x=>{e.deleteCard(x);},[e]),b=useCallback((x,w,h)=>{e.moveCard(x,w,h);},[e]),v=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:l,addCard:m,updateCard:g,deleteCard:y,moveCard:b,getCard:v,getCardsByColumn:f}}function k0(e){let{cards:t}=ls();return 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 C0(e="position",t="asc"){let{cards:a}=ls();return 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},c=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=c-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 Wi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Gc.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);}},k5=new Wi;function N0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:m,className:o,children:jsx("div",{style:g,children:l.map(y=>{let b=e[y.index];if(!b)return null;let v=c?c(b,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(b,y.index)},v)})})})}function D0(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function E0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:n,gap:d}),m=l.getVirtualItems(),g={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 jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:y,children:m.map(b=>{let v=e[b.index];if(!v)return null;let f=c?c(v,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:x,"data-index":b.index,children:o(v,b.index)},f)})})})}function P0(e){let t=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 F0(e,t=10){return e>t}var sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ic={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},dc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mc={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)"},gc={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)"},fc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bc={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}},hc={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}},Gi={spacing:sc,borderRadius:ic,fontSize:lc,fontWeight:dc,lineHeight:cc,zIndex:uc,duration:pc,easing:mc,shadows:gc,opacity:fc,kanban:bc,gantt:hc};function M0(e,t,a){return e[t]??a}function yc(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)?yc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function N5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xc(e="asakaa"){let t=yc(Gi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=N5(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
416
  }`}function ds(e,t="asakaa"){let a=[],r=yc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {