@libxai/board 1.9.28 → 1.9.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -411,7 +411,7 @@ ${dg(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no da
|
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
413
|
Today's date: ${new Date().toISOString().split("T")[0]}`}function dg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=dg(e),a=t.toLowerCase().trim(),n=r.find(l=>l.name.toLowerCase()===a);if(n)return n;let s=r.find(l=>l.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function fd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let p={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}[n[1].toLowerCase()];if(p!==void 0){let f=new Date(a),x=f.getDay(),h=p-x;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let l=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let u=parseInt(l[1],10),p=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,p,u)}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=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let u=parseInt(i[1],10),p=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function bd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function hd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function ug(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 pg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=fd(d);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=bd(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.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(),d=s[2].trim(),m=Un(t,i),u=hd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),d=l[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,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=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.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 mg(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 Vw(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 jw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ml(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>ml(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},l=o(e.startDate),c=o(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:Vw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function gg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:jw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function fg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>ml(a,e,t))}var yd={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:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},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"}},xd={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:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},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"}},gl={en:yd,es:xd};function vd(e){return gl[e]||gl.en}function fl(e,t){let r=vd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var wd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function bg(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 hg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let p=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=bg(e),i=wd[0],d=wd.find(p=>p.value===c)??i,m=d.icon,u=p=>{switch(bg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:wd.map(p=>{let f=p.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",p.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var kd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function xg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let d=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let c=kd.find(d=>d.value===e)??kd[4],i=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",c.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",c.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(d=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function ri(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Cd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function yl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=useState(false),[c,i]=useState(""),d=useRef(null),m=useRef(null);useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),p=x=>e.some(h=>h.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ri(x.name),color:x.color||Cd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,h]);}l(false),i("");}};return s||!r?e.length===0?jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&Cd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),l(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&Cd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"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 ${a?"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:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"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 ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ri(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(y=>y.name!==x.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}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let h=p(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ri(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&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"}})})]},x.id)})})]})]})}function Ng({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,d]=useState(false),[m,u]=useState(n),[p,f]=useState(()=>{let D=n==="start"?e:t;if(D){let V=D instanceof Date?D:new Date(D);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=useRef(null),b=useRef(null),[y,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=V=>{let $=V.target;x.current&&x.current.contains($)||b.current&&b.current.contains($)||d(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let D=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let $=520,Z=360,L=window.innerHeight-V.bottom,Ae=L<Z&&V.top>L,W=Ae?V.top-4:V.bottom+4,Ce=Math.min(Math.max(V.left,8),window.innerWidth-$-8);v({top:W,left:Ce,flipUp:Ae});};return D(),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}},[i]),useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let M=D=>D?D.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",B=useCallback(()=>{let D=p.getFullYear(),V=p.getMonth(),$=new Date(D,V,1),L=new Date(D,V+1,0).getDate(),Ae=$.getDay(),W=[],I=new Date(D,V,0).getDate();for(let Oe=Ae-1;Oe>=0;Oe--)W.push({date:new Date(D,V-1,I-Oe),isCurrentMonth:false});for(let Oe=1;Oe<=L;Oe++)W.push({date:new Date(D,V,Oe),isCurrentMonth:true});let z=42-W.length;for(let Oe=1;Oe<=z;Oe++)W.push({date:new Date(D,V+1,Oe),isCurrentMonth:false});return W},[p]),T=D=>{if(a)n==="start"?r(D,k||void 0):r(w||void 0,D),d(false);else if(m==="start"){let V=k&&D>k?D:k;r(D,V||void 0),u("end");}else {let V=w&&D<w?D:w;r(V||void 0,D),d(false);}},C=()=>{let D=new Date,V=new Date(D);V.setDate(D.getDate()+1);let $=new Date(D);$.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let Z=new Date(D);Z.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let L=new Date(D);L.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let Ae=new Date(D);Ae.setDate(D.getDate()+14);let W=new Date(D);return W.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Z,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ae,display:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let D=a&&n==="start"?w:k;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(D)})]})}let P=a&&n==="start"?w:k;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:h,onClick:D=>{D.stopPropagation(),d(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.getMonth(),1));},className:g("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:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,V)=>jsxs("button",{className:g("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:()=>T(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},V)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,k||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:g("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:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!a&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="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:g("font-medium",s?"text-white":"text-gray-900"),children:p.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:g("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:B().map((D,V)=>{let $=D.date.toDateString()===new Date().toDateString(),Z=w?.toDateString()===D.date.toDateString(),L=k?.toDateString()===D.date.toDateString(),Ae=Z||L,W=!a&&w&&k&&D.date>=w&&D.date<=k;return jsx("button",{onClick:()=>T(new Date(D.date)),className:g("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"),$&&"ring-2 ring-[#00E5CC]",Z&&"bg-[#00E5CC] text-white",L&&!Z&&"bg-[#7C3AED] text-white",W&&!Ae&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ae&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},V)})})]})]}),document.body)]})}function vl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Ng,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function bs(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function wl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[l,c]=useState(false),i=useRef(e),d=useRef([]);return useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;c(true);for(let x=1;x<=n;x++){let h=setTimeout(()=>{let b=x/n,y=1-Math.pow(1-b,3),v=Math.round(m+p*y);o(v),x===n&&(c(false),o(u));},f*x);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Dg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,l]=useState(0),c=useRef(null),i=useRef(null),d=useCallback(p=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(p),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,h=Math.min(x/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),l(0);},r);},[r,e]),m=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),a?.();},[a]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function Eg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[c,i]=useState(""),d=useRef(null),{isFlashing:m,triggerFlash:u}=bs(),{displayValue:p,isAnimating:f}=wl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,B=Math.round(M/k.width*100),T=Math.max(0,Math.min(100,B));T!==e&&(t(T),s&&u());},h=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&u());}},[c,t,e,s,u]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),v=p??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:d,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Fg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let d=()=>{l!==e&&t?.(l),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:l,onChange:u=>c(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Ig({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,d]=useState(false),[m,u]=useState(e?.toString()||""),p=useRef(null),{isFlashing:f,triggerFlash:x}=bs(),{displayValue:h,isAnimating:b}=wl(e,{enabled:l&&!i});useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(m);if(!isNaN(w)){let k=w;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&x());}d(false);},v=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function Rg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),c=useRef(null);return useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("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",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),l(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function $g({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:d}=Dg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?l?d():i(!e):t(!e));},u=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&u&&"ring-green-500/50",l&&!u&&"ring-red-500/50",l&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&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:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"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 Og({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=useState(false),d=useRef(null);useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&i(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let m=e.slice(0,l),u=e.length-m.length,p=e.length===0?n:m.join(", ")+(u>0?` +${u}`:"");if(s||!r)return jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:p});let f=h=>{let b=e.includes(h),y=b?e.filter(v=>v!==h):[...e,h];!b&&o!=null&&e.length>=o||r(y);},x=o!=null&&e.length>=o;return jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:p}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let b=e.includes(h),y=!b&&x;return jsxs("button",{disabled:y,onClick:v=>{v.stopPropagation(),f(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",y?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:h}),b&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Lk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function Wg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Lk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return a?jsxs("button",{onClick:c=>{c.stopPropagation(),a(s);},title:n.map(c=>c.name).join(`
|
|
414
|
-
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:l})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function Vg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.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)),n>0&&jsxs("span",{className:g("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:["+",n]})]})}function Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let l=parseFloat(a[1]),c=a[2]?parseInt(a[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=useState(false),[p,f]=useState(""),x=useRef(null),{isFlashing:h,triggerFlash:b}=bs(),y=c==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),C=e%60;T>0&&C>0?f(`${T}h ${C}m`):T>0?f(`${T}h`):f(`${C}m`);}else f("");},[e,m]);let k=()=>{let T=Bk(p);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let B=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:p,onChange:T=>f(T.target.value),onBlur:k,onKeyDown:M,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function qg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(r==null)return null;let c=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Xg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=r==="es",d=l==="financial"&&c>0,m=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,p]=useState(false),[f,x]=useState(false),[h,b]=useState(null),y=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(v/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?v/w*100:0,C=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(x(false),b(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,h]);let D=W=>{if(W.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{x(false),b(W);},$=async(W,Ce)=>{h==="log"&&a&&W?a(e,W,Ce):h==="estimate"&&n?n(e,W):h==="quoted"&&s&&s(e,W),b(null);},Z=a||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Ae=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&v===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&Z&&jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&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:L.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(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:[(()=>{let W=v===0,I=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(B)]}),C>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:I?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:I?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(C)," ",i?"Excedido":"Over"]})]})})(),w>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(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Z&&jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&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:L.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Jg({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Qg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsx(Jg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?Vk(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Jg,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function e0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function i0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=useRef(null),y=a==="es"?a0.es:a0.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let C=b.current;if(!C)return;let P=C.getBoundingClientRect(),D=8,V=e.x,$=e.y;e.y+P.height>window.innerHeight-D&&($=Math.max(D,e.y-P.height)),e.x+P.width>window.innerWidth-D&&(V=Math.max(D,window.innerWidth-P.width-D)),(V!==e.x||$!==e.y)&&w({left:V,top:$});},[e.x,e.y,e.isOpen]),useEffect(()=>{let C=D=>{b.current&&!b.current.contains(D.target)&&t();},P=D=>{D.key==="Escape"&&t();};return document.addEventListener("mousedown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let C=[];return n&&C.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),C.push({id:"sep1",label:"",icon:null,separator:true}),l&&(C.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),C.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),d.length>0&&C.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let D=e.task.assignees||[],$=D.some(Z=>Z.name===P.name)?D.filter(Z=>Z.name!==P.name):[...D,{name:P.name,initials:s1(P.name),color:P.color||i1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),m&&C.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&C.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&C.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),C},M=()=>{if(!e.columnId)return [];let C=[];return i&&(C.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(C.push({id:"sep-hide",label:"",icon:null,separator:true}),C.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:B.map(C=>C.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsx(l1,{item:C,isDark:r},C.id):jsxs("button",{onClick:C.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",C.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function l1({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("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:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("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(l=>jsxs("button",{onClick:l.onClick,className:g("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:l.icon}),l.label]},l.id))})]})}var a0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",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",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",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 f0={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"}),weight:jsx(BarChart,{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"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function h0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=useState(""),[m,u]=useState(null),[p,f]=useState(null),x=useRef(null),h=c==="es"?b0.es:b0.en;useLayoutEffect(()=>{if(!e||!x.current)return;let C=()=>{if(!x.current)return;let P=x.current.parentElement;if(P){let Z=P.getBoundingClientRect();f({top:Z.bottom+4,right:window.innerWidth-Z.right});}let D=x.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{x.current&&!x.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),x._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),x._cleanup&&x._cleanup();}},[e,t]);let b=useMemo(()=>{let C=new Set([...N1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&C.add(P.type);}),Array.from(C)},[r]);if(!e)return null;let y=C=>{let P=h.columns[C];if(P)return P;let D=r.find(V=>V.type===C);return D?.label?D.label:C},v=C=>{if(C==="name")return;let P=r.map(D=>D.id===C?{...D,visible:!D.visible}:D);n(P);},w=(C,P)=>{let D=r.find($=>$.type===C&&(!P||$.customFieldId===P));if(D){v(D.id);return}let V={id:P||C,type:C,label:P?a.find($=>$.id===P)?.name||C:y(C),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(C=>C!=="assignees"&&(o||!k.includes(C))&&y(C).toLowerCase().includes(i.toLowerCase())),B=a.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),T=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:x,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",C.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color=l?"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:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:C=>d(C.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"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:C=>{C&&C.style.setProperty("--focus-border",T);},onFocus:C=>{C.currentTarget.style.borderColor=T,C.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:C=>{C.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",C.currentTarget.style.background=l?"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:C=>C.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(C=>{let P=r.find($=>$.type===C&&!$.customFieldId),D=P?.visible??false,V=C==="name";return jsxs("button",{onClick:()=>{V||(P?v(P.id):w(C));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.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:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&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:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(C),children:y(C)})]},C)})})]}),B.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxs("button",{onClick:()=>w(C.type,C.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.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:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&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:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:C.name})]},C.id)})})]})]})]})}var b0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var I1=[{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 v0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,d]=useState([""]),m=n==="es"?x0.es:x0.en;useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var x0={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 C0={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 T0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),d=s==="es"?C0.es:C0.en;useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),d.filters,u&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs("button",{onClick:()=>{r(p.value),a(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function N0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function D0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("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"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=c-d,u=c>0?Math.round(m/c*100):0,p=c-i,f=c>0?Math.round(p/c*100):0,x=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=v>0||w>0,M=(B,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=v>0||w>0,M=(B,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(c/i*100),100):0,p=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:N0(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:N0(i)})]}),i>0&&jsx("div",{className:g("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:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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 c=e.scheduleVarianceDays??0,i=c>0,d=c<0,m=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let d=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:g("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(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var X1=[{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 I0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...I0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ks(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ks(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ws(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function L0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,r+=c,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let d=i.effort_minutes||60;l+=(i.progress||0)*d,c+=d;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function zd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?zd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function R0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:B=true,showCreateTaskButton:T=false,onCreateTask:C,persistFilter:P=false,financialBlur:D,healthSidebar:V,lens:$="hours",hourlyRate:Z=0,rateMap:L,aggregateParentHours:Ae=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,I=fl(f,x),z=p==="dark",Oe=S=>{if(!L||!S.assignees||S.assignees.length===0)return Z;let X=0,pe=0;for(let ke of S.assignees){let We=ke.id?L[ke.id]:void 0;if(We==null||We<=0)continue;let re=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;re>0&&(X+=We*re,pe+=re);}if(pe>0)return X/pe;let ye=S.assignees.map(ke=>ke.id?L[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return ye.length===0?Z:ye.reduce((ke,We)=>ke+We,0)/ye.length},ze=S=>{let X=0,pe=0,ye=0,ke=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let Pe={s:X,a:pe,q:ye};if(ke(re.subtasks),X-Pe.s+(pe-Pe.a)+(ye-Pe.q)===0){let at=Oe(re);X+=(re.timeLoggedMinutes??0)/60*at,pe+=(re.effortMinutes??0)/60*at,ye+=(re.soldEffortMinutes??0)/60*at;}}else {let Pe=Oe(re);X+=(re.timeLoggedMinutes??0)/60*Pe,pe+=(re.effortMinutes??0)/60*Pe,ye+=(re.soldEffortMinutes??0)/60*Pe;}};return S.subtasks&&ke(S.subtasks),{dollarSpent:X,dollarAllocated:pe,dollarQuoted:ye}},Q=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let X=JSON.parse(S);return {statusFilter:X.statusFilter||"all",hideCompleted:X.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),De=useMemo(()=>{function S(X){let pe=0,ye=0,ke=0,We=0,re=0,Pe=0;for(let Ee of X)if(Ee.subtasks&&Ee.subtasks.length>0){let at=S(Ee.subtasks);if(at.spent+at.allocated+at.quoted>0)pe+=at.spent,ye+=at.allocated,ke+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,Pe+=at.dollarQuoted;else {let lt=Ee.timeLoggedMinutes??0,gt=Ee.effortMinutes??0,rr=Ee.soldEffortMinutes??0;pe+=lt,ye+=gt,ke+=rr;let gr=Oe(Ee);We+=lt/60*gr,re+=gt/60*gr,Pe+=rr/60*gr;}}else {let at=Ee.timeLoggedMinutes??0,$t=Ee.effortMinutes??0,lt=Ee.soldEffortMinutes??0;pe+=at,ye+=$t,ke+=lt;let gt=Oe(Ee);We+=at/60*gt,re+=$t/60*gt,Pe+=lt/60*gt;}return {spent:pe,allocated:ye,quoted:ke,dollarSpent:We,dollarAllocated:re,dollarQuoted:Pe}}return S(e)},[e]),oe=useMemo(()=>{let S=new Map;function X(pe){let ye=0;for(let ke of pe)if(ke.subtasks&&ke.subtasks.length>0){let We=X(ke.subtasks);S.set(ke.id,We),ye+=We;}else ye+=ke.weight||0;return ye}return X(e),S},[e]),He=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Fe]=useState(true),[Ge,Qe]=useState(null),[se,Ze]=useState("position"),[_e,$e]=useState("asc"),[ft,pt]=useState(""),[je,Re]=useState(()=>Q().statusFilter),[dt,zt]=useState(()=>Q().hideCompleted),[Le,st]=useState(y||X1),[F,J]=useState(false),[R,Y]=useState(false),[ue,he]=useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=useState(null),[xe,Ie]=useState(false),[Ue,Ct]=useState(null),[Xe,Dt]=useState(null),[mt,Jt]=useState(null),xr=useRef(0),Er=useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,Bt]=useState(null),[vr,Gt]=useState(null),Qt=S=>{let X=S.type;return S.customFieldId?X==="file"?null:{kind:"customField",fieldId:S.customFieldId}:X==="assignees"||X==="teamLoad"?"assignees":X==="startDate"?"startDate":X==="endDate"?"endDate":null},Zr=(S,X)=>typeof S=="string"||typeof X=="string"?S===X:S.fieldId===X.fieldId,ba=useRef([]),et=useCallback((S,X)=>{Rt&&(X.preventDefault(),xr.current=X.clientY,j(S),Er.current=false,Ie(false),Jt({x:X.clientX,y:X.clientY}));},[Rt]),Ke=useCallback(S=>{if(!Be||(Math.abs(S.clientY-xr.current)>5&&!Er.current&&(Er.current=true,Ie(true)),Jt({x:S.clientX,y:S.clientY}),!Er.current))return;let pe=document.querySelectorAll("[data-listview-row]"),ye=null,ke=null;pe.forEach(We=>{let re=We.getBoundingClientRect(),Pe=We.getAttribute("data-listview-row");if(Pe&&Pe!==Be&&S.clientY>=re.top&&S.clientY<=re.bottom){ye=Pe;let Ee=S.clientY-re.top,at=re.height;ke=Ee<at*.25?"above":Ee>at*.75?"below":"child";}}),Ct(ye),Dt(ke);},[Be]),sa=useCallback(()=>{if(Er.current&&Be&&Ue&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Be,Ue);else if(Xe==="above"||Xe==="below"){let S=(ye,ke,We=null)=>{for(let re of ye){if(re.id===ke)return We;if(re.subtasks){let Pe=S(re.subtasks,ke,re.id);if(Pe!==void 0)return Pe}}},X=S(e,Be,null),pe=S(e,Ue,null);if(r.onTaskReparent){let ye=(at,$t)=>{if($t===null)return at;for(let lt of at){if(lt.id===$t)return lt.subtasks||[];if(lt.subtasks){let gt=ye(lt.subtasks,$t);if(gt.length>0||lt.subtasks.some(rr=>rr.id===$t))return gt}}return []},ke=ye(e,pe??null),We=ke.findIndex(at=>at.id===Ue),re=X===pe,Pe=re?ke.findIndex(at=>at.id===Be):-1,Ee=Xe==="below"?We+1:We;re&&Pe!==-1&&Pe<We&&(Ee-=1),r.onTaskReparent(Be,pe??null,Math.max(0,Ee));}}}j(null),Ct(null),Dt(null),Jt(null),Er.current=false,Ie(false);},[Be,Ue,Xe,e,r]),Vr=(S,X)=>typeof X!="string"?S.customFields?.find(ye=>ye.fieldId===X.fieldId)?.value:X==="assignees"?S.assignees:X==="startDate"?S.startDate:S.endDate,ea=(S,X,pe,ye)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ke=Array.from(document.querySelectorAll("[data-listview-row]")),We=ke.map(St=>St.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(X)),Pe=St=>We.slice(re,St+1);Gt({sourceTaskId:X,column:pe,sourceIndex:ye,targetIndex:ye,rangeIds:new Set([X])});let at=(St=>{let xt=St?.parentElement??null;for(;xt;){let Ca=window.getComputedStyle(xt).overflowY;if((Ca==="auto"||Ca==="scroll")&&xt.scrollHeight>xt.clientHeight)return xt;xt=xt.parentElement;}let Mr=document.scrollingElement;return Mr&&Mr.scrollHeight>Mr.clientHeight?Mr:null})(S.currentTarget),$t=St=>{let xt=re,Mr=false;ke.forEach((Ca,pa)=>{let qr=Ca.getBoundingClientRect();St>=qr.top&&St<=qr.bottom&&(xt=pa,Mr=true);});let ya=ke[ke.length-1];if(!Mr&&ya){let Ca=ya.getBoundingClientRect();St>Ca.bottom&&(xt=ke.length-1);}return xt<re&&(xt=re),xt},lt=S.clientY,gt=null,rr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},gr=()=>{let St=$t(lt),xt=new Set(Pe(St));Gt(Mr=>Mr&&{...Mr,targetIndex:St,rangeIds:xt});},Ur=()=>{if(rr(),!at)return;let St=at,Mr=St===document.scrollingElement?{top:0,bottom:window.innerHeight}:St.getBoundingClientRect(),ya=60,Ca=12,pa=lt-Mr.top,qr=Mr.bottom-lt,Fn=St.scrollHeight-St.clientHeight;if(qr<ya&&St.scrollTop<Fn){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,qr)/ya))),xo=()=>{St.scrollTop+=Ss,gr(),St.scrollTop<St.scrollHeight-St.clientHeight&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}else if(pa<ya&&St.scrollTop>0){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,pa)/ya))),xo=()=>{St.scrollTop-=Ss,gr(),St.scrollTop>0&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}},Ot=St=>{lt=St.clientY,gr(),Ur();},Kt=St=>{window.removeEventListener("mousemove",Ot),window.removeEventListener("mouseup",Kt),rr(),document.body.style.cursor="",document.body.style.userSelect="",Gt(null);let xt=$t(St.clientY),Mr=new Map(ba.current.map(qr=>[qr.id,qr])),ya=Mr.get(X);if(!ya)return;let Ca=Vr(ya,pe),pa=[];for(let qr of Pe(xt)){if(qr===X)continue;let Fn=Mr.get(qr);Fn&&(Fn.subtasks&&Fn.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,pe,Ca);};window.addEventListener("mousemove",Ot),window.addEventListener("mouseup",Kt);},jr=S=>vr?vr.rangeIds.has(S):false;useEffect(()=>{if(Be)return document.addEventListener("mousemove",Ke),document.addEventListener("mouseup",sa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ke),document.removeEventListener("mouseup",sa),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,Ke,sa]);let[_r,ce]=useState("all"),[de,ut]=useState(false),_=useRef(null),fe=useRef(null),ee=useMemo(()=>{let S=0;function X(pe,ye){for(let ke of pe)ye>S&&(S=ye),ke.subtasks?.length&&X(ke.subtasks,ye+1);}return X(e,1),S},[e]);useEffect(()=>{if(!de)return;let S=X=>{_.current?.contains(X.target)||fe.current?.contains(X.target)||ut(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),useEffect(()=>{if(_r==="all"){let pe=function(ye){for(let ke of ye)ke.subtasks?.length&&(ke.isExpanded===false&&r.onTaskToggleExpand?.(ke.id),pe(ke.subtasks));};pe(e);}else {let pe=function(ye,ke){for(let We of ye)if(We.subtasks?.length){let re=ke<_r,Pe=We.isExpanded!==false;re!==Pe&&r.onTaskToggleExpand?.(We.id),pe(We.subtasks,ke+1);}};pe(e,1);}},[_r]);let[O,te]=useState(null),[we,N]=useState(0),[H,me]=useState(0),K=useRef(null),[ve,nt]=useState(null),[ie,ot]=useState(null);useEffect(()=>{y&&st(S=>{if(S.length===y.length){let X=true;for(let pe=0;pe<S.length;pe++){let ye=S[pe],ke=y[pe];if(!ye||!ke||ye.id!==ke.id||ye.visible!==ke.visible||ye.width!==ke.width||ye.label!==ke.label){X=false;break}}if(X)return S}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:je,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,je,dt]);let bt=useMemo(()=>{let S=new Set;function X(pe){for(let ye of pe)ye.subtasks?.length&&(ye.isExpanded!==false&&S.add(ye.id),X(ye.subtasks));}return X(e),S},[e]),Mt=useMemo(()=>Le.filter(S=>S.visible),[Le]),ir=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ha=useCallback(S=>{se===S?$e(X=>X==="asc"?"desc":"asc"):(Ze(S),$e("asc")),r.onSortChange?.({column:S,direction:_e==="asc"?"desc":"asc"});},[se,_e,r]),mr=useCallback(S=>{st(S),r.onColumnsChange?.(S);},[r]),tn=useCallback(S=>{let X=Le.map(pe=>pe.id===S?{...pe,visible:false}:pe);mr(X);},[Le,mr]),lr=useCallback((S,X)=>{Ze(S),$e(X);},[]),Ma=useCallback((S,X,pe)=>{B&&(S.preventDefault(),he({isOpen:true,x:S.clientX,y:S.clientY,type:X?"task":"header",task:X,columnId:pe}));},[B]),zo=useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Pn=useCallback((S,X)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let pe=Le.find(ye=>ye.id===X);pe&&(te(X),N(S.clientX),me(pe.width));},[Le,M]);useEffect(()=>{if(!O)return;let S=Le,X=ye=>{let ke=ye.clientX-we,We=Math.max(50,H+ke);S=S.map(re=>re.id===O?{...re,width:We}:re),st(S);},pe=()=>{r.onColumnsChange?.(S),te(null);};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",pe);}},[O,we,H,r]);let _n=useCallback((S,X)=>{if(X==="name"){S.preventDefault();return}nt(X),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",X),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Go=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),nt(null),ot(null);},[]),bi=useCallback((S,X)=>{S.preventDefault(),X!=="name"&&(S.dataTransfer.dropEffect="move",ot(X));},[]),Kr=useCallback(()=>{ot(null);},[]),Ds=useCallback((S,X)=>{if(S.preventDefault(),!ve||ve===X||X==="name")return;let pe=[...Le],ye=pe.findIndex(re=>re.id===ve),ke=pe.findIndex(re=>re.id===X);if(ye===-1||ke===-1)return;let We=pe.splice(ye,1);We[0]&&(pe.splice(ke,0,We[0]),mr(pe),nt(null),ot(null));},[ve,Le,mr]),Ga=useCallback(async S=>{if(r.onCreateCustomField){let X={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(X);}Y(false);},[r]),Va=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ba=useMemo(()=>{let S=I0(e);if(ft.trim()){let X=ft.toLowerCase();S=S.filter(pe=>pe.name.toLowerCase().includes(X));}if(je!=="all"){let X=new Set(S.filter(pe=>Va(pe)===je).flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}if(dt){let X=new Set(S.filter(pe=>Va(pe)!=="completed").flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}return S.sort((X,pe)=>{let ye,ke;switch(se){case "name":ye=X.name.toLowerCase(),ke=pe.name.toLowerCase();break;case "startDate":ye=X.startDate?.getTime()||0,ke=pe.startDate?.getTime()||0;break;case "endDate":ye=X.endDate?.getTime()||0,ke=pe.endDate?.getTime()||0;break;case "progress":ye=X.progress||0,ke=pe.progress||0;break;case "status":ye=X.status||"todo",ke=pe.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ye=We[X.priority]??4,ke=We[pe.priority]??4;break;case "position":return 0;default:return 0}return ye<ke?_e==="asc"?-1:1:ye>ke?_e==="asc"?1:-1:0}),S},[e,ft,je,dt,se,_e,Va]);ba.current=Ba;let ho=useCallback((S,X)=>{let pe=We=>{r.onTaskUpdate?.({...S,...We});},ye=We=>We?S.customFields?.find(Pe=>Pe.fieldId===We)?.value:void 0,ke=(We,re)=>{if(!We)return;let Ee=[...S.customFields||[]],at=Ee.findIndex($t=>$t.fieldId===We);at>=0?Ee[at]={fieldId:We,value:re}:Ee.push({fieldId:We,value:re}),pe({customFields:Ee});};switch(X.type){case "name":return null;case "status":return jsx(hg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{pe({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:z,locale:f,translations:I.status});case "priority":return jsx(xg,{value:S.priority,onChange:re=>pe({priority:re}),isDark:z,locale:f});case "assignees":{let re=S.hasChildren,Pe=S.assignees||[];if(re&&S.subtasks?.length){let Ee=new Map,at=$t=>{($t||[]).forEach(lt=>{(lt.assignees||[]).forEach(gt=>{Ee.has(gt.name)||Ee.set(gt.name,gt);}),lt.subtasks?.length&&at(lt.subtasks);});};at(S.subtasks),Pe=Array.from(Ee.values());}else re&&(Pe=[]);return jsx(yl,{value:Pe,availableUsers:l,onChange:Ee=>pe({assignees:Ee}),isDark:z,locale:f,disabled:re})}case "startDate":return jsx(vl,{value:S.startDate,onChange:re=>pe({startDate:re}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(vl,{value:S.endDate,onChange:re=>pe({endDate:re}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),Pe=re?L0(zd(S.subtasks||[])):S.progress||0;return jsx(Eg,{value:Pe,onChange:re?void 0:Ee=>{let at=Ee===100?"completed":Ee>0?"in-progress":"todo";pe({progress:Ee,status:at});},isDark:z,disabled:re})}case "tags":return jsx(Vg,{value:S.tags||[],isDark:z});case "text":return jsx(Fg,{value:ye(X.customFieldId)||"",onChange:re=>ke(X.customFieldId,re),isDark:z});case "number":return jsx(Ig,{value:ye(X.customFieldId)||0,onChange:re=>ke(X.customFieldId,re),isDark:z});case "date":let We=ye(X.customFieldId);return jsx(vl,{value:We?new Date(We):void 0,onChange:re=>ke(X.customFieldId,re),isDark:z,locale:f});case "dropdown":return jsx(Rg,{value:ye(X.customFieldId)||"",options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z});case "checkbox":return jsx($g,{value:ye(X.customFieldId)||false,onChange:re=>ke(X.customFieldId,re),isDark:z});case "multiselect":return jsx(Og,{value:ye(X.customFieldId)||[],options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z,maxSelectable:X.maxSelectable});case "person":{let re=ye(X.customFieldId)||[];return jsx(yl,{value:re.map(Pe=>({name:Pe.name,avatar:Pe.avatar,initials:Pe.initials||(Pe.name||"?").slice(0,2).toUpperCase(),color:Pe.color||"#00E5CC"})),availableUsers:l,onChange:Pe=>ke(X.customFieldId,Pe),isDark:z,locale:f})}case "file":return jsx(Wg,{value:ye(X.customFieldId),isDark:z,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.estimatedTime,onChange:Pe=>pe({estimatedTime:Pe}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsx(Ia,{value:S.quotedTime,onChange:Ee=>pe({quotedTime:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,Pe=S.executedDollarsCanonical;return jsx(Ia,{value:S.elapsedTime,onChange:Ee=>pe({elapsedTime:Ee}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S),financialOverride:Pe})}case "effortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{allocated:$t}=ks(S);if($==="financial"){let lt=ze(S),gt=Math.round(lt.dollarAllocated),rr=Math.round(lt.dollarQuoted),gr=rr-gt;return jsxs("div",{className:"flex flex-col",children:[gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",gt.toLocaleString("es-CO")]}):null,gr!==0&>>0&&rr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gr>0?"+":"",Math.abs(gr)>=1e3?`$${(gr/1e3).toFixed(1)}K`:`$${gr}`]})]})}return jsx(Ia,{value:$t>0?$t:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Z})}let re=S.status==="completed"||S.progress===100,Pe=S.effortMinutes||0,Ee=S.soldEffortMinutes||0,at=Oe(S);if($==="financial"&&at&&Pe>0&&Ee>0){let $t=Math.round(Pe/60*at),gt=Math.round(Ee/60*at)-$t;return jsxs("div",{className:"flex flex-col",children:[jsx(Ia,{value:Pe,onChange:rr=>pe({effortMinutes:rr}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)}),gt!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gt>0?"+":"",Math.abs(gt)>=1e3?`$${(gt/1e3).toFixed(1)}K`:`$${gt}`]})]})}return jsx(Ia,{value:Pe,onChange:$t=>pe({effortMinutes:$t}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(Ae&&S.subtasks&&S.subtasks.length>0){let{spent:Ee}=ks(S);return jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S),financialOverride:re})}let Pe=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Ee=>{r.onLogTime?.(S,Ee);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Pe,lens:$,hourlyRate:Oe(S),financialOverride:re})}case "soldEffortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{quoted:Ee}=ks(S),at=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,isBlurred:at,lens:$,hourlyRate:Oe(S)})}let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:S.soldEffortMinutes,onChange:Ee=>pe({soldEffortMinutes:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,Pe=S.soldEffortMinutes||0,Ee=S.timeLoggedMinutes||0,at=re>0||Pe>0||Ee>0;return jsx(qg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(Ae&&S.hasChildren){let{spent:re,allocated:Pe,quoted:Ee}=ks(S),at=re>Pe&&Pe>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ws(re)}),Pe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-white/60":"text-gray-600",children:ws(Pe)})]}),Ee>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ws(Ee)})]})]})}return jsx(Xg,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:$,hourlyRate:Oe(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Qg,{task:S,isDark:z,locale:f}):jsx(yl,{value:S.assignees||[],availableUsers:l,onChange:Pe=>{r.onTaskUpdate?.({...S,assignees:Pe});},isDark:z,locale:f});case "blockers":return jsx(e0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let re=oe.get(S.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let Pe=S.weight||0;return jsx(Q1,{value:Pe,onChange:Ee=>pe({weight:Ee}),isDark:z})}default:return jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Ae,oe]),Kn=useCallback(S=>{let pe={name:I.columns.name,status:I.columns.status,priority:I.columns.priority,assignees:I.columns.assignees,startDate:I.columns.startDate,endDate:I.columns.endDate,progress:I.columns.progress,tags:I.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:I.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:I.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:I.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:I.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:I.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:I.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:I.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:I.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:I.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:I.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:I.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof pe=="string"?pe:String(pe||S.type)},[I,f]),yo=useMemo(()=>{let pe=Mt.reduce((ke,We)=>ke+We.width,0)+(k?48:0),ye={};for(let ke of Mt)ye[ke.id]=`${ke.width/pe*100}%`;return ye},[Mt,k]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,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:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxs("div",{ref:K,className:g(z?"bg-[#0D0D0D]":"bg-white",O&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ba.length," ",I.pagination.tasks]}),h&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ft,onChange:S=>pt(S.target.value),placeholder:I.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"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}),b&&ee>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:_,onClick:()=>ut(!de),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?de?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":de?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),_r==="all"?f==="es"?"Todos":"All":`L${_r}`]}),de&&jsx("div",{ref:fe,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(ee,5)},(S,X)=>({value:X+1,label:`L${X+1}`}))].map(S=>jsxs("button",{onClick:()=>{ce(S.value),ut(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?_r===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":_r===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),_r===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(T0,{value:je,hideCompleted:dt,onChange:Re,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsx("button",{onClick:()=>Fe(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"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:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 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:I.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:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(S=>{let X=S.id!=="name",pe=ie===S.id&&ve!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",X&&"cursor-grab",S.type!=="name"&&"justify-center",ve===S.id&&"opacity-50",pe&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:yo[S.id],minWidth:S.minWidth},draggable:X,onDragStart:X?ye=>_n(ye,S.id):void 0,onDragEnd:X?Go:void 0,onDragOver:X?ye=>bi(ye,S.id):void 0,onDragLeave:X?Kr:void 0,onDrop:X?ye=>Ds(ye,S.id):void 0,onContextMenu:ye=>Ma(ye,void 0,S.id),children:[X&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:ye=>{let ke=ye.currentTarget.getBoundingClientRect();d(S.id,ke);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),se===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>ha(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",se===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",O===S.id&&"bg-[#00E5CC]"),onMouseDown:ye=>Pn(ye,S.id)})]},S.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),J(X=>!X);},className:g("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",F&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(h0,{isOpen:F,onClose:()=>J(false),columns:Le,customFields:c,mostrarColumnasDensas:w,onColumnsChange:mr,onCreateCustomField:()=>{J(false),Y(true);},isDark:z,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ba.map((S,X)=>{let pe=bt.has(S.id),ye=Math.min(X*.01,.2),ke=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(ke){let{spent:lt,allocated:gt,quoted:rr}=ks(S),gr=J1(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ur=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Ur.type!=="name"&&"justify-center"),style:{width:yo[Ur.id],minWidth:Ur.minWidth},children:Ur.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),gr!==null&&v&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",gr>=1?"text-[#32D74B] bg-[#32D74B]/10":gr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",gr.toFixed(2)]})]})]}):Ur.type==="timeLoggedMinutes"?$==="financial"?(()=>{let Ot=S.executedDollarsCanonical,Kt=Ot!=null?Math.round(Ot):Math.round(ze(S).dollarSpent);return Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:lt>0?lt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="soldEffortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarQuoted);return Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:rr>0?rr:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="effortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarAllocated),St=Math.round(Ot.dollarQuoted),xt=St-Kt;return jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("es-CO")]}):null,xt!==0&&Kt>0&&St>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`]})]})})():jsx(Ia,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):ho(S,Ur)},Ur.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=Be===S.id,Pe=Ue===S.id,Ee=Pe&&Xe==="above",at=Pe&&Xe==="below",$t=Pe&&Xe==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:$t?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:lt=>Ma(lt,S),onMouseEnter:()=>Bt(S.id),onMouseLeave:()=>Bt(lt=>lt===S.id?null:lt),children:[Ee&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:lt=>et(S.id,lt),style:{color:z?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Mt.map(lt=>{let gt=!!(S.subtasks&&S.subtasks.length>0),rr=Qt(lt),Ur=!!rr&&!gt&&Hr===S.id&&!vr,Ot=!!vr&&!!rr&&Zr(vr.column,rr)&&jr(S.id);return jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",lt.type!=="name"&&"justify-center"),style:{width:yo[lt.id],minWidth:lt.minWidth,position:"relative",backgroundColor:Ot?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ot?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:lt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Kt=>{Kt.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?z?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Ur&&rr?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[ho(S,lt),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Kt=>ea(Kt,S.id,rr,X),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):ho(S,lt)},lt.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),W&&Ba.length>0&&(()=>{let{spent:S,allocated:X,quoted:pe}=De,ye=X-S,ke=ye<0,We=ke?`+${ws(Math.abs(ye))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ws(ye)} ${f==="es"?"AHORRADO":"SAVED"}`,re=$==="financial"&&Z>0,Pe=Ce?.breakdown,Ee=!!Pe&&((Pe.equipment??0)>0||(Pe.travel??0)>0),at=Pe?.laborSpent!=null?Pe.laborSpent:Ce?.spent!=null?Ce.spent:De.dollarSpent,$t=Pe?.laborAllocated!=null?Pe.laborAllocated:Ce?.allocated!=null?Ce.allocated:De.dollarAllocated,lt=Ce?.quoted!=null?Ce.quoted:De.dollarQuoted,gt=(Ot,Kt)=>{if(re){let St=Kt??Ot/60*Z;return `$${Math.round(St).toLocaleString("es-CO")}`}return ws(Ot)},rr=re?Math.abs($t-at):0,gr=re?`+$${rr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,Ur=re&&Ee?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ot=>jsx("div",{className:g("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:yo[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ur&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Ur]})]}):Ot.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(S,re?at:void 0)}),jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,re?$t:void 0)})]}),X>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?gr:We})]}):Ot.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?gt(pe,re?lt:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(re&&pe>0&&X>0){let Kt=Math.round(lt),St=Math.round($t),xt=Kt-St,Mr=Kt>0?Math.round(xt/Kt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,$t)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>=0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Mr,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?gt(X,re?$t:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?gt(S,re?at:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let Kt=L0(zd(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Kt,"%"]})})():Ot.type==="weight"?(()=>{let Kt=e||[],St=[],xt=pa=>{for(let qr of pa)St.push(qr),qr.subtasks?.length&&xt(qr.subtasks);};xt(Kt);let ya=St.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),Ca=Math.abs(ya-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Ca?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ya.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ba.length===0&&ft&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsx(D0,{data:He.data,isDark:z,locale:f,onClose:()=>Fe(false),lens:t?.lens,onUnassignedTaskClick:S=>{let X=document.querySelector(`[data-task-id="${S}"]`);X&&(X.scrollIntoView({behavior:"smooth",block:"center"}),Qe(S),setTimeout(()=>Qe(null),2e3));}})]}),jsx(i0,{state:ue,onClose:zo,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:tn,onColumnSort:lr,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),xe&&mt&&Be&&createPortal(jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let X=Te.flattenTasks(e).find(pe=>pe.id===Be);return X?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsx(v0,{isOpen:R,onClose:()=>Y(false),onSave:Ga,isDark:z,locale:f})]})}var B0=[{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:"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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",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},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],$0=[{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"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],O0=[{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 Gd={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:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Vd={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:"#00E5CC"},jd={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"},Ml={dark:Gd,light:Vd,neutral:jd};function H0(e){return Ml[e]||Ml.dark}function Pl(e,t,r,a,n=5){let s=[],o=[],l=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of l){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let c={};for(let p=r;p<=a;p++)c[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)c[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function U0(e){return e==="es"?Z1:eC}function W0(e){return (e.getDay()+6)%7}function z0(e,t){let r=new Date(e,t,1),a=W0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},l=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},c=l(r),i=new Date(e,t+1,0),d=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:d}}function ii(e,t){return W0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&r(o.subtasks,l,c);}};return r(e,"",""),t}function G0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function V0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Fl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),l=42,c=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=G0(d.startDate),f=G0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?V0(v):V0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?nC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=aC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(x,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function j0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var _d=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ll({locale:e}){let t=U0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Al({bar:e,ws:t,money:r,projColor:a,slotH:n=_d}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":e.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function Il({chip:e,ws:t,slotH:r=_d}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:iC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Rl({more:e,ws:t,slotH:r=_d,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function _0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function K0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:uC.map(o=>jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function q0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=useState(false),x=useRef(null),h=d==="es";useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function Y0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function J0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var X0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function Q0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=X0[r]||X0.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),a?jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function ef(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Z0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return Z0[e%Z0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var Kd="\xA0";function Bo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function tf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(ef(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:vC(c),initials:xC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((c.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function rf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=ef(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:m,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:p=>{!c||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!c||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${Kd}/${Kd}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Bo(l.assigned),"h"]}),jsxs("span",{children:["/",Kd,Bo(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function af({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Bo(s),"h asignadas / ",Bo(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Bo(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Bo(i.hours),"h / ",Bo(i.capacity),"h"]})]},i.name)})})]})}var qd=28,CC=182;function of({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=l==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),c&&c[x]?jsx(rf,{days:c[x].days,capByDay:c[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),m=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:p,children:[jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ii(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Al,{bar:f,ws:t,money:s,projColor:o,slotH:qd})},`b${x}`)),d.chips.map((f,x)=>jsx(Il,{chip:f,ws:t,slotH:qd},`c${x}`)),d.more.map((f,x)=>jsx(Rl,{more:f,ws:t,slotH:qd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function sf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function lf(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?sf(l):sf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function cf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function df({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ts(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function uf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=n==="es";useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Ts(r.oldProjectEnd,n)} \u2192 ${Ts(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Ts(r.oldStart,n)," \u2013 ",Ts(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[Ts(r.newStart,n)," \u2013 ",Ts(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function pf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxs("button",{type:"button",onClick:()=>l?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Bl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Yd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function mf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Bl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Bl(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=l(f);x>u&&(u=x);}let p=Yd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function gf(e,t,r){let a=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Bl(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Yd(p)*864e5));}s.set(c.id,d===1/0?r:d);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Bl(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function $l(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=mf(n,new Map),i=gf(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=mf(d,new Map([[t,r.getTime()]])),u=gf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Yd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function ff(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Ol=26,$C="#5B7FD4";function bf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=useState("mes"),[k,M]=useState(()=>{let j=new Date,xe={y:j.getFullYear(),m:j.getMonth()},Ie=(e??[]).map(Xe=>Xe.startDate?new Date(Xe.startDate):null).filter(Xe=>!!Xe&&!isNaN(Xe.getTime()));if(Ie.length===0||(e??[]).some(Xe=>{let Dt=Xe.startDate?new Date(Xe.startDate):null,mt=Xe.endDate?new Date(Xe.endDate):Dt;if(!Dt||isNaN(Dt.getTime()))return false;let Jt=new Date(xe.y,xe.m,1),xr=new Date(xe.y,xe.m+1,0,23,59,59);return Dt<=xr&&(mt??Dt)>=Jt}))return xe;let Ct=Ie.reduce((Xe,Dt)=>Xe<Dt?Xe:Dt);return {y:Ct.getFullYear(),m:Ct.getMonth()}}),[B,T]=useState(false),[C,P]=useState([]),[D,V]=useState("all"),[$,Z]=useState(null),[L,Ae]=useState(null),[W,Ce]=useState(false),[I,z]=useState(null),[Oe,ze]=useState(false),Q=useMemo(()=>z0(k.y,k.m),[k.y,k.m]),De=a||$C,oe=useMemo(()=>{let j=new Set;for(let xe of h){let Ie=new Date(`${xe}T12:00:00`),Ue=Q.dateToSerial(Ie);Ue>=1&&Ue<=42&&j.add(Ue);}return j},[h,Q]);useEffect(()=>{y?.({start:ff(Q.serialToDate(1)),end:ff(Q.serialToDate(42))});},[k.y,k.m]);let He=x.length,Se=useMemo(()=>{let j=b?.hoursPerDay;if(!j)return 8;let xe=[j.monday,j.tuesday,j.wednesday,j.thursday,j.friday].map(Ie=>Ie||0).filter(Ie=>Ie>0);return xe.length?Math.round(xe.reduce((Ie,Ue)=>Ie+Ue,0)/xe.length*10)/10:8},[b]),Fe=useMemo(()=>Fl({tasks:e,grid:Q,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,Q,De,o,r]),Ge=useMemo(()=>{if(d===false)return [];let j=new Map;for(let xe of Fe.calTasks)xe.phaseId&&xe.phaseName&&j.set(xe.phaseId,xe.phaseName);return [...j.entries()].map(([xe,Ie])=>({id:xe,name:Ie})).sort((xe,Ie)=>xe.name.localeCompare(Ie.name))},[Fe.calTasks,d]),Qe=!C.includes("tareas"),se=!C.includes("cpm"),Ze=useMemo(()=>{let j=Qe?Fe.calTasks:[];return D!=="all"&&(j=j.filter(xe=>xe.phaseId===D)),se||(j=j.map(xe=>xe.critical?{...xe,critical:false}:xe)),j},[Fe.calTasks,Qe,se,D]),_e=useMemo(()=>{let j=new Set;return C.includes("hitos")&&(j.add("hito"),j.add("desembolso")),C.includes("ext")&&j.add("ext"),C.includes("aus")&&j.add("aus"),Fe.dayItems.filter(xe=>!j.has(xe.type))},[Fe.dayItems,C]),$e=!C.includes("festivos"),ft=new Date,pt=Q.dateToSerial(new Date(ft.getFullYear(),ft.getMonth(),ft.getDate())),je=j=>P(xe=>xe.includes(j)?xe.filter(Ie=>Ie!==j):[...xe,j]),Re=()=>M(j=>{let xe=new Date(j.y,j.m-1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),dt=()=>M(j=>{let xe=new Date(j.y,j.m+1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),zt=()=>{let j=new Date;M({y:j.getFullYear(),m:j.getMonth()});},Le=(j,xe,Ie)=>{if(!p||xe===0)return;let Ue=Fe.calTasks.find(Jt=>Jt.uid===j);if(!Ue)return;let Ct=xe*864e5,Xe=new Date(Ue.realStart.getTime()+Ct),Dt=new Date(Ue.realEnd.getTime()+Ct),mt=$l(e,j,Xe,Dt);mt&&z({uid:j,taskId:Ue.id,taskName:Ue.name,sim:mt,anchor:Ie});},st=async()=>{if(!I||!f)return;ze(true);let j=[{id:I.uid,startDate:I.sim.newStart,endDate:I.sim.newEnd},...I.sim.movedSuccessors.map(Ie=>({id:Ie.id,startDate:Ie.newStart,endDate:Ie.newEnd}))],xe=await f(j);ze(false),xe&&z(null);},F=j0(k.y,k.m,n),J=[{id:"",name:t,color:De}],R=useMemo(()=>lf(e,o),[e,o]),Y=useMemo(()=>{if(v==="lookahead"){let j=Q.weeks.find(Ie=>pt>=Ie.ws&&pt<=Ie.we)??Q.weeks[0],xe=Q.weeks.indexOf(j);return Q.weeks.slice(xe,xe+2)}return v==="semana"?[Q.weeks.find(xe=>pt>=xe.ws&&pt<=xe.we)??Q.weeks[0]]:[]},[v,Q.weeks,pt]),ue=useMemo(()=>{let j={};return Y.forEach((xe,Ie)=>{let Ue=[];for(let Xe=xe.ws;Xe<=xe.we;Xe++)Ue.push({serial:Xe,date:Q.serialToDate(Xe),isWeekend:ii(Q,Xe),isHoliday:oe.has(Xe)});let Ct=tf(x,Ue,Se);j[Ie]={days:Ue,capByDay:Ct};}),j},[Y,Q,oe,x,Se]),he=v==="semana"||v==="lookahead",Be=v==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(K0,{view:v,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx(q0,{monthLabel:F,onPrev:Re,onNext:dt,onToday:zt,layersOpen:B,onToggleLayers:()=>T(j=>!j),layersOff:C,phases:Ge,phaseFilter:D,onPhaseChange:V,locale:n,children:B?jsx(Y0,{off:C,onToggle:je}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsx(pf,{grid:Q,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx(of,{grid:Q,weeks:Y,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,capRows:ue,teamSize:He,onTaskOpen:i,onMore:(j,xe,Ie)=>Z({day:j,items:xe,tasks:Ie}),onCapDay:(j,xe,Ie)=>{for(let Ue of Object.keys(ue)){let Ct=ue[+Ue].capByDay.get(j);if(Ct){Ae({dayLabel:xe,perPerson:Ct.perPerson,anchor:Ie.getBoundingClientRect()});break}}}})]}):Fe.isEmpty?jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsx(hf,{grid:Q,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsx(Q0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsx(OC,{grid:Q,ws:j.ws,we:j.we,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,onTaskOpen:i,onMore:(xe,Ie,Ue)=>Z({day:xe,items:Ie,tasks:Ue}),canReschedule:p,onDragReschedule:Le,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsx(J0,{dayLabel:`${Q.serialToDate($.day).getDate()}`,items:$.items,tasks:$.tasks.map(j=>({swatch:De,taskId:j.id,label:j.name,critical:j.critical,value:l==="$"?j.cost:`${j.hrs}h`})),onClose:()=>Z(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,L?jsx(af,{dayLabel:L.dayLabel,perPerson:L.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${L.anchor.top-8}px`,left:`${L.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,I?jsx(uf,{taskName:I.taskName,taskId:I.sim.taskId,sim:I.sim,busy:Oe,locale:n,onConfirm:st,onCancel:()=>z(null),style:{position:"fixed",top:`${I.anchor.top+12}px`,left:`${Math.min(I.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),W?jsx(cf,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsx(df,{onExpand:()=>Ce(true)})]}),jsx(_0,{projects:J})]})}function hf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=r;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,m=n&&s.has(c),u="cal-day";return ii(e,c)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxs("div",{className:u,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(BC,h.laneCount*Ol+36),v=useRef(null),[w,k]=useState(null),M=(B,T)=>{if(!p||!f){m?.(T);return}B.preventDefault();let C=v.current;if(!C)return;let P=C.getBoundingClientRect().width/7,D=B.clientX,V=0,$=L=>{let Ae=Math.round((L.clientX-D)/P);V=Ae,k({id:T,days:Ae});},Z=L=>{if(window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",Z),k(null),V===0){m?.(T);return}let Ae=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Ae);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",Z);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(hf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=x?.uid===B.t.uid?x.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsx("div",{onPointerDown:Z=>M(Z,B.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(Al,{bar:$,ws:t,money:s,projColor:o,slotH:Ol})},`b${T}`)}),h.chips.map((B,T)=>jsx(Il,{chip:B,ws:t,slotH:Ol},`c${T}`)),h.more.map((B,T)=>jsx(Rl,{more:B,ws:t,slotH:Ol,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=useState(false),d=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:g("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:m.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:p=>{p.stopPropagation(),o?.(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:[m.uniqueAssignees," assignees"]})]}),m.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:[m.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:d.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:d.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.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"})]})})]},p.id))})})]})}var xf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ci(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 di(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 vf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function wf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...xf,...o}),[o]),[i,d]=useState(new Set),m=useRef(null),u=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),B=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:B<7?`${B}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),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:g("history-timeline",c.compact&&"compact",l),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:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[di(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let k=i.has(v.id),M=s===v.id,B=vf(v.type);return jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:di(v.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),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&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:ci(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,C])=>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(C.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,C])=>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(C)})]},T))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function Cf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let d=[.5,1,1.5,2,3],m=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("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:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&di(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ci(m)}),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:m&&m.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:p=>l(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:ci(p)},p.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:n,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:o,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:d.map(p=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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:m&&m.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(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,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:"#00E5CC",child_of:"#00C4AE",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 Tf(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 Nf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Df({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[d,m]=useState([]),[u,p]=useState(null),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=_C(e,t,r.width,r.height,r,150);m($);},[e,t,r]);let M=useCallback(($,Z)=>{r.enableDragging&&(Z.stopPropagation(),p($));},[r.enableDragging]),B=useCallback($=>{if(!u||!i.current)return;let L=i.current.getBoundingClientRect(),Ae=($.clientX-L.left-w.x)/y,W=($.clientY-L.top-w.y)/y;m(Ce=>Ce.map(I=>I.id===u?{...I,x:Ae,y:W,fx:Ae,fy:W}:I));},[u,y,w]),T=useCallback(()=>{p(null);},[]),C=useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),P=useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),D=useCallback($=>{let Z=d.find(L=>L.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[d]),V=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Z=$.card.priority;return Z==="URGENT"?"#ef4444":Z==="HIGH"?"#f59e0b":Z==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("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:g("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:o.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:o.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"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Tf($)," ",Qd($)]})]},$))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Z=D(typeof $.source=="string"?$.source:$.source.id),L=D(typeof $.target=="string"?$.target:$.target.id),Ae=Nf($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsx("line",{x1:Z.x,y1:Z.y,x2:L.x,y2:L.y,stroke:Jd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsx("text",{x:(Z.x+L.x)/2,y:(Z.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let Z=f===$.id,L=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",Z&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>M($.id,Ae),onMouseEnter:()=>x($.id),onMouseLeave:()=>x(null),onClick:Ae=>C($,Ae),children:[jsx("circle",{r:L?r.nodeSize*1.2:r.nodeSize,fill:V($),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:Z?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 Mf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,d]=useState(null),[m,u]=useState(null),p=useRef(null),f=l||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{m&&(r(m),x());};return e?jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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:y=>y.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-[#00E5CC]",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:x,disabled:f,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:m?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!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((y,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((y,v)=>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:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},v)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.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:p,value:s,onChange:y=>o(y.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-[#00E5CC]/50 transition-all resize-none",disabled:f}),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((y,v)=>jsx("button",{onClick:()=>o(y),disabled:f,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:y},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:x,disabled:f,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"}),m?jsx("button",{onClick:b,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:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Zd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ui(e){return `$${e.toFixed(4)}`}var eu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),l=r.filter(m=>m.success),c=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(d=>d.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Oo=new eu;function Lf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(Oo.getStats()),[s,o]=useState(Oo.checkLimit(r));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Oo.getStats()),o(Oo.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),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 l=Oo.getRecentOperations(5);return jsxs(nr,{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-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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 (",r.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:ui(a.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-[#00E5CC] mt-1",children:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,m=a.totalOperations>0?i/a.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:ui(d)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.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:ui(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 Rf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[d,m]=useState(""),[u,p]=useState(false),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(null),w=useRef(null),k=u||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=D=>{D.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),m(""),x(null),b(null),v(null),t());},B=async()=>{if(!(!o.trim()||k)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),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:P=>P.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-[#00E5CC]",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:M,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:h?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:[y?.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"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",C,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>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:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.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:w,value:o,onChange:P=>l(P.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-[#00E5CC]/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:P=>i(P.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-[#00E5CC]/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:d,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((P,D)=>jsx("button",{onClick:()=>l(P),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:P},D))})]})]})}),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-[#00E5CC] 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:M,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"}),h?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:B,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(h=>{t&&ki(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{a(v=>{let w=v.cards.find(P=>P.id===h);if(!w)return v;let k=w.columnId,M={...w,columnId:b,position:y},B=v.cards.map(P=>P.id===h?M:P),T=v.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(D=>D!==h)};if(P.id===b){let D=B.filter(V=>V.columnId===b).sort((V,$)=>V.position-$.position);return {...P,cardIds:D.map(V=>V.id)}}return P}),C={...v,cards:B,columns:T};return n(C),C});},[n]),o=useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:v};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,v],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let v=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(B=>B!==h)}:M),k={...b,cards:v,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:v};return n(w),w});},[n]),m=useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),v=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),p=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:c,deleteColumn:m,clearBoard:f}}}function $f({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Wl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(m=>m.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var pi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Hf={by:"none",order:"asc"};function Uf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...pi,...e}),[s,o]=useState({...Hf,...t}),l=useCallback(x=>{n(h=>({...h,...x}));},[]),c=useCallback(x=>{o(h=>({...h,...x}));},[]),i=useCallback(()=>{n(pi),o(Hf);},[]),d=useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),m=useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),u=useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${v}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let B=M.endDate||M.dueDate;if(!B)return false;let T;if(typeof B=="string")T=B.split("T")[0]||B;else {let C=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),D=String(B.getUTCDate()).padStart(2,"0");T=`${C}-${P}-${D}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let C=new Date(k+"T00:00:00"),P=new Date(T+"T00:00:00"),D=new Date(C);return D.setDate(D.getDate()+7),P>=C&&P<=D;case "custom":if(a.dateRange){let V=typeof B=="string"?new Date(B):B;return V>=a.dateRange.start&&V<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;v=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=M[b.priority||"LOW"],T=M[y.priority||"LOW"];v=B-T;break;case "dueDate":let C=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!C)return 1;if(!P)return -1;let D=typeof C=="string"?new Date(C).getTime():C.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();v=D-V;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,Z=y.estimatedTime||0;v=$-Z;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var zf,Gf;if(typeof window<"u")try{let e=xi("ai");zf=e.generateObject,Gf=e.generateText;}catch{}function Vf(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(zf&&Gf&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),c=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function ru(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function jf(e){let{cards:t}=e,[r,a]=ru(),n=useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,k]=y<v?[y,v]:[v,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:d}}var _f={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Kf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({..._f,...r}),[r]),[s,o]=useState([]),l=useCallback((x,h,b,y,v)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=useCallback(async x=>{let h=t.filter(k=>k.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let v=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{v.has(M)||v.set(M,[]),v.get(M).push(k);});}),v.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${B} ${M} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let B=(await a.findSimilar(k,h)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(B.length>=n.minCardsPerStack-1){let T=[k.id,...B.map(P=>P.card.id)],C=B.reduce((P,D)=>P+D.similarity,0)/B.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:C});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var qf=createContext(null);function Yf({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=xi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=xi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=xi("@libxai/core");l=new c(t.board);}a.current=new BoardStore({board:l,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(qf.Provider,{value:{store:n},children:e})}function zl(){let e=useContext(qf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=zl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=useCallback(y=>{e.deleteColumn(y);},[e]),m=useCallback(y=>e.getColumn(y),[e]),u=useCallback(y=>{e.addCard(y);},[e]),p=useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),x=useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Jf(e){let{cards:t}=gi();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Qf(e="position",t="asc"){let{cards:r}=gi();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var Gl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=$u.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Gl;function eb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:n,children:jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=c?c(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},h)})})})}function tb(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 ab({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let d=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:p,className:s,children:jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=c?c(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function nb(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 ob(e,t=10){return e>t}var su={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},iu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},cu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},du={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mu={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)"},gu={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)"},fu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bu={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}},hu={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}},Vl={spacing:su,borderRadius:iu,fontSize:lu,fontWeight:cu,lineHeight:du,zIndex:uu,duration:pu,easing:mu,shadows:gu,opacity:fu,kanban:bu,gantt:hu};function sb(e,t,r){return e[t]??r}function yu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?yu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xu(e="asakaa"){let t=yu(Vl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
414
|
+
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:l})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function Vg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.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)),n>0&&jsxs("span",{className:g("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:["+",n]})]})}function Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let l=parseFloat(a[1]),c=a[2]?parseInt(a[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=useState(false),[p,f]=useState(""),x=useRef(null),{isFlashing:h,triggerFlash:b}=bs(),y=c==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),C=e%60;T>0&&C>0?f(`${T}h ${C}m`):T>0?f(`${T}h`):f(`${C}m`);}else f("");},[e,m]);let k=()=>{let T=Bk(p);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let B=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:p,onChange:T=>f(T.target.value),onBlur:k,onKeyDown:M,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function qg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(r==null)return null;let c=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Xg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=r==="es",d=l==="financial"&&c>0,m=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,p]=useState(false),[f,x]=useState(false),[h,b]=useState(null),y=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(v/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?v/w*100:0,C=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(x(false),b(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,h]);let D=W=>{if(W.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{x(false),b(W);},$=async(W,Ce)=>{h==="log"&&a&&W?a(e,W,Ce):h==="estimate"&&n?n(e,W):h==="quoted"&&s&&s(e,W),b(null);},Z=a||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Ae=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&v===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&Z&&jsx("button",{onClick:D,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&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:L.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(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:[(()=>{let W=v===0,I=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(B)]}),C>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:I?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:I?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(C)," ",i?"Excedido":"Over"]})]})})(),w>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(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Z&&jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&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:L.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),V(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Jg({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Qg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsx(Jg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?Vk(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Jg,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function e0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function i0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=useRef(null),y=a==="es"?a0.es:a0.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let C=b.current;if(!C)return;let P=C.getBoundingClientRect(),D=8,V=e.x,$=e.y;e.y+P.height>window.innerHeight-D&&($=Math.max(D,e.y-P.height)),e.x+P.width>window.innerWidth-D&&(V=Math.max(D,window.innerWidth-P.width-D)),(V!==e.x||$!==e.y)&&w({left:V,top:$});},[e.x,e.y,e.isOpen]),useEffect(()=>{let C=D=>{b.current&&!b.current.contains(D.target)&&t();},P=D=>{D.key==="Escape"&&t();};return document.addEventListener("mousedown",C),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let C=[];return n&&C.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),C.push({id:"sep1",label:"",icon:null,separator:true}),l&&(C.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),C.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),d.length>0&&C.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let D=e.task.assignees||[],$=D.some(Z=>Z.name===P.name)?D.filter(Z=>Z.name!==P.name):[...D,{name:P.name,initials:s1(P.name),color:P.color||i1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),m&&C.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&C.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&C.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),C},M=()=>{if(!e.columnId)return [];let C=[];return i&&(C.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(C.push({id:"sep-hide",label:"",icon:null,separator:true}),C.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:B.map(C=>C.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsx(l1,{item:C,isDark:r},C.id):jsxs("button",{onClick:C.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",C.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function l1({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("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:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("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(l=>jsxs("button",{onClick:l.onClick,className:g("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:l.icon}),l.label]},l.id))})]})}var a0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",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",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",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 f0={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"}),weight:jsx(BarChart,{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"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function h0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=useState(""),[m,u]=useState(null),[p,f]=useState(null),x=useRef(null),h=c==="es"?b0.es:b0.en;useLayoutEffect(()=>{if(!e||!x.current)return;let C=()=>{if(!x.current)return;let P=x.current.parentElement;if(P){let Z=P.getBoundingClientRect();f({top:Z.bottom+4,right:window.innerWidth-Z.right});}let D=x.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{x.current&&!x.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),x._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),x._cleanup&&x._cleanup();}},[e,t]);let b=useMemo(()=>{let C=new Set([...N1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&C.add(P.type);}),Array.from(C)},[r]);if(!e)return null;let y=C=>{let P=h.columns[C];if(P)return P;let D=r.find(V=>V.type===C);return D?.label?D.label:C},v=C=>{if(C==="name")return;let P=r.map(D=>D.id===C?{...D,visible:!D.visible}:D);n(P);},w=(C,P)=>{let D=r.find($=>$.type===C&&(!P||$.customFieldId===P));if(D){v(D.id);return}let V={id:P||C,type:C,label:P?a.find($=>$.id===P)?.name||C:y(C),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(C=>C!=="assignees"&&(o||!k.includes(C))&&y(C).toLowerCase().includes(i.toLowerCase())),B=a.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),T=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:x,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",C.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent",C.currentTarget.style.color=l?"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:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:C=>d(C.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"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:C=>{C&&C.style.setProperty("--focus-border",T);},onFocus:C=>{C.currentTarget.style.borderColor=T,C.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:C=>{C.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",C.currentTarget.style.background=l?"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:C=>C.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(C=>{let P=r.find($=>$.type===C&&!$.customFieldId),D=P?.visible??false,V=C==="name";return jsxs("button",{onClick:()=>{V||(P?v(P.id):w(C));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:$=>{V||($.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.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:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&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:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(C),children:y(C)})]},C)})})]}),B.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxs("button",{onClick:()=>w(C.type,C.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.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:D?T:"transparent",border:D?`1.5px solid ${T}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${T}40`:"none"},children:D&&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:D?T:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:f0[C.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:C.name})]},C.id)})})]})]})]})}var b0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var I1=[{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 v0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,d]=useState([""]),m=n==="es"?x0.es:x0.en;useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var x0={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 C0={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 T0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),d=s==="es"?C0.es:C0.en;useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",u&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),d.filters,u&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs("button",{onClick:()=>{r(p.value),a(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function N0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function D0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("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"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=c-d,u=c>0?Math.round(m/c*100):0,p=c-i,f=c>0?Math.round(p/c*100):0,x=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=v>0||w>0,M=(B,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=v>0||w>0,M=(B,T)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(T)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),v>0&&M(o?"Activos":"Equipment",v),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(c/i*100),100):0,p=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:N0(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:N0(i)})]}),i>0&&jsx("div",{className:g("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:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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 c=e.scheduleVarianceDays??0,i=c>0,d=c<0,m=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let d=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:g("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(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var X1=[{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 I0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...I0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ks(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ks(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ws(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function L0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,r+=c,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let d=i.effort_minutes||60;l+=(i.progress||0)*d,c+=d;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function zd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?zd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function R0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:B=true,showCreateTaskButton:T=false,onCreateTask:C,persistFilter:P=false,financialBlur:D,healthSidebar:V,lens:$="hours",hourlyRate:Z=0,rateMap:L,aggregateParentHours:Ae=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,I=fl(f,x),z=p==="dark",Oe=S=>{if(!L||!S.assignees||S.assignees.length===0)return Z;let X=0,pe=0;for(let ke of S.assignees){let We=ke.id?L[ke.id]:void 0;if(We==null||We<=0)continue;let re=typeof ke.estimatedMinutes=="number"?ke.estimatedMinutes:0;re>0&&(X+=We*re,pe+=re);}if(pe>0)return X/pe;let ye=S.assignees.map(ke=>ke.id?L[ke.id]:void 0).filter(ke=>ke!=null&&ke>0);return ye.length===0?Z:ye.reduce((ke,We)=>ke+We,0)/ye.length},ze=S=>{let X=0,pe=0,ye=0,ke=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let Pe={s:X,a:pe,q:ye};if(ke(re.subtasks),X-Pe.s+(pe-Pe.a)+(ye-Pe.q)===0){let at=Oe(re);X+=(re.timeLoggedMinutes??0)/60*at,pe+=(re.effortMinutes??0)/60*at,ye+=(re.soldEffortMinutes??0)/60*at;}}else {let Pe=Oe(re);X+=(re.timeLoggedMinutes??0)/60*Pe,pe+=(re.effortMinutes??0)/60*Pe,ye+=(re.soldEffortMinutes??0)/60*Pe;}};return S.subtasks&&ke(S.subtasks),{dollarSpent:X,dollarAllocated:pe,dollarQuoted:ye}},Q=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let X=JSON.parse(S);return {statusFilter:X.statusFilter||"all",hideCompleted:X.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),De=useMemo(()=>{function S(X){let pe=0,ye=0,ke=0,We=0,re=0,Pe=0;for(let Ee of X)if(Ee.subtasks&&Ee.subtasks.length>0){let at=S(Ee.subtasks);if(at.spent+at.allocated+at.quoted>0)pe+=at.spent,ye+=at.allocated,ke+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,Pe+=at.dollarQuoted;else {let lt=Ee.timeLoggedMinutes??0,gt=Ee.effortMinutes??0,rr=Ee.soldEffortMinutes??0;pe+=lt,ye+=gt,ke+=rr;let gr=Oe(Ee);We+=lt/60*gr,re+=gt/60*gr,Pe+=rr/60*gr;}}else {let at=Ee.timeLoggedMinutes??0,$t=Ee.effortMinutes??0,lt=Ee.soldEffortMinutes??0;pe+=at,ye+=$t,ke+=lt;let gt=Oe(Ee);We+=at/60*gt,re+=$t/60*gt,Pe+=lt/60*gt;}return {spent:pe,allocated:ye,quoted:ke,dollarSpent:We,dollarAllocated:re,dollarQuoted:Pe}}return S(e)},[e]),oe=useMemo(()=>{let S=new Map;function X(pe){let ye=0;for(let ke of pe)if(ke.subtasks&&ke.subtasks.length>0){let We=X(ke.subtasks);S.set(ke.id,We),ye+=We;}else ye+=ke.weight||0;return ye}return X(e),S},[e]),He=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Fe]=useState(true),[Ge,Qe]=useState(null),[se,Ze]=useState("position"),[_e,$e]=useState("asc"),[ft,pt]=useState(""),[je,Re]=useState(()=>Q().statusFilter),[dt,zt]=useState(()=>Q().hideCompleted),[Le,st]=useState(y||X1),[F,J]=useState(false),[R,Y]=useState(false),[ue,he]=useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=useState(null),[xe,Ie]=useState(false),[Ue,Ct]=useState(null),[Xe,Dt]=useState(null),[mt,Jt]=useState(null),xr=useRef(0),Er=useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,Bt]=useState(null),[vr,Gt]=useState(null),Qt=S=>{let X=S.type;return S.customFieldId?X==="file"?null:{kind:"customField",fieldId:S.customFieldId}:X==="assignees"||X==="teamLoad"?"assignees":X==="startDate"?"startDate":X==="endDate"?"endDate":null},Zr=(S,X)=>typeof S=="string"||typeof X=="string"?S===X:S.fieldId===X.fieldId,ba=useRef([]),et=useCallback((S,X)=>{Rt&&(X.preventDefault(),xr.current=X.clientY,j(S),Er.current=false,Ie(false),Jt({x:X.clientX,y:X.clientY}));},[Rt]),Ke=useCallback(S=>{if(!Be||(Math.abs(S.clientY-xr.current)>5&&!Er.current&&(Er.current=true,Ie(true)),Jt({x:S.clientX,y:S.clientY}),!Er.current))return;let pe=document.querySelectorAll("[data-listview-row]"),ye=null,ke=null;pe.forEach(We=>{let re=We.getBoundingClientRect(),Pe=We.getAttribute("data-listview-row");if(Pe&&Pe!==Be&&S.clientY>=re.top&&S.clientY<=re.bottom){ye=Pe;let Ee=S.clientY-re.top,at=re.height;ke=Ee<at*.25?"above":Ee>at*.75?"below":"child";}}),Ct(ye),Dt(ke);},[Be]),sa=useCallback(()=>{if(Er.current&&Be&&Ue&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Be,Ue);else if(Xe==="above"||Xe==="below"){let S=(ye,ke,We=null)=>{for(let re of ye){if(re.id===ke)return We;if(re.subtasks){let Pe=S(re.subtasks,ke,re.id);if(Pe!==void 0)return Pe}}},X=S(e,Be,null),pe=S(e,Ue,null);if(r.onTaskReparent){let ye=(at,$t)=>{if($t===null)return at;for(let lt of at){if(lt.id===$t)return lt.subtasks||[];if(lt.subtasks){let gt=ye(lt.subtasks,$t);if(gt.length>0||lt.subtasks.some(rr=>rr.id===$t))return gt}}return []},ke=ye(e,pe??null),We=ke.findIndex(at=>at.id===Ue),re=X===pe,Pe=re?ke.findIndex(at=>at.id===Be):-1,Ee=Xe==="below"?We+1:We;re&&Pe!==-1&&Pe<We&&(Ee-=1),r.onTaskReparent(Be,pe??null,Math.max(0,Ee));}}}j(null),Ct(null),Dt(null),Jt(null),Er.current=false,Ie(false);},[Be,Ue,Xe,e,r]),Vr=(S,X)=>typeof X!="string"?S.customFields?.find(ye=>ye.fieldId===X.fieldId)?.value:X==="assignees"?S.assignees:X==="startDate"?S.startDate:S.endDate,ea=(S,X,pe,ye)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ke=Array.from(document.querySelectorAll("[data-listview-row]")),We=ke.map(St=>St.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(X)),Pe=St=>We.slice(re,St+1);Gt({sourceTaskId:X,column:pe,sourceIndex:ye,targetIndex:ye,rangeIds:new Set([X])});let at=(St=>{let xt=St?.parentElement??null;for(;xt;){let Ca=window.getComputedStyle(xt).overflowY;if((Ca==="auto"||Ca==="scroll")&&xt.scrollHeight>xt.clientHeight)return xt;xt=xt.parentElement;}let Mr=document.scrollingElement;return Mr&&Mr.scrollHeight>Mr.clientHeight?Mr:null})(S.currentTarget),$t=St=>{let xt=re,Mr=false;ke.forEach((Ca,pa)=>{let qr=Ca.getBoundingClientRect();St>=qr.top&&St<=qr.bottom&&(xt=pa,Mr=true);});let ya=ke[ke.length-1];if(!Mr&&ya){let Ca=ya.getBoundingClientRect();St>Ca.bottom&&(xt=ke.length-1);}return xt<re&&(xt=re),xt},lt=S.clientY,gt=null,rr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},gr=()=>{let St=$t(lt),xt=new Set(Pe(St));Gt(Mr=>Mr&&{...Mr,targetIndex:St,rangeIds:xt});},Ur=()=>{if(rr(),!at)return;let St=at,Mr=St===document.scrollingElement?{top:0,bottom:window.innerHeight}:St.getBoundingClientRect(),ya=60,Ca=12,pa=lt-Mr.top,qr=Mr.bottom-lt,Fn=St.scrollHeight-St.clientHeight;if(qr<ya&&St.scrollTop<Fn){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,qr)/ya))),xo=()=>{St.scrollTop+=Ss,gr(),St.scrollTop<St.scrollHeight-St.clientHeight&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}else if(pa<ya&&St.scrollTop>0){let Ss=Math.max(1,Math.round(Ca*(1-Math.max(0,pa)/ya))),xo=()=>{St.scrollTop-=Ss,gr(),St.scrollTop>0&&(gt=requestAnimationFrame(xo));};gt=requestAnimationFrame(xo);}},Ot=St=>{lt=St.clientY,gr(),Ur();},Kt=St=>{window.removeEventListener("mousemove",Ot),window.removeEventListener("mouseup",Kt),rr(),document.body.style.cursor="",document.body.style.userSelect="",Gt(null);let xt=$t(St.clientY),Mr=new Map(ba.current.map(qr=>[qr.id,qr])),ya=Mr.get(X);if(!ya)return;let Ca=Vr(ya,pe),pa=[];for(let qr of Pe(xt)){if(qr===X)continue;let Fn=Mr.get(qr);Fn&&(Fn.subtasks&&Fn.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,pe,Ca);};window.addEventListener("mousemove",Ot),window.addEventListener("mouseup",Kt);},jr=S=>vr?vr.rangeIds.has(S):false;useEffect(()=>{if(Be)return document.addEventListener("mousemove",Ke),document.addEventListener("mouseup",sa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ke),document.removeEventListener("mouseup",sa),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,Ke,sa]);let[_r,ce]=useState("all"),[de,ut]=useState(false),_=useRef(null),fe=useRef(null),ee=useMemo(()=>{let S=0;function X(pe,ye){for(let ke of pe)ye>S&&(S=ye),ke.subtasks?.length&&X(ke.subtasks,ye+1);}return X(e,1),S},[e]);useEffect(()=>{if(!de)return;let S=X=>{_.current?.contains(X.target)||fe.current?.contains(X.target)||ut(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),useEffect(()=>{if(_r==="all"){let pe=function(ye){for(let ke of ye)ke.subtasks?.length&&(ke.isExpanded===false&&r.onTaskToggleExpand?.(ke.id),pe(ke.subtasks));};pe(e);}else {let pe=function(ye,ke){for(let We of ye)if(We.subtasks?.length){let re=ke<_r,Pe=We.isExpanded!==false;re!==Pe&&r.onTaskToggleExpand?.(We.id),pe(We.subtasks,ke+1);}};pe(e,1);}},[_r]);let[O,te]=useState(null),[we,N]=useState(0),[H,me]=useState(0),K=useRef(null),[ve,nt]=useState(null),[ie,ot]=useState(null);useEffect(()=>{y&&st(S=>{if(S.length===y.length){let X=true;for(let pe=0;pe<S.length;pe++){let ye=S[pe],ke=y[pe];if(!ye||!ke||ye.id!==ke.id||ye.visible!==ke.visible||ye.width!==ke.width||ye.label!==ke.label){X=false;break}}if(X)return S}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:je,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,je,dt]);let bt=useMemo(()=>{let S=new Set;function X(pe){for(let ye of pe)ye.subtasks?.length&&(ye.isExpanded!==false&&S.add(ye.id),X(ye.subtasks));}return X(e),S},[e]),Mt=useMemo(()=>Le.filter(S=>S.visible),[Le]),ir=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ha=useCallback(S=>{se===S?$e(X=>X==="asc"?"desc":"asc"):(Ze(S),$e("asc")),r.onSortChange?.({column:S,direction:_e==="asc"?"desc":"asc"});},[se,_e,r]),mr=useCallback(S=>{st(S),r.onColumnsChange?.(S);},[r]),tn=useCallback(S=>{let X=Le.map(pe=>pe.id===S?{...pe,visible:false}:pe);mr(X);},[Le,mr]),lr=useCallback((S,X)=>{Ze(S),$e(X);},[]),Ma=useCallback((S,X,pe)=>{B&&(S.preventDefault(),he({isOpen:true,x:S.clientX,y:S.clientY,type:X?"task":"header",task:X,columnId:pe}));},[B]),zo=useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Pn=useCallback((S,X)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let pe=Le.find(ye=>ye.id===X);pe&&(te(X),N(S.clientX),me(pe.width));},[Le,M]);useEffect(()=>{if(!O)return;let S=Le,X=ye=>{let ke=ye.clientX-we,We=Math.max(50,H+ke);S=S.map(re=>re.id===O?{...re,width:We}:re),st(S);},pe=()=>{r.onColumnsChange?.(S),te(null);};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",pe),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",pe);}},[O,we,H,r]);let _n=useCallback((S,X)=>{if(X==="name"){S.preventDefault();return}nt(X),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",X),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Go=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),nt(null),ot(null);},[]),bi=useCallback((S,X)=>{S.preventDefault(),X!=="name"&&(S.dataTransfer.dropEffect="move",ot(X));},[]),Kr=useCallback(()=>{ot(null);},[]),Ds=useCallback((S,X)=>{if(S.preventDefault(),!ve||ve===X||X==="name")return;let pe=[...Le],ye=pe.findIndex(re=>re.id===ve),ke=pe.findIndex(re=>re.id===X);if(ye===-1||ke===-1)return;let We=pe.splice(ye,1);We[0]&&(pe.splice(ke,0,We[0]),mr(pe),nt(null),ot(null));},[ve,Le,mr]),Ga=useCallback(async S=>{if(r.onCreateCustomField){let X={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(X);}Y(false);},[r]),Va=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ba=useMemo(()=>{let S=I0(e);if(ft.trim()){let X=ft.toLowerCase();S=S.filter(pe=>pe.name.toLowerCase().includes(X));}if(je!=="all"){let X=new Set(S.filter(pe=>Va(pe)===je).flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}if(dt){let X=new Set(S.filter(pe=>Va(pe)!=="completed").flatMap(pe=>pe.parentPath));S=S.filter(pe=>X.has(pe.id));}return S.sort((X,pe)=>{let ye,ke;switch(se){case "name":ye=X.name.toLowerCase(),ke=pe.name.toLowerCase();break;case "startDate":ye=X.startDate?.getTime()||0,ke=pe.startDate?.getTime()||0;break;case "endDate":ye=X.endDate?.getTime()||0,ke=pe.endDate?.getTime()||0;break;case "progress":ye=X.progress||0,ke=pe.progress||0;break;case "status":ye=X.status||"todo",ke=pe.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ye=We[X.priority]??4,ke=We[pe.priority]??4;break;case "position":return 0;default:return 0}return ye<ke?_e==="asc"?-1:1:ye>ke?_e==="asc"?1:-1:0}),S},[e,ft,je,dt,se,_e,Va]);ba.current=Ba;let ho=useCallback((S,X)=>{let pe=We=>{r.onTaskUpdate?.({...S,...We});},ye=We=>We?S.customFields?.find(Pe=>Pe.fieldId===We)?.value:void 0,ke=(We,re)=>{if(!We)return;let Ee=[...S.customFields||[]],at=Ee.findIndex($t=>$t.fieldId===We);at>=0?Ee[at]={fieldId:We,value:re}:Ee.push({fieldId:We,value:re}),pe({customFields:Ee});};switch(X.type){case "name":return null;case "status":return jsx(hg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{pe({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:z,locale:f,translations:I.status});case "priority":return jsx(xg,{value:S.priority,onChange:re=>pe({priority:re}),isDark:z,locale:f});case "assignees":{let re=S.hasChildren,Pe=S.assignees||[];if(re&&S.subtasks?.length){let Ee=new Map,at=$t=>{($t||[]).forEach(lt=>{(lt.assignees||[]).forEach(gt=>{Ee.has(gt.name)||Ee.set(gt.name,gt);}),lt.subtasks?.length&&at(lt.subtasks);});};at(S.subtasks),Pe=Array.from(Ee.values());}else re&&(Pe=[]);return jsx(yl,{value:Pe,availableUsers:l,onChange:Ee=>pe({assignees:Ee}),isDark:z,locale:f,disabled:re})}case "startDate":return jsx(vl,{value:S.startDate,onChange:re=>pe({startDate:re}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(vl,{value:S.endDate,onChange:re=>pe({endDate:re}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),Pe=re?L0(zd(S.subtasks||[])):S.progress||0;return jsx(Eg,{value:Pe,onChange:re?void 0:Ee=>{let at=Ee===100?"completed":Ee>0?"in-progress":"todo";pe({progress:Ee,status:at});},isDark:z,disabled:re})}case "tags":return jsx(Vg,{value:S.tags||[],isDark:z});case "text":return jsx(Fg,{value:ye(X.customFieldId)||"",onChange:re=>ke(X.customFieldId,re),isDark:z});case "number":return jsx(Ig,{value:ye(X.customFieldId)||0,onChange:re=>ke(X.customFieldId,re),isDark:z});case "date":let We=ye(X.customFieldId);return jsx(vl,{value:We?new Date(We):void 0,onChange:re=>ke(X.customFieldId,re),isDark:z,locale:f});case "dropdown":return jsx(Rg,{value:ye(X.customFieldId)||"",options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z});case "checkbox":return jsx($g,{value:ye(X.customFieldId)||false,onChange:re=>ke(X.customFieldId,re),isDark:z});case "multiselect":return jsx(Og,{value:ye(X.customFieldId)||[],options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z,maxSelectable:X.maxSelectable});case "person":{let re=ye(X.customFieldId)||[];return jsx(yl,{value:re.map(Pe=>({name:Pe.name,avatar:Pe.avatar,initials:Pe.initials||(Pe.name||"?").slice(0,2).toUpperCase(),color:Pe.color||"#00E5CC"})),availableUsers:l,onChange:Pe=>ke(X.customFieldId,Pe),isDark:z,locale:f})}case "file":return jsx(Wg,{value:ye(X.customFieldId),isDark:z,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.estimatedTime,onChange:Pe=>pe({estimatedTime:Pe}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsx(Ia,{value:S.quotedTime,onChange:Ee=>pe({quotedTime:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,Pe=S.executedDollarsCanonical;return jsx(Ia,{value:S.elapsedTime,onChange:Ee=>pe({elapsedTime:Ee}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S),financialOverride:Pe})}case "effortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{allocated:$t}=ks(S);if($==="financial"){let lt=ze(S),gt=Math.round(lt.dollarAllocated),rr=Math.round(lt.dollarQuoted),gr=rr-gt;return jsxs("div",{className:"flex flex-col",children:[gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",gt.toLocaleString("es-CO")]}):null,gr!==0&>>0&&rr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gr>0?"+":"",Math.abs(gr)>=1e3?`$${(gr/1e3).toFixed(1)}K`:`$${gr}`]})]})}return jsx(Ia,{value:$t>0?$t:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Z})}let re=S.status==="completed"||S.progress===100,Pe=S.effortMinutes||0,Ee=S.soldEffortMinutes||0,at=Oe(S);if($==="financial"&&at&&Pe>0&&Ee>0){let $t=Math.round(Pe/60*at),gt=Math.round(Ee/60*at)-$t;return jsxs("div",{className:"flex flex-col",children:[jsx(Ia,{value:Pe,onChange:rr=>pe({effortMinutes:rr}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)}),gt!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gt>0?"+":"",Math.abs(gt)>=1e3?`$${(gt/1e3).toFixed(1)}K`:`$${gt}`]})]})}return jsx(Ia,{value:Pe,onChange:$t=>pe({effortMinutes:$t}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(Ae&&S.subtasks&&S.subtasks.length>0){let{spent:Ee}=ks(S);return jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S),financialOverride:re})}let Pe=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Ee=>{r.onLogTime?.(S,Ee);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Pe,lens:$,hourlyRate:Oe(S),financialOverride:re})}case "soldEffortMinutes":{if(Ae&&S.subtasks&&S.subtasks.length>0){let{quoted:Ee}=ks(S),at=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:Ee>0?Ee:void 0,isDark:z,locale:f,disabled:true,isBlurred:at,lens:$,hourlyRate:Oe(S)})}let re=S.status==="completed"||S.progress===100,Pe=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:S.soldEffortMinutes,onChange:Ee=>pe({soldEffortMinutes:Ee}),isDark:z,locale:f,disabled:re,isBlurred:Pe,lens:$,hourlyRate:Oe(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,Pe=S.soldEffortMinutes||0,Ee=S.timeLoggedMinutes||0,at=re>0||Pe>0||Ee>0;return jsx(qg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(Ae&&S.hasChildren){let{spent:re,allocated:Pe,quoted:Ee}=ks(S),at=re>Pe&&Pe>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ws(re)}),Pe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-white/60":"text-gray-600",children:ws(Pe)})]}),Ee>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ws(Ee)})]})]})}return jsx(Xg,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:$,hourlyRate:Oe(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Qg,{task:S,isDark:z,locale:f}):jsx(yl,{value:S.assignees||[],availableUsers:l,onChange:Pe=>{r.onTaskUpdate?.({...S,assignees:Pe});},isDark:z,locale:f});case "blockers":return jsx(e0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let re=oe.get(S.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let Pe=S.weight||0;return jsx(Q1,{value:Pe,onChange:Ee=>pe({weight:Ee}),isDark:z})}default:return jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Ae,oe]),Kn=useCallback(S=>{let pe={name:I.columns.name,status:I.columns.status,priority:I.columns.priority,assignees:I.columns.assignees,startDate:I.columns.startDate,endDate:I.columns.endDate,progress:I.columns.progress,tags:I.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:I.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:I.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:I.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:I.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:I.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:I.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:I.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:I.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:I.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:I.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:I.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof pe=="string"?pe:String(pe||S.type)},[I,f]),yo=useMemo(()=>{let pe=Mt.reduce((ke,We)=>ke+We.width,0)+(k?48:0),ye={};for(let ke of Mt)ye[ke.id]=`${ke.width/pe*100}%`;return ye},[Mt,k]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,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:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxs("div",{ref:K,className:g(z?"bg-[#0D0D0D]":"bg-white",O&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ba.length," ",I.pagination.tasks]}),h&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ft,onChange:S=>pt(S.target.value),placeholder:I.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"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}),b&&ee>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:_,onClick:()=>ut(!de),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?de?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":de?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),_r==="all"?f==="es"?"Todos":"All":`L${_r}`]}),de&&jsx("div",{ref:fe,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(ee,5)},(S,X)=>({value:X+1,label:`L${X+1}`}))].map(S=>jsxs("button",{onClick:()=>{ce(S.value),ut(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?_r===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":_r===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),_r===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(T0,{value:je,hideCompleted:dt,onChange:Re,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsx("button",{onClick:()=>Fe(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"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:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 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:I.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:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(S=>{let X=S.id!=="name",pe=ie===S.id&&ve!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",X&&"cursor-grab",S.type!=="name"&&"justify-center",ve===S.id&&"opacity-50",pe&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:yo[S.id],minWidth:S.minWidth},draggable:X,onDragStart:X?ye=>_n(ye,S.id):void 0,onDragEnd:X?Go:void 0,onDragOver:X?ye=>bi(ye,S.id):void 0,onDragLeave:X?Kr:void 0,onDrop:X?ye=>Ds(ye,S.id):void 0,onContextMenu:ye=>Ma(ye,void 0,S.id),children:[X&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:ye=>{let ke=ye.currentTarget.getBoundingClientRect();d(S.id,ke);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),se===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>ha(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",se===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Kn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",O===S.id&&"bg-[#00E5CC]"),onMouseDown:ye=>Pn(ye,S.id)})]},S.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),J(X=>!X);},className:g("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",F&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(h0,{isOpen:F,onClose:()=>J(false),columns:Le,customFields:c,mostrarColumnasDensas:w,onColumnsChange:mr,onCreateCustomField:()=>{J(false),Y(true);},isDark:z,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ba.map((S,X)=>{let pe=bt.has(S.id),ye=Math.min(X*.01,.2),ke=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(ke){let{spent:lt,allocated:gt,quoted:rr}=ks(S),gr=J1(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ur=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Ur.type!=="name"&&"justify-center"),style:{width:yo[Ur.id],minWidth:Ur.minWidth},children:Ur.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),gr!==null&&v&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",gr>=1?"text-[#32D74B] bg-[#32D74B]/10":gr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",gr.toFixed(2)]})]})]}):Ur.type==="timeLoggedMinutes"?$==="financial"?(()=>{let Ot=S.executedDollarsCanonical,Kt=Ot!=null?Math.round(Ot):Math.round(ze(S).dollarSpent);return Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:lt>0?lt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="soldEffortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarQuoted);return Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:rr>0?rr:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):Ur.type==="effortMinutes"?$==="financial"?(()=>{let Ot=ze(S),Kt=Math.round(Ot.dollarAllocated),St=Math.round(Ot.dollarQuoted),xt=St-Kt;return jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("es-CO")]}):null,xt!==0&&Kt>0&&St>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`]})]})})():jsx(Ia,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):ho(S,Ur)},Ur.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=Be===S.id,Pe=Ue===S.id,Ee=Pe&&Xe==="above",at=Pe&&Xe==="below",$t=Pe&&Xe==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ye},className:g("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ge===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:$t?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:lt=>Ma(lt,S),onMouseEnter:()=>Bt(S.id),onMouseLeave:()=>Bt(lt=>lt===S.id?null:lt),children:[Ee&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:lt=>et(S.id,lt),style:{color:z?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Mt.map(lt=>{let gt=!!(S.subtasks&&S.subtasks.length>0),rr=Qt(lt),Ur=!!rr&&!gt&&Hr===S.id&&!vr,Ot=!!vr&&!!rr&&Zr(vr.column,rr)&&jr(S.id);return jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",lt.type!=="name"&&"justify-center"),style:{width:yo[lt.id],minWidth:lt.minWidth,position:"relative",backgroundColor:Ot?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ot?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:lt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Kt=>{Kt.stopPropagation(),ir(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:pe?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?z?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Ur&&rr?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[ho(S,lt),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Kt=>ea(Kt,S.id,rr,X),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):ho(S,lt)},lt.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),W&&Ba.length>0&&(()=>{let{spent:S,allocated:X,quoted:pe}=De,ye=X-S,ke=ye<0,We=ke?`+${ws(Math.abs(ye))} ${f==="es"?"DE M\xC1S":"OVER"}`:`+${ws(ye)} ${f==="es"?"DE MARGEN":"REMAINING"}`,re=$==="financial"&&Z>0,Pe=Ce?.breakdown,Ee=!!Pe&&((Pe.equipment??0)>0||(Pe.travel??0)>0),at=Pe?.laborSpent!=null?Pe.laborSpent:Ce?.spent!=null?Ce.spent:De.dollarSpent,$t=Pe?.laborAllocated!=null?Pe.laborAllocated:Ce?.allocated!=null?Ce.allocated:De.dollarAllocated,lt=Ce?.quoted!=null?Ce.quoted:De.dollarQuoted,gt=(Ot,Kt)=>{if(re){let St=Kt??Ot/60*Z;return `$${Math.round(St).toLocaleString("es-CO")}`}return ws(Ot)},rr=re?Math.abs($t-at):0,gr=re?`+$${rr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ke?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,Ur=re&&Ee?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ot=>jsx("div",{className:g("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:yo[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ur&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Ur]})]}):Ot.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(S,re?at:void 0)}),jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,re?$t:void 0)})]}),X>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?gr:We})]}):Ot.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:pe>0?gt(pe,re?lt:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(re&&pe>0&&X>0){let Kt=Math.round(lt),St=Math.round($t),xt=Kt-St,Mr=Kt>0?Math.round(xt/Kt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,$t)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xt>=0?"+":"",Math.abs(xt)>=1e3?`$${(xt/1e3).toFixed(1)}K`:`$${xt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Mr,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?gt(X,re?$t:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?gt(S,re?at:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let Kt=L0(zd(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Kt,"%"]})})():Ot.type==="weight"?(()=>{let Kt=e||[],St=[],xt=pa=>{for(let qr of pa)St.push(qr),qr.subtasks?.length&&xt(qr.subtasks);};xt(Kt);let ya=St.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),Ca=Math.abs(ya-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Ca?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ya.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ba.length===0&&ft&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsx(D0,{data:He.data,isDark:z,locale:f,onClose:()=>Fe(false),lens:t?.lens,onUnassignedTaskClick:S=>{let X=document.querySelector(`[data-task-id="${S}"]`);X&&(X.scrollIntoView({behavior:"smooth",block:"center"}),Qe(S),setTimeout(()=>Qe(null),2e3));}})]}),jsx(i0,{state:ue,onClose:zo,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:tn,onColumnSort:lr,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),xe&&mt&&Be&&createPortal(jsx("div",{style:{position:"fixed",left:mt.x+12,top:mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let X=Te.flattenTasks(e).find(pe=>pe.id===Be);return X?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsx(v0,{isOpen:R,onClose:()=>Y(false),onSave:Ga,isDark:z,locale:f})]})}var B0=[{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:"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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",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},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],$0=[{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"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],O0=[{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 Gd={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:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Vd={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:"#00E5CC"},jd={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"},Ml={dark:Gd,light:Vd,neutral:jd};function H0(e){return Ml[e]||Ml.dark}function Pl(e,t,r,a,n=5){let s=[],o=[],l=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of l){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let c={};for(let p=r;p<=a;p++)c[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)c[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function U0(e){return e==="es"?Z1:eC}function W0(e){return (e.getDay()+6)%7}function z0(e,t){let r=new Date(e,t,1),a=W0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},l=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},c=l(r),i=new Date(e,t+1,0),d=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:d}}function ii(e,t){return W0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&r(o.subtasks,l,c);}};return r(e,"",""),t}function G0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function V0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Fl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),l=42,c=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=G0(d.startDate),f=G0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?V0(v):V0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?nC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=aC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(x,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function j0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var _d=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ll({locale:e}){let t=U0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Al({bar:e,ws:t,money:r,projColor:a,slotH:n=_d}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":e.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function Il({chip:e,ws:t,slotH:r=_d}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:iC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Rl({more:e,ws:t,slotH:r=_d,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function _0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function K0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:uC.map(o=>jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function q0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=useState(false),x=useRef(null),h=d==="es";useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function Y0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function J0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var X0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function Q0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=X0[r]||X0.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),a?jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function ef(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Z0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return Z0[e%Z0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var Kd="\xA0";function Bo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function tf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(ef(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:vC(c),initials:xC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((c.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function rf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=ef(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:m,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:p=>{!c||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!c||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${Kd}/${Kd}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Bo(l.assigned),"h"]}),jsxs("span",{children:["/",Kd,Bo(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function af({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Bo(s),"h asignadas / ",Bo(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Bo(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Bo(i.hours),"h / ",Bo(i.capacity),"h"]})]},i.name)})})]})}var qd=28,CC=182;function of({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=l==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),c&&c[x]?jsx(rf,{days:c[x].days,capByDay:c[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),m=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:p,children:[jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ii(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Al,{bar:f,ws:t,money:s,projColor:o,slotH:qd})},`b${x}`)),d.chips.map((f,x)=>jsx(Il,{chip:f,ws:t,slotH:qd},`c${x}`)),d.more.map((f,x)=>jsx(Rl,{more:f,ws:t,slotH:qd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function sf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function lf(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?sf(l):sf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function cf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function df({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ts(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function uf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=n==="es";useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Ts(r.oldProjectEnd,n)} \u2192 ${Ts(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Ts(r.oldStart,n)," \u2013 ",Ts(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[Ts(r.newStart,n)," \u2013 ",Ts(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function pf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxs("button",{type:"button",onClick:()=>l?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Bl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Yd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function mf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Bl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Bl(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=l(f);x>u&&(u=x);}let p=Yd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function gf(e,t,r){let a=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Bl(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Yd(p)*864e5));}s.set(c.id,d===1/0?r:d);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Bl(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function $l(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=mf(n,new Map),i=gf(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=mf(d,new Map([[t,r.getTime()]])),u=gf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Yd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function ff(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Ol=26,$C="#5B7FD4";function bf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=useState("mes"),[k,M]=useState(()=>{let j=new Date,xe={y:j.getFullYear(),m:j.getMonth()},Ie=(e??[]).map(Xe=>Xe.startDate?new Date(Xe.startDate):null).filter(Xe=>!!Xe&&!isNaN(Xe.getTime()));if(Ie.length===0||(e??[]).some(Xe=>{let Dt=Xe.startDate?new Date(Xe.startDate):null,mt=Xe.endDate?new Date(Xe.endDate):Dt;if(!Dt||isNaN(Dt.getTime()))return false;let Jt=new Date(xe.y,xe.m,1),xr=new Date(xe.y,xe.m+1,0,23,59,59);return Dt<=xr&&(mt??Dt)>=Jt}))return xe;let Ct=Ie.reduce((Xe,Dt)=>Xe<Dt?Xe:Dt);return {y:Ct.getFullYear(),m:Ct.getMonth()}}),[B,T]=useState(false),[C,P]=useState([]),[D,V]=useState("all"),[$,Z]=useState(null),[L,Ae]=useState(null),[W,Ce]=useState(false),[I,z]=useState(null),[Oe,ze]=useState(false),Q=useMemo(()=>z0(k.y,k.m),[k.y,k.m]),De=a||$C,oe=useMemo(()=>{let j=new Set;for(let xe of h){let Ie=new Date(`${xe}T12:00:00`),Ue=Q.dateToSerial(Ie);Ue>=1&&Ue<=42&&j.add(Ue);}return j},[h,Q]);useEffect(()=>{y?.({start:ff(Q.serialToDate(1)),end:ff(Q.serialToDate(42))});},[k.y,k.m]);let He=x.length,Se=useMemo(()=>{let j=b?.hoursPerDay;if(!j)return 8;let xe=[j.monday,j.tuesday,j.wednesday,j.thursday,j.friday].map(Ie=>Ie||0).filter(Ie=>Ie>0);return xe.length?Math.round(xe.reduce((Ie,Ue)=>Ie+Ue,0)/xe.length*10)/10:8},[b]),Fe=useMemo(()=>Fl({tasks:e,grid:Q,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,Q,De,o,r]),Ge=useMemo(()=>{if(d===false)return [];let j=new Map;for(let xe of Fe.calTasks)xe.phaseId&&xe.phaseName&&j.set(xe.phaseId,xe.phaseName);return [...j.entries()].map(([xe,Ie])=>({id:xe,name:Ie})).sort((xe,Ie)=>xe.name.localeCompare(Ie.name))},[Fe.calTasks,d]),Qe=!C.includes("tareas"),se=!C.includes("cpm"),Ze=useMemo(()=>{let j=Qe?Fe.calTasks:[];return D!=="all"&&(j=j.filter(xe=>xe.phaseId===D)),se||(j=j.map(xe=>xe.critical?{...xe,critical:false}:xe)),j},[Fe.calTasks,Qe,se,D]),_e=useMemo(()=>{let j=new Set;return C.includes("hitos")&&(j.add("hito"),j.add("desembolso")),C.includes("ext")&&j.add("ext"),C.includes("aus")&&j.add("aus"),Fe.dayItems.filter(xe=>!j.has(xe.type))},[Fe.dayItems,C]),$e=!C.includes("festivos"),ft=new Date,pt=Q.dateToSerial(new Date(ft.getFullYear(),ft.getMonth(),ft.getDate())),je=j=>P(xe=>xe.includes(j)?xe.filter(Ie=>Ie!==j):[...xe,j]),Re=()=>M(j=>{let xe=new Date(j.y,j.m-1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),dt=()=>M(j=>{let xe=new Date(j.y,j.m+1,1);return {y:xe.getFullYear(),m:xe.getMonth()}}),zt=()=>{let j=new Date;M({y:j.getFullYear(),m:j.getMonth()});},Le=(j,xe,Ie)=>{if(!p||xe===0)return;let Ue=Fe.calTasks.find(Jt=>Jt.uid===j);if(!Ue)return;let Ct=xe*864e5,Xe=new Date(Ue.realStart.getTime()+Ct),Dt=new Date(Ue.realEnd.getTime()+Ct),mt=$l(e,j,Xe,Dt);mt&&z({uid:j,taskId:Ue.id,taskName:Ue.name,sim:mt,anchor:Ie});},st=async()=>{if(!I||!f)return;ze(true);let j=[{id:I.uid,startDate:I.sim.newStart,endDate:I.sim.newEnd},...I.sim.movedSuccessors.map(Ie=>({id:Ie.id,startDate:Ie.newStart,endDate:Ie.newEnd}))],xe=await f(j);ze(false),xe&&z(null);},F=j0(k.y,k.m,n),J=[{id:"",name:t,color:De}],R=useMemo(()=>lf(e,o),[e,o]),Y=useMemo(()=>{if(v==="lookahead"){let j=Q.weeks.find(Ie=>pt>=Ie.ws&&pt<=Ie.we)??Q.weeks[0],xe=Q.weeks.indexOf(j);return Q.weeks.slice(xe,xe+2)}return v==="semana"?[Q.weeks.find(xe=>pt>=xe.ws&&pt<=xe.we)??Q.weeks[0]]:[]},[v,Q.weeks,pt]),ue=useMemo(()=>{let j={};return Y.forEach((xe,Ie)=>{let Ue=[];for(let Xe=xe.ws;Xe<=xe.we;Xe++)Ue.push({serial:Xe,date:Q.serialToDate(Xe),isWeekend:ii(Q,Xe),isHoliday:oe.has(Xe)});let Ct=tf(x,Ue,Se);j[Ie]={days:Ue,capByDay:Ct};}),j},[Y,Q,oe,x,Se]),he=v==="semana"||v==="lookahead",Be=v==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(K0,{view:v,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx(q0,{monthLabel:F,onPrev:Re,onNext:dt,onToday:zt,layersOpen:B,onToggleLayers:()=>T(j=>!j),layersOff:C,phases:Ge,phaseFilter:D,onPhaseChange:V,locale:n,children:B?jsx(Y0,{off:C,onToggle:je}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsx(pf,{grid:Q,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx(of,{grid:Q,weeks:Y,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,capRows:ue,teamSize:He,onTaskOpen:i,onMore:(j,xe,Ie)=>Z({day:j,items:xe,tasks:Ie}),onCapDay:(j,xe,Ie)=>{for(let Ue of Object.keys(ue)){let Ct=ue[+Ue].capByDay.get(j);if(Ct){Ae({dayLabel:xe,perPerson:Ct.perPerson,anchor:Ie.getBoundingClientRect()});break}}}})]}):Fe.isEmpty?jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsx(hf,{grid:Q,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsx(Q0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxs(Fragment,{children:[jsx(Ll,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsx(OC,{grid:Q,ws:j.ws,we:j.we,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,onTaskOpen:i,onMore:(xe,Ie,Ue)=>Z({day:xe,items:Ie,tasks:Ue}),canReschedule:p,onDragReschedule:Le,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsx(J0,{dayLabel:`${Q.serialToDate($.day).getDate()}`,items:$.items,tasks:$.tasks.map(j=>({swatch:De,taskId:j.id,label:j.name,critical:j.critical,value:l==="$"?j.cost:`${j.hrs}h`})),onClose:()=>Z(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,L?jsx(af,{dayLabel:L.dayLabel,perPerson:L.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${L.anchor.top-8}px`,left:`${L.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,I?jsx(uf,{taskName:I.taskName,taskId:I.sim.taskId,sim:I.sim,busy:Oe,locale:n,onConfirm:st,onCancel:()=>z(null),style:{position:"fixed",top:`${I.anchor.top+12}px`,left:`${Math.min(I.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),W?jsx(cf,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsx(df,{onExpand:()=>Ce(true)})]}),jsx(_0,{projects:J})]})}function hf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=r;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,m=n&&s.has(c),u="cal-day";return ii(e,c)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxs("div",{className:u,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=useMemo(()=>Pl(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(BC,h.laneCount*Ol+36),v=useRef(null),[w,k]=useState(null),M=(B,T)=>{if(!p||!f){m?.(T);return}B.preventDefault();let C=v.current;if(!C)return;let P=C.getBoundingClientRect().width/7,D=B.clientX,V=0,$=L=>{let Ae=Math.round((L.clientX-D)/P);V=Ae,k({id:T,days:Ae});},Z=L=>{if(window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",Z),k(null),V===0){m?.(T);return}let Ae=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Ae);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",Z);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(hf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=x?.uid===B.t.uid?x.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsx("div",{onPointerDown:Z=>M(Z,B.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(Al,{bar:$,ws:t,money:s,projColor:o,slotH:Ol})},`b${T}`)}),h.chips.map((B,T)=>jsx(Il,{chip:B,ws:t,slotH:Ol},`c${T}`)),h.more.map((B,T)=>jsx(Rl,{more:B,ws:t,slotH:Ol,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=useState(false),d=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:g("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:m.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:p=>{p.stopPropagation(),o?.(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:[m.uniqueAssignees," assignees"]})]}),m.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:[m.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:d.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:d.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.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"})]})})]},p.id))})})]})}var xf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ci(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 di(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 vf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function wf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...xf,...o}),[o]),[i,d]=useState(new Set),m=useRef(null),u=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),B=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:B<7?`${B}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),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:g("history-timeline",c.compact&&"compact",l),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:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[di(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let k=i.has(v.id),M=s===v.id,B=vf(v.type);return jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:di(v.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),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&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:ci(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,C])=>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(C.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,C])=>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(C)})]},T))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function Cf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let d=[.5,1,1.5,2,3],m=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("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:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&di(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ci(m)}),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:m&&m.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:p=>l(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:ci(p)},p.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:n,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:o,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:d.map(p=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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:m&&m.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(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,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:"#00E5CC",child_of:"#00C4AE",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 Tf(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 Nf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Df({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[d,m]=useState([]),[u,p]=useState(null),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=_C(e,t,r.width,r.height,r,150);m($);},[e,t,r]);let M=useCallback(($,Z)=>{r.enableDragging&&(Z.stopPropagation(),p($));},[r.enableDragging]),B=useCallback($=>{if(!u||!i.current)return;let L=i.current.getBoundingClientRect(),Ae=($.clientX-L.left-w.x)/y,W=($.clientY-L.top-w.y)/y;m(Ce=>Ce.map(I=>I.id===u?{...I,x:Ae,y:W,fx:Ae,fy:W}:I));},[u,y,w]),T=useCallback(()=>{p(null);},[]),C=useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),P=useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),D=useCallback($=>{let Z=d.find(L=>L.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[d]),V=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Z=$.card.priority;return Z==="URGENT"?"#ef4444":Z==="HIGH"?"#f59e0b":Z==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("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:g("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:o.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:o.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"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Tf($)," ",Qd($)]})]},$))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Z=D(typeof $.source=="string"?$.source:$.source.id),L=D(typeof $.target=="string"?$.target:$.target.id),Ae=Nf($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsx("line",{x1:Z.x,y1:Z.y,x2:L.x,y2:L.y,stroke:Jd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsx("text",{x:(Z.x+L.x)/2,y:(Z.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let Z=f===$.id,L=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",Z&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>M($.id,Ae),onMouseEnter:()=>x($.id),onMouseLeave:()=>x(null),onClick:Ae=>C($,Ae),children:[jsx("circle",{r:L?r.nodeSize*1.2:r.nodeSize,fill:V($),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:Z?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 Mf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,d]=useState(null),[m,u]=useState(null),p=useRef(null),f=l||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{m&&(r(m),x());};return e?jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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:y=>y.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-[#00E5CC]",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:x,disabled:f,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:m?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!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((y,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((y,v)=>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:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},v)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.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:p,value:s,onChange:y=>o(y.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-[#00E5CC]/50 transition-all resize-none",disabled:f}),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((y,v)=>jsx("button",{onClick:()=>o(y),disabled:f,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:y},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:x,disabled:f,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"}),m?jsx("button",{onClick:b,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:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Zd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ui(e){return `$${e.toFixed(4)}`}var eu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),l=r.filter(m=>m.success),c=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(d=>d.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Oo=new eu;function Lf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(Oo.getStats()),[s,o]=useState(Oo.checkLimit(r));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Oo.getStats()),o(Oo.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),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 l=Oo.getRecentOperations(5);return jsxs(nr,{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-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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 (",r.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:ui(a.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-[#00E5CC] mt-1",children:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,m=a.totalOperations>0?i/a.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:ui(d)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.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:ui(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 Rf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[d,m]=useState(""),[u,p]=useState(false),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(null),w=useRef(null),k=u||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=D=>{D.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),m(""),x(null),b(null),v(null),t());},B=async()=>{if(!(!o.trim()||k)){p(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(nr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),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:P=>P.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-[#00E5CC]",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:M,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:h?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:[y?.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"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",C,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>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:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.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:w,value:o,onChange:P=>l(P.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-[#00E5CC]/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:P=>i(P.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-[#00E5CC]/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:d,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((P,D)=>jsx("button",{onClick:()=>l(P),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:P},D))})]})]})}),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-[#00E5CC] 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:M,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"}),h?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:B,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Wl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(h=>{t&&ki(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{a(v=>{let w=v.cards.find(P=>P.id===h);if(!w)return v;let k=w.columnId,M={...w,columnId:b,position:y},B=v.cards.map(P=>P.id===h?M:P),T=v.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(D=>D!==h)};if(P.id===b){let D=B.filter(V=>V.columnId===b).sort((V,$)=>V.position-$.position);return {...P,cardIds:D.map(V=>V.id)}}return P}),C={...v,cards:B,columns:T};return n(C),C});},[n]),o=useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:v};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,v],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let v=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(B=>B!==h)}:M),k={...b,cards:v,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:v};return n(w),w});},[n]),m=useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),v=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),p=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:c,deleteColumn:m,clearBoard:f}}}function $f({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Wl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(m=>m.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var pi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Hf={by:"none",order:"asc"};function Uf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...pi,...e}),[s,o]=useState({...Hf,...t}),l=useCallback(x=>{n(h=>({...h,...x}));},[]),c=useCallback(x=>{o(h=>({...h,...x}));},[]),i=useCallback(()=>{n(pi),o(Hf);},[]),d=useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),m=useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),u=useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${v}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let B=M.endDate||M.dueDate;if(!B)return false;let T;if(typeof B=="string")T=B.split("T")[0]||B;else {let C=B.getUTCFullYear(),P=String(B.getUTCMonth()+1).padStart(2,"0"),D=String(B.getUTCDate()).padStart(2,"0");T=`${C}-${P}-${D}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let C=new Date(k+"T00:00:00"),P=new Date(T+"T00:00:00"),D=new Date(C);return D.setDate(D.getDate()+7),P>=C&&P<=D;case "custom":if(a.dateRange){let V=typeof B=="string"?new Date(B):B;return V>=a.dateRange.start&&V<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;v=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},B=M[b.priority||"LOW"],T=M[y.priority||"LOW"];v=B-T;break;case "dueDate":let C=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!C)return 1;if(!P)return -1;let D=typeof C=="string"?new Date(C).getTime():C.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();v=D-V;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,Z=y.estimatedTime||0;v=$-Z;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var zf,Gf;if(typeof window<"u")try{let e=xi("ai");zf=e.generateObject,Gf=e.generateText;}catch{}function Vf(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(zf&&Gf&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),c=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function ru(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function jf(e){let{cards:t}=e,[r,a]=ru(),n=useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,k]=y<v?[y,v]:[v,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:d}}var _f={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Kf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({..._f,...r}),[r]),[s,o]=useState([]),l=useCallback((x,h,b,y,v)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=useCallback(async x=>{let h=t.filter(k=>k.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let v=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{v.has(M)||v.set(M,[]),v.get(M).push(k);});}),v.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(B=>B.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let B={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${B} ${M} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let B=(await a.findSimilar(k,h)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(B.length>=n.minCardsPerStack-1){let T=[k.id,...B.map(P=>P.card.id)],C=B.reduce((P,D)=>P+D.similarity,0)/B.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${B.length+1} similar tasks`,confidence:C});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var qf=createContext(null);function Yf({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=xi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=xi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=xi("@libxai/core");l=new c(t.board);}a.current=new BoardStore({board:l,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(qf.Provider,{value:{store:n},children:e})}function zl(){let e=useContext(qf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=zl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=useCallback(y=>{e.deleteColumn(y);},[e]),m=useCallback(y=>e.getColumn(y),[e]),u=useCallback(y=>{e.addCard(y);},[e]),p=useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),x=useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Jf(e){let{cards:t}=gi();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Qf(e="position",t="asc"){let{cards:r}=gi();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var Gl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=$u.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 r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} 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(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(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,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Gl;function eb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:n,children:jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=c?c(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},h)})})})}function tb(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 ab({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let d=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:p,className:s,children:jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=c?c(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function nb(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 ob(e,t=10){return e>t}var su={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},iu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},cu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},du={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mu={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)"},gu={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)"},fu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bu={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}},hu={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}},Vl={spacing:su,borderRadius:iu,fontSize:lu,fontWeight:cu,lineHeight:du,zIndex:uu,duration:pu,easing:mu,shadows:gu,opacity:fu,kanban:bu,gantt:hu};function sb(e,t,r){return e[t]??r}function yu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?yu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xu(e="asakaa"){let t=yu(Vl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${r.join(`
|
|
416
416
|
`)}
|
|
417
417
|
}`}function fi(e,t="asakaa"){let r=[],a=yu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
|