@libxai/board 1.9.30 → 1.9.32
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -6
- package/package.json +142 -142
package/dist/index.cjs
CHANGED
|
@@ -411,7 +411,7 @@ ${ug(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 ug(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=ug(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 bd(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 m={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(m!==void 0){let f=new Date(a),v=f.getDay(),h=m-v;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),m=s[2].toLowerCase(),f=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+u):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+u*7):(m==="month"||m==="mes"||m==="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),m=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,m,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),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(f,m,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},p=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let u=d[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,m)}return null}function hd(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 yd(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 pg(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 mg(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(),p=Un(t,i),u=bd(d);if(!p)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:p.id,taskName:p.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 m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:u,endDate:f},message:`Moved "${p.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(),p=Un(t,i),u=hd(d);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+u),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${u} days. New end date: ${m.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(),p=Un(t,i),u=yd(d);return p?u===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:u},message:`Set "${p.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(),p=Un(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:d},message:`Renamed "${p.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(),p=Un(t,i),u=Un(t,d);return p?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:p.id,dependencyTo:u.id,message:`Linked "${p.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 gg(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 jw(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 _w(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function gl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let p=r.find(u=>u.id===d);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>gl(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:jw(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 fg(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:_w(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function bg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>gl(a,e,t))}var xd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"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"}},vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"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"}},fl={en:xd,es:vd};function wd(e){return fl[e]||fl.en}function bl(e,t){let r=wd(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 kd=[{value:"todo",icon:lucideReact.Circle,color:"text-gray-400"},{value:"in-progress",icon:lucideReact.PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:lucideReact.CheckCircle2,color:"text-[#3BF06E]"}];function hg(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 yg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=hg(e),i=kd[0],d=kd.find(m=>m.value===c)??i,p=d.icon,u=m=>{switch(hg(m)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(p,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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:[jsxRuntime.jsx(p,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsxRuntime.jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.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:kd.map(m=>{let f=m.icon;return jsxRuntime.jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.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===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(f,{className:g("w-4 h-4",m.color)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:u(m.value)})]},m.value)})})]})}function uo(e,t,r=320){let[a,n]=react.useState(false);return react.useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+r+o<=window.innerHeight,c=s.top-r-o>=0;n(!l&&c);},[t,r,e]),a}var Cd=[{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 vg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=react.useState(false),l=react.useRef(null),c=uo(l,s,180);react.useEffect(()=>{let p=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Cd.find(p=>p.value===e)??Cd[4],d=a==="es"?"es":"en";return n||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[d]})]}):jsxRuntime.jsxs("div",{ref:l,className:"relative",children:[jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Flag,{className:g("w-4 h-4",i.color)}),jsxRuntime.jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[d]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Cd.map(p=>jsxRuntime.jsxs("button",{onClick:u=>{u.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",e===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:p.label[d]})]},p.value))})]})}function ai(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Td(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 xl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),p=react.useRef(null),u=uo(d,o);react.useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),react.useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(r){if(f(h.name))r(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ai(h.name),color:h.color||Td(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};r([...e,b]);}l(false),i("");}};return s||!r?e.length===0?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,b)=>jsxRuntime.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",!h.avatar&&Td(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)},`${h.name}-${b}`)),e.length>3&&jsxRuntime.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]})]}):jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsx("button",{onClick:h=>{h.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?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,b)=>jsxRuntime.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",!h.avatar&&Td(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)},`${h.name}-${b}`)),e.length>2&&jsxRuntime.jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxRuntime.jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",u?"bottom-full mb-1.5":"top-full mt-1.5"),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:[jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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&&jsxRuntime.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((h,b)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(a?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsxRuntime.jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)}),h.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:y=>{y.stopPropagation(),r(e.filter(x=>x.name!==h.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:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${h.name}-${b}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsxRuntime.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"}):m.map(h=>{let b=f(h.name);return jsxRuntime.jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?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:y=>{b||(y.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(y.currentTarget.style.backgroundColor="transparent");},children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsxRuntime.jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ai(h.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&jsxRuntime.jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsxRuntime.jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},h.id)})})]})]})}function Dg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,d]=react.useState(false),[p,u]=react.useState(n),[m,f]=react.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)}),v=react.useRef(null),h=react.useRef(null),b=react.useRef(null),[y,x]=react.useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let D=V=>{let $=V.target;v.current&&v.current.contains($)||b.current&&b.current.contains($)||d(false);};return i&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),react.useLayoutEffect(()=>{if(!i){x(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);x({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]),react.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=react.useCallback(()=>{let D=m.getFullYear(),V=m.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},[m]),T=D=>{if(a)n==="start"?r(D,k||void 0):r(w||void 0,D),d(false);else if(p==="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 jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(D)})]})}let P=a&&n==="start"?w:k;return jsxRuntime.jsxs("div",{ref:v,className:"relative",children:[jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&reactDom.createPortal(jsxRuntime.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:[jsxRuntime.jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,V)=>jsxRuntime.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:[jsxRuntime.jsx("span",{children:D.label}),jsxRuntime.jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},V)),jsxRuntime.jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.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:[jsxRuntime.jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!a&&jsxRuntime.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:p==="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"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.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"}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.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=>jsxRuntime.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))}),jsxRuntime.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 jsxRuntime.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 wl({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 jsxRuntime.jsx(Dg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(u,m)=>{t&&t(s==="start"?u:m);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function hs(e=600){let[t,r]=react.useState(false),a=react.useRef(null),n=react.useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return react.useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function kl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=react.useState(e),[l,c]=react.useState(false),i=react.useRef(e),d=react.useRef([]);return react.useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,u=e,m=u-p,f=a/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(u));},f*v);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Sg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=react.useState(null),[o,l]=react.useState(0),c=react.useRef(null),i=react.useRef(null),d=react.useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},r);},[r,e]),p=react.useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),a?.();},[a]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:p}}function Mg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=react.useState(false),[c,i]=react.useState(""),d=react.useRef(null),{isFlashing:p,triggerFlash:u}=hs(),{displayValue:m,isAnimating:f}=kl(e,{enabled:n,duration:300,steps:6}),v=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=react.useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);react.useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=react.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=react.useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=m??e;return jsxRuntime.jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsxRuntime.jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsxRuntime.jsx("div",{className:"flex-1"}),o?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsxRuntime.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]")}),jsxRuntime.jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===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:[x,"%"]})]})}function Lg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=react.useState(false),[l,c]=react.useState(e),i=react.useRef(null);react.useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let d=()=>{l!==e&&t?.(l),o(false);},p=u=>{u.key==="Enter"?d():u.key==="Escape"&&(c(e),o(false));};return n||!t?jsxRuntime.jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsxRuntime.jsx("input",{ref:i,type:"text",value:l,onChange:u=>c(u.target.value),onBlur:d,onKeyDown:p,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")}):jsxRuntime.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 Rg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,d]=react.useState(false),[p,u]=react.useState(e?.toString()||""),m=react.useRef(null),{isFlashing:f,triggerFlash:v}=hs(),{displayValue:h,isAnimating:b}=kl(e,{enabled:l&&!i});react.useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),react.useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);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&&v());}d(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsxRuntime.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?jsxRuntime.jsx("input",{ref:m,type:"number",value:p,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:x,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")}):jsxRuntime.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 Bg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=react.useState(false),c=react.useRef(null),i=uo(c,o,220);return react.useEffect(()=>{let d=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),s||!r?jsxRuntime.jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:d=>{d.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:[jsxRuntime.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}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(i?"bottom-full mb-1 ":"top-full 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?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(d=>jsxRuntime.jsxs("button",{onClick:p=>{p.stopPropagation(),r(d),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===d&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:d}),e===d&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},d))})]})}function Og({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}=Sg(t,{delay:s}),p=m=>{m.stopPropagation(),!a&&t&&(n?l?d():i(!e):t(!e));},u=l?o:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:p,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&&jsxRuntime.jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsxRuntime.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?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsxRuntime.jsx("button",{onClick:m=>{m.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:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function Hg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=react.useState(false),d=react.useRef(null),p=uo(d,c,220);react.useEffect(()=>{let b=y=>{d.current&&!d.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let u=e.slice(0,l),m=e.length-u.length,f=e.length===0?n:u.join(", ")+(m>0?` +${m}`:"");if(s||!r)return jsxRuntime.jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||r(x);},h=o!=null&&e.length>=o;return jsxRuntime.jsxs("div",{ref:d,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:b=>{b.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:[jsxRuntime.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:f}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),c&&jsxRuntime.jsx("div",{className:g("absolute z-50 left-0 "+(p?"bottom-full mb-1 ":"top-full 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?jsxRuntime.jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(b=>{let y=e.includes(b),x=!y&&h;return jsxRuntime.jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:b}),y&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function Rk(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 zg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Rk(e);if(n.length===0)return jsxRuntime.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?jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:l})]}):jsxRuntime.jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function jg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.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&&jsxRuntime.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 Ok(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 Hk(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[p,u]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:h,triggerFlash:b}=hs(),y=c==="financial"&&(i>0||d!=null),x=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Ok(e,a);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.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,p]);let k=()=>{let T=Hk(m);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.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?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,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")}):jsxRuntime.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&&jsxRuntime.jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function Yg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.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?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.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?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Jg({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,p=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,m]=react.useState(false),[f,v]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?x/w*100:0,C=T>100?Math.round((x-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(v(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){v(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{v(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:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.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&&x===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&Z&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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=>jsxRuntime.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:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.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=x===0,I=(w>0?x/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(B)]}),C>0&&jsxRuntime.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:["+",p(C)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Z&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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=>jsxRuntime.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:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function _k(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 Kk(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 Qg({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?jsxRuntime.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")}):jsxRuntime.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 Zg({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=_k(e);if(d.length===0)return null;let p=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsxRuntime.jsx(Qg,{assignee:m,size:24,isDark:t},m.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(m=>m.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.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?Kk(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Qg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.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 qk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function t0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",qk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function c1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function d1(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 l0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:p,onReportBlocker:u,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?n0.es:n0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.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]),react.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsxRuntime.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:jsxRuntime.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:jsxRuntime.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:jsxRuntime.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:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsxRuntime.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:c1(P.name),color:P.color||d1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),p&&C.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),m&&C.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&C.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.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?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsxRuntime.jsx(u1,{item:C,isDark:r},C.id):jsxRuntime.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:[jsxRuntime.jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function u1({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var n0={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 b0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"}),multiselect:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),person:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),file:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})},E1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function y0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=react.useState(""),[p,u]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),h=c==="es"?h0.es:h0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let C=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let Z=P.getBoundingClientRect();f({top:Z.bottom+4,right:window.innerWidth-Z.right});}let D=v.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),react.useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),v._cleanup&&v._cleanup();}},[e,t]);let b=react.useMemo(()=>{let C=new Set([...E1]);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},x=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){x(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 jsxRuntime.jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.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:[jsxRuntime.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:[jsxRuntime.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()}),jsxRuntime.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:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.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)"}}),jsxRuntime.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)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.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()}),jsxRuntime.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 jsxRuntime.jsxs("button",{onClick:()=>{V||(P?x(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:[jsxRuntime.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&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.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:b0[C]}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.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()}),jsxRuntime.jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxRuntime.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:[jsxRuntime.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&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.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:b0[C.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.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 h0={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 $1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function w0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,d]=react.useState([""]),p=n==="es"?v0.es:v0.en;react.useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),react.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();},m=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},v=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:p.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:$1.map(h=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.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&&jsxRuntime.jsx("button",{onClick:()=>v(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:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:m,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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:p.cancel}),jsxRuntime.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:p.create})]})]})]}):null}var v0={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 T0={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 N0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),d=s==="es"?T0.es:T0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(m.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:[jsxRuntime.jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let m=!t;a(m),m&&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:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function D0(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 fo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function S0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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&&jsxRuntime.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:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.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,p=c-d,u=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(i)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:fo(d)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(v,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=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:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[m>=0?"+":"",fo(m),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",f,"%)"]})]}),jsxRuntime.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"})]}),jsxRuntime.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:[p>=0?`+${fo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${fo(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.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,m=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:D0(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:D0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.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}),jsxRuntime.jsxs("div",{children:[jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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,p=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 jsxRuntime.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:p})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.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"}),jsxRuntime.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 jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var Z1=[{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 R0(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(...R0(n.subtasks,t+1,s));}return a}function eC(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 p=(s.progress||0)/d;a+=p,n++;}return n>0?a/n:null}function Cs(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=Cs(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 ks(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 tC({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.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"}}):jsxRuntime.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 A0(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 Gd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Gd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function B0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:p,filterDotColor:u="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=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=bl(f,v),z=m==="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=react.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=react.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=react.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=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Fe]=react.useState(true),[Ge,Qe]=react.useState(null),[se,Ze]=react.useState("position"),[_e,$e]=react.useState("asc"),[ft,pt]=react.useState(""),[je,Re]=react.useState(()=>Q().statusFilter),[dt,zt]=react.useState(()=>Q().hideCompleted),[Le,st]=react.useState(y||Z1),[F,J]=react.useState(false),[R,Y]=react.useState(false),[ue,he]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=react.useState(null),[xe,Ie]=react.useState(false),[Ue,Ct]=react.useState(null),[Xe,Dt]=react.useState(null),[mt,Jt]=react.useState(null),xr=react.useRef(0),Er=react.useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,Bt]=react.useState(null),[vr,Gt]=react.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=react.useRef([]),et=react.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=react.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=react.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 Es=Math.max(1,Math.round(Ca*(1-Math.max(0,qr)/ya))),vo=()=>{St.scrollTop+=Es,gr(),St.scrollTop<St.scrollHeight-St.clientHeight&&(gt=requestAnimationFrame(vo));};gt=requestAnimationFrame(vo);}else if(pa<ya&&St.scrollTop>0){let Es=Math.max(1,Math.round(Ca*(1-Math.max(0,pa)/ya))),vo=()=>{St.scrollTop-=Es,gr(),St.scrollTop>0&&(gt=requestAnimationFrame(vo));};gt=requestAnimationFrame(vo);}},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;react.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]=react.useState("all"),[de,ut]=react.useState(false),_=react.useRef(null),fe=react.useRef(null),ee=react.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]);react.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]),react.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]=react.useState(null),[we,N]=react.useState(0),[H,me]=react.useState(0),K=react.useRef(null),[ve,nt]=react.useState(null),[ie,ot]=react.useState(null);react.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]),react.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=react.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=react.useMemo(()=>Le.filter(S=>S.visible),[Le]),ir=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ha=react.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=react.useCallback(S=>{st(S),r.onColumnsChange?.(S);},[r]),tn=react.useCallback(S=>{let X=Le.map(pe=>pe.id===S?{...pe,visible:false}:pe);mr(X);},[Le,mr]),lr=react.useCallback((S,X)=>{Ze(S),$e(X);},[]),Ma=react.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]),Go=react.useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Pn=react.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]);react.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=react.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");},[]),Vo=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),nt(null),ot(null);},[]),hi=react.useCallback((S,X)=>{S.preventDefault(),X!=="name"&&(S.dataTransfer.dropEffect="move",ot(X));},[]),Kr=react.useCallback(()=>{ot(null);},[]),Ss=react.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=react.useCallback(async S=>{if(r.onCreateCustomField){let X={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(X);}Y(false);},[r]),Va=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ba=react.useMemo(()=>{let S=R0(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 yo=react.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 jsxRuntime.jsx(yg,{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 jsxRuntime.jsx(vg,{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 jsxRuntime.jsx(xl,{value:Pe,availableUsers:l,onChange:Ee=>pe({assignees:Ee}),isDark:z,locale:f,disabled:re})}case "startDate":return jsxRuntime.jsx(wl,{value:S.startDate,onChange:re=>pe({startDate:re}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(wl,{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?A0(Gd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Mg,{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 jsxRuntime.jsx(jg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Lg,{value:ye(X.customFieldId)||"",onChange:re=>ke(X.customFieldId,re),isDark:z});case "number":return jsxRuntime.jsx(Rg,{value:ye(X.customFieldId)||0,onChange:re=>ke(X.customFieldId,re),isDark:z});case "date":let We=ye(X.customFieldId);return jsxRuntime.jsx(wl,{value:We?new Date(We):void 0,onChange:re=>ke(X.customFieldId,re),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(Bg,{value:ye(X.customFieldId)||"",options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z});case "checkbox":return jsxRuntime.jsx(Og,{value:ye(X.customFieldId)||false,onChange:re=>ke(X.customFieldId,re),isDark:z});case "multiselect":return jsxRuntime.jsx(Hg,{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 jsxRuntime.jsx(xl,{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 jsxRuntime.jsx(zg,{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 jsxRuntime.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 jsxRuntime.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 jsxRuntime.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}=Cs(S);if($==="financial"){let lt=ze(S),gt=Math.round(lt.dollarAllocated),rr=Math.round(lt.dollarQuoted),gr=rr-gt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[gt>0?jsxRuntime.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&&jsxRuntime.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 jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ia,{value:Pe,onChange:rr=>pe({effortMinutes:rr}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)}),gt!==0&&jsxRuntime.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 jsxRuntime.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}=Cs(S);return jsxRuntime.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 jsxRuntime.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}=Cs(S),at=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.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 jsxRuntime.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 jsxRuntime.jsx(Yg,{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}=Cs(S),at=re>Pe&&Pe>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ks(re)}),Pe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ks(Pe)})]}),Ee>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ks(Ee)})]})]})}return jsxRuntime.jsx(Jg,{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?jsxRuntime.jsx(Zg,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Pe=>{r.onTaskUpdate?.({...S,assignees:Pe});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(t0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let re=oe.get(S.id);if(re!==void 0)return jsxRuntime.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 jsxRuntime.jsx(tC,{value:Pe,onChange:Ee=>pe({weight:Ee}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Ae,oe]),Kn=react.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]),xo=react.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?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ba.length," ",I.pagination.tasks]}),h&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&ee>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),_r==="all"?f==="es"?"Todos":"All":`L${_r}`]}),de&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{children:S.label}),_r===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(N0,{value:je,hideCompleted:dt,onChange:Re,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:I.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(S=>{let X=S.id!=="name",pe=ie===S.id&&ve!==S.id;return jsxRuntime.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:xo[S.id],minWidth:S.minWidth},draggable:X,onDragStart:X?ye=>_n(ye,S.id):void 0,onDragEnd:X?Vo:void 0,onDragOver:X?ye=>hi(ye,S.id):void 0,onDragLeave:X?Kr:void 0,onDrop:X?ye=>Ss(ye,S.id):void 0,onContextMenu:ye=>Ma(ye,void 0,S.id),children:[X&&jsxRuntime.jsx(lucideReact.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?jsxRuntime.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),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),se===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ha(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Kn(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",se===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Kn(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(y0,{isOpen:F,onClose:()=>J(false),columns:Le,customFields:c,mostrarColumnasDensas:w,onColumnsChange:mr,onCreateCustomField:()=>{J(false),Y(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.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}=Cs(S),gr=eC(S);return jsxRuntime.jsxs(framerMotion.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ur=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Ur.type!=="name"&&"justify-center"),style:{width:xo[Ur.id],minWidth:Ur.minWidth},children:Ur.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.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?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.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}),jsxRuntime.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&&x&&jsxRuntime.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?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.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?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxRuntime.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&&jsxRuntime.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}`]})]})})():jsxRuntime.jsx(Ia,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):yo(S,Ur)},Ur.id)),k&&jsxRuntime.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 jsxRuntime.jsxs(framerMotion.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&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.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 jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",lt.type!=="name"&&"justify-center"),style:{width:xo[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"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.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?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.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]&&jsxRuntime.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?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[yo(S,lt),jsxRuntime.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}})]}):yo(S,lt)},lt.id)}),k&&jsxRuntime.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?`+${ks(Math.abs(ye))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ks(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 ks(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 jsxRuntime.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ot=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:xo[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.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&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),Ur]})]}):Ot.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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)}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.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&&jsxRuntime.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"?jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,$t)}),jsxRuntime.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}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Mr,"%)"]})]})]})}return jsxRuntime.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"?jsxRuntime.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=A0(Gd(e||[]));return jsxRuntime.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 jsxRuntime.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)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ba.length===0&&ft&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsxRuntime.jsx(S0,{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));}})]}),jsxRuntime.jsx(l0,{state:ue,onClose:Go,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&&reactDom.createPortal(jsxRuntime.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?jsxRuntime.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:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsxRuntime.jsx(w0,{isOpen:R,onClose:()=>Y(false),onSave:Ga,isDark:z,locale:f})]})}var $0=[{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}],O0=[{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"}],H0=[{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 Vd={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"},jd={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"},_d={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"},Pl={dark:Vd,light:jd,neutral:_d};function U0(e){return Pl[e]||Pl.dark}function Fl(e,t,r,a,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,r),v=Math.min(m.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<r,contR:m.endSerial>a});}let c={};for(let m=r;m<=a;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],d=[],p={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let u=s.length;return i.forEach(m=>{u=Math.max(u,m.lane+1);}),d.forEach(m=>{u=Math.max(u,m.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var rC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],aC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function W0(e){return e==="es"?rC:aC}function z0(e){return (e.getDay()+6)%7}function G0(e,t){let r=new Date(e,t,1),a=z0(r),n=new Date(e,t,1-a),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let u=new Date(n);return u.setDate(n.getDate()+(p-1)),u},l=p=>{let u=p.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 li(e,t){return z0(e.serialToDate(t))>=5}function nC(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 V0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function j0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Ll(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=nC(t),l=42,c=[];for(let{t:d,phaseId:p,phaseName:u}of o){let m=V0(d.startDate),f=V0(d.endDate);if(!m||!f)continue;let v=r.dateToSerial(m),h=r.dateToSerial(f);if(h<1||v>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,x=d.costAtCompletion,w=x!=null?j0(x):j0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?iC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=sC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var oC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sC(e){return oC.test(e)||/^task-\d+/.test(e)}function iC(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 lC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],cC=["January","February","March","April","May","June","July","August","September","October","November","December"];function _0(e,t,r){return `${(r==="es"?lC:cC)[t]} ${e}`}var Kd=26,dC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Al({locale:e}){let t=W0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Il({bar:e,ws:t,money:r,projColor:a,slotH:n=Kd}){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 jsxRuntime.jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),l>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function Rl({chip:e,ws:t,slotH:r=Kd}){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 jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:dC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Bl({more:e,ws:t,slotH:r=Kd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.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 K0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var gC=[{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 q0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:gC.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function Y0({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:p}){let u=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),h=d==="es";react.useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.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:jsxRuntime.jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsxRuntime.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:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,p,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var fC=[{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 X0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:fC.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var yC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},xC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Q0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function p(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p);}},[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 jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,p)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.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,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${p}`)),t.map((d,p)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:xC[d.type]},children:yC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${p}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var J0={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 Z0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=J0[r]||J0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function tf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function kC(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 ef=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function CC(e){return ef[e%ef.length]}function TC(e){return e>1?"over":e>=.9?"warn":"ok"}var qd="\xA0";function $o(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function rf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(tf(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:CC(c),initials:kC(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(p=>{let u=s.get(p.userId);return {name:p.name,initials:u.initials,color:u.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:r}}),d=i.reduce((p,u)=>p+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function af({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=tf(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,p="cal-cap-cell "+(o?"off":TC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:p,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:m=>{!c||!a||a(s,u,m.currentTarget);},onKeyDown:m=>{!c||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,u,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${qd}/${qd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[$o(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",qd,$o(l.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function nf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=p=>{p.key==="Escape"&&r();},d=p=>{n.current&&!n.current.contains(p.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 jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[$o(s),"h asignadas / ",$o(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",$o(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[$o(i.hours),"h / ",$o(i.capacity),"h"]})]},i.name)})})]})}var Yd=28,DC=182;function sf({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:p,onCapDay:u}){let m=l==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(SC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:p}),c&&c[v]?jsxRuntime.jsx(af,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function SC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=react.useMemo(()=>Fl(a,n,t,r),[a,n,t,r]),p=react.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 m={height:`${DC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:m,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let v=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return li(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,v)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Il,{bar:f,ws:t,money:s,projColor:o,slotH:Yd})},`b${v}`)),d.chips.map((f,v)=>jsxRuntime.jsx(Rl,{chip:f,ws:t,slotH:Yd},`c${v}`)),d.more.map((f,v)=>jsxRuntime.jsx(Bl,{more:f,ws:t,slotH:Yd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var EC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function MC(e){return EC.test(e)||/^task-\d+/.test(e)}function PC(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 lf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function FC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function cf(e,t){let r=FC(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?lf(l):lf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?PC(i.name):void 0),p=n.displayId||n.wbsCode||"",u=MC(p||n.id)?"":p||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function df({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.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 jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function uf({onExpand:e}){return jsxRuntime.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:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ns(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function pf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,p=r.projectEndDeltaDays,u=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Ns(r.oldProjectEnd,n)} \u2192 ${Ns(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Ns(r.oldStart,n)," \u2013 ",Ns(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Ns(r.newStart,n)," \u2013 ",Ns(r.newEnd,n)]})]})]}),d?jsxRuntime.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,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.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(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:p>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.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`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var RC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function mf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let p=new Map,u=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&u(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&u(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.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=p=>p.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(p=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(u=>jsxRuntime.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:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsxRuntime.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?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),p.items.map((u,m)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:RC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${m}`))]},p.serial))})}function BC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function $l(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Xd(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 gf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of $l(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 p=$l(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 p){let v=l(f);v>u&&(u=v);}let m=Xd(d)*864e5;return n.set(i,u),s.set(i,u+m),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 ff(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 $l(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 p of i){let u=s.get(p),m=a.get(p);u!=null&&m&&(d=Math.min(d,u-Xd(m)*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&&$l(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Ol(e,t,r,a){let n=BC(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=gf(n,new Map),i=ff(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),p=gf(d,new Map([[t,r.getTime()]])),u=ff(d,p.finish,p.projectEnd),m=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),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=Xd(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.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:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function bf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var HC=132,Hl=26,UC="#5B7FD4";function hf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:p,onCreateTask:u,canReschedule:m,onReschedule:f,members:v=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[x,w]=react.useState("mes"),[k,M]=react.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]=react.useState(false),[C,P]=react.useState([]),[D,V]=react.useState("all"),[$,Z]=react.useState(null),[L,Ae]=react.useState(null),[W,Ce]=react.useState(false),[I,z]=react.useState(null),[Oe,ze]=react.useState(false),Q=react.useMemo(()=>G0(k.y,k.m),[k.y,k.m]),De=a||UC,oe=react.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]);react.useEffect(()=>{y?.({start:bf(Q.serialToDate(1)),end:bf(Q.serialToDate(42))});},[k.y,k.m]);let He=v.length,Se=react.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=react.useMemo(()=>Ll({tasks:e,grid:Q,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,Q,De,o,r]),Ge=react.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=react.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=react.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(!m||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=Ol(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=_0(k.y,k.m,n),J=[{id:"",name:t,color:De}],R=react.useMemo(()=>cf(e,o),[e,o]),Y=react.useMemo(()=>{if(x==="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 x==="semana"?[Q.weeks.find(xe=>pt>=xe.ws&&pt<=xe.we)??Q.weeks[0]]:[]},[x,Q.weeks,pt]),ue=react.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:li(Q,Xe),isHoliday:oe.has(Xe)});let Ct=rf(v,Ue,Se);j[Ie]={days:Ue,capByDay:Ct};}),j},[Y,Q,oe,v,Se]),he=x==="semana"||x==="lookahead",Be=x==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx(q0,{view:x,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:p,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(Y0,{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?jsxRuntime.jsx(X0,{off:C,onToggle:je}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsxRuntime.jsx(mf,{grid:Q,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx(sf,{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?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(yf,{grid:Q,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsxRuntime.jsx(Z0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(WC,{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:m,onDragReschedule:Le,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsxRuntime.jsx(Q0,{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?jsxRuntime.jsx(nf,{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?jsxRuntime.jsx(pf,{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?jsxRuntime.jsx(df,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsxRuntime.jsx(uf,{onExpand:()=>Ce(true)})]}),jsxRuntime.jsx(K0,{projects:J})]})}function yf({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 jsxRuntime.jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),u="cal-day";return li(e,c)&&(u+=" wknd"),p&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function WC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:p,onMore:u,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=react.useMemo(()=>Fl(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(HC,h.laneCount*Hl+36),x=react.useRef(null),[w,k]=react.useState(null),M=(B,T)=>{if(!m||!f){p?.(T);return}B.preventDefault();let C=x.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){p?.(T);return}let Ae=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Ae);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",Z);};return jsxRuntime.jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(yf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=v?.uid===B.t.uid?v.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsxRuntime.jsx("div",{onPointerDown:Z=>M(Z,B.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Il,{bar:$,ws:t,money:s,projColor:o,slotH:Hl})},`b${T}`)}),h.chips.map((B,T)=>jsxRuntime.jsx(Rl,{chip:B,ws:t,slotH:Hl},`c${T}`)),h.more.map((B,T)=>jsxRuntime.jsx(Bl,{more:B,ws:t,slotH:Hl,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function GC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),d=react.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=react.useMemo(()=>{let m=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,v=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:p.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[p.uniqueAssignees," assignees"]})]}),p.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.id))})})]})}var vf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function di(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 ui(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 wf(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 kf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...vf,...o}),[o]),[i,d]=react.useState(new Set),p=react.useRef(null),u=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{d(x=>{let w=new Set(x);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=react.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 react.useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[ui(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.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&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:p,children:u.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((x,w)=>{let k=i.has(x.id),M=s===x.id,B=wf(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ui(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:di(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(C.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),x.metadata&&Object.keys(x.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(C)})]},T))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Tf({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],p=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:p&&ui(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&di(p)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:p&&p.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:m=>l(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:di(m)},m.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(m=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:p&&p.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Qd(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 Zd(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 Nf(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 Df(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function YC(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 p=r/2,u=a/2;d.vx+=(p-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(m=>{if(d.id===m.id)return;let f=d.x-m.x,v=d.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=v/h*b;});}),t.forEach(d=>{let p=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!p||!u)return;let m=u.x-p.x,f=u.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,u.vx-=m*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 Sf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[d,p]=react.useState([]),[u,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=YC(e,t,r.width,r.height,r,150);p($);},[e,t,r]);let M=react.useCallback(($,Z)=>{r.enableDragging&&(Z.stopPropagation(),m($));},[r.enableDragging]),B=react.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;p(Ce=>Ce.map(I=>I.id===u?{...I,x:Ae,y:W,fx:Ae,fy:W}:I));},[u,y,w]),T=react.useCallback(()=>{m(null);},[]),C=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),P=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),D=react.useCallback($=>{let Z=d.find(L=>L.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[d]),V=react.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?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Qd($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Nf($)," ",Zd($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.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=Df($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsxRuntime.jsx("line",{x1:Z.x,y1:Z.y,x2:L.x,y2:L.y,stroke:Qd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsxRuntime.jsx("text",{x:(Z.x+L.x)/2,y:(Z.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zd($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let Z=f===$.id,L=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",Z&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>M($.id,Ae),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Ae=>C($,Ae),children:[jsxRuntime.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&&jsxRuntime.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)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Pf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,d]=react.useState(null),[p,u]=react.useState(null),m=react.useRef(null),f=l||n;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{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=()=>{p&&(r(p),v());};return e?jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:v,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),p.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>jsxRuntime.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},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.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})]})},x)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:m,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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,x)=>jsxRuntime.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},x))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,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"}),p?jsxRuntime.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"}):jsxRuntime.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 eu={"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 JC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},QC={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 ZC(e,t,r){let a=eu[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function pi(e){return `$${e.toFixed(4)}`}var tu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=ZC(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let a=r.length,n=r.reduce((p,u)=>p+u.cost,0),s=r.reduce((p,u)=>p+u.inputTokens,0),o=r.reduce((p,u)=>p+u.outputTokens,0),l=r.filter(p=>p.success),c=r.reduce((p,u)=>p+u.duration,0),i={},d={};return r.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,d[p.feature]=(d[p.feature]||0)+p.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)}},Ho=new tu;function Af({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Ho.getStats()),[s,o]=react.useState(Ho.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Ho.getStats()),o(Ho.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),react.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=Ho.getRecentOperations(5);return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:pi(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,p=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:pi(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:pi(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Bf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[d,p]=react.useState(""),[u,m]=react.useState(false),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),k=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.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(""),p(""),v(null),b(null),x(null),t());},B=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(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),x({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){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.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)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.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))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref: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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value: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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:P=>p(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&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,D)=>jsxRuntime.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))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick: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?jsxRuntime.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"}):jsxRuntime.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 zl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,y)=>{a(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},B=x.cards.map(P=>P.id===h?M:P),T=x.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={...x,cards:B,columns:T};return n(C),C});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=react.useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=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:x,columns:w};return n(k),k});},[n]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),d=react.useCallback(async(h,b)=>{a(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),u=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=react.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:p},setBoard:a,helpers:{addCard:u,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Of({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=zl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(p=>p.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var mi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Uf={by:"none",order:"asc"};function Wf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...mi,...e}),[s,o]=react.useState({...Uf,...t}),l=react.useCallback(v=>{n(h=>({...h,...v}));},[]),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),i=react.useCallback(()=>{n(mi),o(Uf);},[]),d=react.useCallback(()=>{r&&n({...mi,assignees:[r]});},[r]),p=react.useCallback(()=>{n({...mi,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...mi,priorities:["HIGH","URGENT"]});},[]),m=react.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=react.useCallback(v=>{let h=[...v];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(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${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(x=>a.assignees.includes(x)))),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 x=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;x=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"];x=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();x=D-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,Z=y.estimatedTime||0;x=$-Z;break;default:x=0;}return s.order==="asc"?x:-x}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:p,filterHighPriority:u,applyFilters:f,hasActiveFilters:m}}var Gf,Vf;if(typeof window<"u")try{let e=vi("ai");Gf=e.generateObject,Vf=e.generateText;}catch{}function jf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(Gf&&Vf&&e.apiKey),o=react.useCallback(async p=>{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:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let m=u instanceof Error?u:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),l=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let m=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),c=react.useCallback(async p=>{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 m=u instanceof Error?u:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(u){let m=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),d=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(u){let m=u instanceof Error?u:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function au(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function _f(e){let{cards:t}=e,[r,a]=au(),n=react.useCallback(p=>r.selectedCardIds.includes(p),[r.selectedCardIds]),s=react.useCallback((p,u)=>{if(!u){a({selectedCardIds:[p],lastSelectedCardId:p});return}let m=u.ctrlKey||u.metaKey,f=u.shiftKey;if(m)r.selectedCardIds.includes(p)?a({selectedCardIds:r.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});else if(f&&r.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===r.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(T=>T.columnId===v.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),x=b.findIndex(T=>T.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});},[t,r,a]),o=react.useCallback(p=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==p),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(p=>{r.selectedCardIds.includes(p)?o(p):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});},[r,o,a]),d=react.useCallback(()=>t.filter(p=>r.selectedCardIds.includes(p.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 Kf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function qf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Kf,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((v,h,b,y,x)=>{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:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=react.useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=react.useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=react.useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=react.useCallback(async v=>{let h=t.filter(k=>k.columnId===v);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:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.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:v,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:v,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:v,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=react.useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:p,getStacksForColumn:u,getSuggestions:m,applySuggestion:f,config:n}}var Yf=react.createContext(null);function Xf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Yf.Provider,{value:{store:n},children:e})}function Gl(){let e=react.useContext(Yf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function fi(){let e=Gl(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,x)=>{e.updateColumn(y,x);},[e]),d=react.useCallback(y=>{e.deleteColumn(y);},[e]),p=react.useCallback(y=>e.getColumn(y),[e]),u=react.useCallback(y=>{e.addCard(y);},[e]),m=react.useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),v=react.useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),h=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:p,addCard:u,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function Qf(e){let{cards:t}=fi();return react.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 Zf(e="position",t="asc"){let{cards:r}=fi();return react.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 Vl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ou.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);}},b2=new Vl;function tb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),p=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,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 jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(v,f.index)},h)})})})}function rb(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function nb({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=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:m,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function ob(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function sb(e,t=10){return e>t}var iu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},cu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},du={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},uu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},pu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},mu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},gu={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)"},fu={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)"},bu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},hu={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}},yu={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}},jl={spacing:iu,borderRadius:lu,fontSize:cu,fontWeight:du,lineHeight:uu,zIndex:pu,duration:mu,easing:gu,shadows:fu,opacity:bu,kanban:hu,gantt:yu};function ib(e,t,r){return e[t]??r}function xu(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)?xu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function x2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vu(e="asakaa"){let t=xu(jl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=x2(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:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsxRuntime.jsx("span",{className:"truncate",children:l})]}):jsxRuntime.jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function jg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsxRuntime.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&&jsxRuntime.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 Ok(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 Hk(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[p,u]=react.useState(false),[m,f]=react.useState(""),v=react.useRef(null),{isFlashing:h,triggerFlash:b}=hs(),y=c==="financial"&&(i>0||d!=null),x=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Ok(e,a);react.useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),react.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,p]);let k=()=>{let T=Hk(m);T!==e&&(t?.(T),o&&b()),u(false);},M=T=>{T.key==="Enter"?k():T.key==="Escape"&&u(false);};if(l)return jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.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?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsxRuntime.jsx(B,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):p?jsxRuntime.jsx("input",{ref:v,type:"text",value:m,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")}):jsxRuntime.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&&jsxRuntime.jsx(B,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:w})]})}function Yg({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.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?jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsxRuntime.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?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsxRuntime.jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Jg({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,p=W=>d?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[u,m]=react.useState(false),[f,v]=react.useState(false),[h,b]=react.useState(null),y=react.useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,B=Math.round(w/60*10)/10,T=w>0?x/w*100:0,C=T>100?Math.round((x-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!f&&!h)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(v(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){v(Ce=>!Ce),b(null);return}o&&o(e);},V=W=>{v(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:lucideReact.Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:lucideReact.Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:lucideReact.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&&x===0&&k===0?jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&Z&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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=>jsxRuntime.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:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]}):jsxRuntime.jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxRuntime.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=x===0,I=(w>0?x/w:0)>1.1;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(B)]}),C>0&&jsxRuntime.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:["+",p(C)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsxRuntime.jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsxRuntime.jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Z&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:f&&jsxRuntime.jsx(framerMotion.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=>jsxRuntime.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:[jsxRuntime.jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:h&&jsxRuntime.jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsxRuntime.jsx(framerMotion.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:jsxRuntime.jsx(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:$,onClose:()=>b(null)})})})})]})}function _k(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 Kk(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 Qg({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?jsxRuntime.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")}):jsxRuntime.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 Zg({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=_k(e);if(d.length===0)return null;let p=d.slice(0,3),u=d.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsxRuntime.jsx(Qg,{assignee:m,size:24,isDark:t},m.name+f))}),u>0&&jsxRuntime.jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(m=>m.name).join(", "),children:["+",u]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsxRuntime.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?Kk(l):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Qg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxRuntime.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 qk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function t0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxRuntime.jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",qk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function c1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function d1(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 l0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:p,onReportBlocker:u,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=react.useRef(null),y=a==="es"?n0.es:n0.en,[x,w]=react.useState({left:e.x,top:e.y});if(react.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]),react.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsxRuntime.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:jsxRuntime.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:jsxRuntime.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:jsxRuntime.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:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsxRuntime.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:c1(P.name),color:P.color||d1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:$}),t();}}))})),p&&C.push({id:"log-time",label:y.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),u&&C.push({id:"report-blocker",label:y.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),m&&C.push({id:"copy-link",label:y.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),C.push({id:"sep2",label:"",icon:null,separator:true}),s&&C.push({id:"duplicate",label:y.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(C.push({id:"sep3",label:"",icon:null,separator:true}),f&&(C.push({id:"move-up",label:y.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),C.push({id:"move-down",label:y.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&C.push({id:"indent",label:y.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&C.push({id:"outdent",label:y.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&C.push({id:"delete",label:y.delete,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),C.push({id:"sort-desc",label:y.sortDesc,icon:jsxRuntime.jsx(lucideReact.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:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),C},B=e.type==="task"?k():M(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsxRuntime.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?jsxRuntime.jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},C.id):C.submenu?jsxRuntime.jsx(u1,{item:C,isDark:r},C.id):jsxRuntime.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:[jsxRuntime.jsx("span",{className:g(C.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:C.icon}),C.label]},C.id))})}function u1({item:e,isDark:t}){let[r,a]=react.useState(false),n=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:e.label}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var n0={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 b0={name:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),status:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-4 h-4"}),priority:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),assignees:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),startDate:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),endDate:jsxRuntime.jsx(lucideReact.CalendarCheck,{className:"w-4 h-4"}),progress:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),tags:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),estimatedTime:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),quotedTime:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),elapsedTime:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),effortMinutes:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsxRuntime.jsx(lucideReact.Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsxRuntime.jsx(lucideReact.FileText,{className:"w-4 h-4"}),scheduleVariance:jsxRuntime.jsx(lucideReact.CalendarClock,{className:"w-4 h-4"}),hoursBar:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),teamLoad:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),blockers:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),weight:jsxRuntime.jsx(lucideReact.BarChart,{className:"w-4 h-4"}),text:jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"}),number:jsxRuntime.jsx(lucideReact.Hash,{className:"w-4 h-4"}),date:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),dropdown:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}),checkbox:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-4 h-4"}),multiselect:jsxRuntime.jsx(lucideReact.Tag,{className:"w-4 h-4"}),person:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),file:jsxRuntime.jsx(lucideReact.Paperclip,{className:"w-4 h-4"})},E1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function y0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,d]=react.useState(""),[p,u]=react.useState(null),[m,f]=react.useState(null),v=react.useRef(null),h=c==="es"?h0.es:h0.en;react.useLayoutEffect(()=>{if(!e||!v.current)return;let C=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let Z=P.getBoundingClientRect();f({top:Z.bottom+4,right:window.innerWidth-Z.right});}let D=v.current.getBoundingClientRect(),$=window.innerHeight-D.top-20;u(Math.max(300,$));};return requestAnimationFrame(C),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[e]),react.useEffect(()=>{if(!e)return;let C=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},D=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",D),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(C),v._cleanup&&v._cleanup();}},[e,t]);let b=react.useMemo(()=>{let C=new Set([...E1]);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},x=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){x(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 jsxRuntime.jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.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:[jsxRuntime.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:[jsxRuntime.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()}),jsxRuntime.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:jsxRuntime.jsx(lucideReact.X,{className:"w-3.5 h-3.5"})})]}),jsxRuntime.jsx("div",{className:"px-3 py-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.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)"}}),jsxRuntime.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)";}})]})}),jsxRuntime.jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:C=>C.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"mb-1",children:[jsxRuntime.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()}),jsxRuntime.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 jsxRuntime.jsxs("button",{onClick:()=>{V||(P?x(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:[jsxRuntime.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&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.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:b0[C]}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"mt-1",children:[jsxRuntime.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()}),jsxRuntime.jsx("div",{className:"space-y-px",children:B.map(C=>{let D=r.find(V=>V.customFieldId===C.id)?.visible??false;return jsxRuntime.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:[jsxRuntime.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&&jsxRuntime.jsx(lucideReact.Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsxRuntime.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:b0[C.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.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 h0={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 $1=[{type:"text",icon:jsxRuntime.jsx(lucideReact.Type,{className:"w-5 h-5"})},{type:"number",icon:jsxRuntime.jsx(lucideReact.Hash,{className:"w-5 h-5"})},{type:"date",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsxRuntime.jsx(lucideReact.CheckSquare,{className:"w-5 h-5"})}];function w0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=react.useState(""),[l,c]=react.useState("text"),[i,d]=react.useState([""]),p=n==="es"?v0.es:v0.en;react.useEffect(()=>{e&&(o(""),c("text"),d([""]));},[e]),react.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();},m=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},v=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};return e?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxRuntime.jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:p.title}),jsxRuntime.jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:$1.map(h=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.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&&jsxRuntime.jsx("button",{onClick:()=>v(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:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"})})]},b)),jsxRuntime.jsxs("button",{onClick:m,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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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:p.cancel}),jsxRuntime.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:p.create})]})]})]}):null}var v0={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 T0={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 N0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=react.useState(false),c=react.useRef(null),i=react.useRef(0),d=s==="es"?T0.es:T0.en;react.useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:d.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.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:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),d.filters,u&&jsxRuntime.jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxRuntime.jsxs("button",{onClick:()=>{r(m.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:[jsxRuntime.jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsxRuntime.jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let m=!t;a(m),m&&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:[jsxRuntime.jsx(lucideReact.EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function D0(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 fo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function S0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=n==="financial";return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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&&jsxRuntime.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:jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsxRuntime.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,p=c-d,u=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(d/c*100),120):0,h=d>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(i)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(B,T)=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsxRuntime.jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:B}),jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(T)})]});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:fo(d)})]}),k&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsxRuntime.jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(v,100)}%`,backgroundColor:b}})}),i>0&&jsxRuntime.jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=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:[jsxRuntime.jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxRuntime.jsxs("div",{className:"text-base",children:[m>=0?"+":"",fo(m),c>0&&jsxRuntime.jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",f,"%)"]})]}),jsxRuntime.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"})]}),jsxRuntime.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:[p>=0?`+${fo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${fo(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxRuntime.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,m=(i>0?c/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:D0(c)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:D0(i)})]}),i>0&&jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntime.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}),jsxRuntime.jsxs("div",{children:[jsxRuntime.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"}),jsxRuntime.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&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsxRuntime.jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.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,p=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 jsxRuntime.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:p})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.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"}),jsxRuntime.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 jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxRuntime.jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${c.name}-${i}`)})})]})]})}var Z1=[{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 R0(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(...R0(n.subtasks,t+1,s));}return a}function eC(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 p=(s.progress||0)/d;a+=p,n++;}return n>0?a/n:null}function Cs(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=Cs(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 ks(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 tC({value:e,onChange:t,isDark:r}){let[a,n]=react.useState(false),[s,o]=react.useState(String(e||""));return a?jsxRuntime.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"}}):jsxRuntime.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 A0(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 Gd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Gd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function B0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:p,filterDotColor:u="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=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=bl(f,v),z=m==="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=react.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=react.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=react.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=react.useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:De.spent,totalHoursAllocatedMinutes:De.allocated}},[V,De]),[Se,Fe]=react.useState(true),[Ge,Qe]=react.useState(null),[se,Ze]=react.useState("position"),[_e,$e]=react.useState("asc"),[ft,pt]=react.useState(""),[je,Re]=react.useState(()=>Q().statusFilter),[dt,zt]=react.useState(()=>Q().hideCompleted),[Le,st]=react.useState(y||Z1),[F,J]=react.useState(false),[R,Y]=react.useState(false),[ue,he]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[Be,j]=react.useState(null),[xe,Ie]=react.useState(false),[Ue,Ct]=react.useState(null),[Xe,Dt]=react.useState(null),[mt,Jt]=react.useState(null),xr=react.useRef(0),Er=react.useRef(false),Rt=!!(r.onTaskMove||r.onTaskReparent),[Hr,Bt]=react.useState(null),[vr,Gt]=react.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=react.useRef([]),et=react.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=react.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=react.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 Es=Math.max(1,Math.round(Ca*(1-Math.max(0,qr)/ya))),vo=()=>{St.scrollTop+=Es,gr(),St.scrollTop<St.scrollHeight-St.clientHeight&&(gt=requestAnimationFrame(vo));};gt=requestAnimationFrame(vo);}else if(pa<ya&&St.scrollTop>0){let Es=Math.max(1,Math.round(Ca*(1-Math.max(0,pa)/ya))),vo=()=>{St.scrollTop-=Es,gr(),St.scrollTop>0&&(gt=requestAnimationFrame(vo));};gt=requestAnimationFrame(vo);}},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;react.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]=react.useState("all"),[de,ut]=react.useState(false),_=react.useRef(null),fe=react.useRef(null),ee=react.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]);react.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]),react.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]=react.useState(null),[we,N]=react.useState(0),[H,me]=react.useState(0),K=react.useRef(null),[ve,nt]=react.useState(null),[ie,ot]=react.useState(null);react.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]),react.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=react.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=react.useMemo(()=>Le.filter(S=>S.visible),[Le]),ir=react.useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ha=react.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=react.useCallback(S=>{st(S),r.onColumnsChange?.(S);},[r]),tn=react.useCallback(S=>{let X=Le.map(pe=>pe.id===S?{...pe,visible:false}:pe);mr(X);},[Le,mr]),lr=react.useCallback((S,X)=>{Ze(S),$e(X);},[]),Ma=react.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]),Go=react.useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Pn=react.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]);react.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=react.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");},[]),Vo=react.useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),nt(null),ot(null);},[]),hi=react.useCallback((S,X)=>{S.preventDefault(),X!=="name"&&(S.dataTransfer.dropEffect="move",ot(X));},[]),Kr=react.useCallback(()=>{ot(null);},[]),Ss=react.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=react.useCallback(async S=>{if(r.onCreateCustomField){let X={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(X);}Y(false);},[r]),Va=react.useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ba=react.useMemo(()=>{let S=R0(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 yo=react.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 jsxRuntime.jsx(yg,{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 jsxRuntime.jsx(vg,{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 jsxRuntime.jsx(xl,{value:Pe,availableUsers:l,onChange:Ee=>pe({assignees:Ee}),isDark:z,locale:f,disabled:re})}case "startDate":return jsxRuntime.jsx(wl,{value:S.startDate,onChange:re=>pe({startDate:re}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsxRuntime.jsx(wl,{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?A0(Gd(S.subtasks||[])):S.progress||0;return jsxRuntime.jsx(Mg,{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 jsxRuntime.jsx(jg,{value:S.tags||[],isDark:z});case "text":return jsxRuntime.jsx(Lg,{value:ye(X.customFieldId)||"",onChange:re=>ke(X.customFieldId,re),isDark:z});case "number":return jsxRuntime.jsx(Rg,{value:ye(X.customFieldId)||0,onChange:re=>ke(X.customFieldId,re),isDark:z});case "date":let We=ye(X.customFieldId);return jsxRuntime.jsx(wl,{value:We?new Date(We):void 0,onChange:re=>ke(X.customFieldId,re),isDark:z,locale:f});case "dropdown":return jsxRuntime.jsx(Bg,{value:ye(X.customFieldId)||"",options:X.options||[],onChange:re=>ke(X.customFieldId,re),isDark:z});case "checkbox":return jsxRuntime.jsx(Og,{value:ye(X.customFieldId)||false,onChange:re=>ke(X.customFieldId,re),isDark:z});case "multiselect":return jsxRuntime.jsx(Hg,{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 jsxRuntime.jsx(xl,{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 jsxRuntime.jsx(zg,{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 jsxRuntime.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 jsxRuntime.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 jsxRuntime.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}=Cs(S);if($==="financial"){let lt=ze(S),gt=Math.round(lt.dollarAllocated),rr=Math.round(lt.dollarQuoted),gr=rr-gt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[gt>0?jsxRuntime.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&&jsxRuntime.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 jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Ia,{value:Pe,onChange:rr=>pe({effortMinutes:rr}),isDark:z,locale:f,disabled:re,lens:$,hourlyRate:Oe(S)}),gt!==0&&jsxRuntime.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 jsxRuntime.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}=Cs(S);return jsxRuntime.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 jsxRuntime.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}=Cs(S),at=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsxRuntime.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 jsxRuntime.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 jsxRuntime.jsx(Yg,{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}=Cs(S),at=re>Pe&&Pe>0;return jsxRuntime.jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ks(re)}),Pe>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-white/60":"text-gray-600",children:ks(Pe)})]}),Ee>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ks(Ee)})]})]})}return jsxRuntime.jsx(Jg,{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?jsxRuntime.jsx(Zg,{task:S,isDark:z,locale:f}):jsxRuntime.jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Pe=>{r.onTaskUpdate?.({...S,assignees:Pe});},isDark:z,locale:f});case "blockers":return jsxRuntime.jsx(t0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let re=oe.get(S.id);if(re!==void 0)return jsxRuntime.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 jsxRuntime.jsx(tC,{value:Pe,onChange:Ee=>pe({weight:Ee}),isDark:z})}default:return jsxRuntime.jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,I,Ae,oe]),Kn=react.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]),xo=react.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?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxRuntime.jsxs("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[I.empty.noTasks,"..."]})]})}):n?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:g("flex-1 flex items-center justify-center",z?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsxRuntime.jsx("h3",{className:g("text-lg font-semibold mb-2",z?"text-white":"text-gray-900"),children:I.empty.noTasks}),jsxRuntime.jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:I.empty.addFirstTask})]})}):jsxRuntime.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:[jsxRuntime.jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:[Ba.length," ",I.pagination.tasks]}),h&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",z?"text-white/60":"text-gray-400")}),jsxRuntime.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")})]}),jsxRuntime.jsx("div",{className:"flex-1"}),i&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:i}),b&&ee>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.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:[jsxRuntime.jsx(lucideReact.Layers,{className:"w-3.5 h-3.5"}),_r==="all"?f==="es"?"Todos":"All":`L${_r}`]}),de&&jsxRuntime.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=>jsxRuntime.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:[jsxRuntime.jsx("span",{children:S.label}),_r===S.value&&jsxRuntime.jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsxRuntime.jsx(N0,{value:je,hideCompleted:dt,onChange:Re,onHideCompletedChange:zt,isDark:z,locale:f}),He?.enabled&&He.data&&!Se&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,T&&C&&jsxRuntime.jsxs(framerMotion.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:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:I.toolbar.newTask})]})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsxRuntime.jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxRuntime.jsxs("div",{style:{width:"100%"},children:[jsxRuntime.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(S=>{let X=S.id!=="name",pe=ie===S.id&&ve!==S.id;return jsxRuntime.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:xo[S.id],minWidth:S.minWidth},draggable:X,onDragStart:X?ye=>_n(ye,S.id):void 0,onDragEnd:X?Vo:void 0,onDragOver:X?ye=>hi(ye,S.id):void 0,onDragLeave:X?Kr:void 0,onDrop:X?ye=>Ss(ye,S.id):void 0,onContextMenu:ye=>Ma(ye,void 0,S.id),children:[X&&jsxRuntime.jsx(lucideReact.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?jsxRuntime.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),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),se===S.id&&jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>ha(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Kn(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:g("w-3 h-3",se===S.id&&"text-[#00E5CC]")})]}):jsxRuntime.jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Kn(S),p?.includes(S.id)&&jsxRuntime.jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),M&&S.resizable&&jsxRuntime.jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:ye=>Pn(ye,S.id),children:jsxRuntime.jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",O===S.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},S.id)}),k&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(y0,{isOpen:F,onClose:()=>J(false),columns:Le,customFields:c,mostrarColumnasDensas:w,onColumnsChange:mr,onCreateCustomField:()=>{J(false),Y(true);},isDark:z,locale:f})]})]}),jsxRuntime.jsx(framerMotion.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}=Cs(S),gr=eC(S);return jsxRuntime.jsxs(framerMotion.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ur=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Ur.type!=="name"&&"justify-center"),style:{width:xo[Ur.id],minWidth:Ur.minWidth},children:Ur.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.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?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:Ot=>{Ot.stopPropagation(),ir(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:pe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.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}),jsxRuntime.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&&x&&jsxRuntime.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?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.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?jsxRuntime.jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxRuntime.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&&jsxRuntime.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}`]})]})})():jsxRuntime.jsx(Ia,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:$,hourlyRate:Oe(S)}):yo(S,Ur)},Ur.id)),k&&jsxRuntime.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 jsxRuntime.jsxs(framerMotion.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&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Rt&&jsxRuntime.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:jsxRuntime.jsx(lucideReact.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 jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",lt.type!=="name"&&"justify-center"),style:{width:xo[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"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsxRuntime.jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsxRuntime.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?jsxRuntime.jsx(lucideReact.ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsxRuntime.jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsxRuntime.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]&&jsxRuntime.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?jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[yo(S,lt),jsxRuntime.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}})]}):yo(S,lt)},lt.id)}),k&&jsxRuntime.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?`+${ks(Math.abs(ye))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ks(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 ks(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 jsxRuntime.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&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Mt.map(Ot=>jsxRuntime.jsx("div",{className:g("flex items-center px-4 py-3",Ot.type!=="name"&&"justify-center"),style:{width:xo[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.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&&jsxRuntime.jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsxRuntime.jsx(lucideReact.Info,{className:"w-2.5 h-2.5"}),Ur]})]}):Ot.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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)}),jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.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&&jsxRuntime.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"?jsxRuntime.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 jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(X,$t)}),jsxRuntime.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}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Mr,"%)"]})]})]})}return jsxRuntime.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"?jsxRuntime.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=A0(Gd(e||[]));return jsxRuntime.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 jsxRuntime.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)),"%"]})})():jsxRuntime.jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),k&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ba.length===0&&ft&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:g("w-12 h-12 mx-auto mb-4",z?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:I.empty.noResults})]})})]})}),He?.enabled&&He.data&&Se&&jsxRuntime.jsx(S0,{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));}})]}),jsxRuntime.jsx(l0,{state:ue,onClose:Go,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&&reactDom.createPortal(jsxRuntime.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?jsxRuntime.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:[jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:z?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsxRuntime.jsx(w0,{isOpen:R,onClose:()=>Y(false),onSave:Ga,isDark:z,locale:f})]})}var $0=[{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}],O0=[{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"}],H0=[{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 Vd={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"},jd={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"},_d={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"},Pl={dark:Vd,light:jd,neutral:_d};function U0(e){return Pl[e]||Pl.dark}function Fl(e,t,r,a,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,r),v=Math.min(m.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<r,contR:m.endSerial>a});}let c={};for(let m=r;m<=a;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],d=[],p={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let u=s.length;return i.forEach(m=>{u=Math.max(u,m.lane+1);}),d.forEach(m=>{u=Math.max(u,m.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var rC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],aC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function W0(e){return e==="es"?rC:aC}function z0(e){return (e.getDay()+6)%7}function G0(e,t){let r=new Date(e,t,1),a=z0(r),n=new Date(e,t,1-a),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let u=new Date(n);return u.setDate(n.getDate()+(p-1)),u},l=p=>{let u=p.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 li(e,t){return z0(e.serialToDate(t))>=5}function nC(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 V0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function j0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Ll(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=nC(t),l=42,c=[];for(let{t:d,phaseId:p,phaseName:u}of o){let m=V0(d.startDate),f=V0(d.endDate);if(!m||!f)continue;let v=r.dateToSerial(m),h=r.dateToSerial(f);if(h<1||v>l)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,x=d.costAtCompletion,w=x!=null?j0(x):j0(y*n),k=d.assignees?.[0],M=k?.initials||(k?.name?iC(k.name):void 0),B=d.displayId||d.wbsCode||"",T=sC(B||d.id)?"":B||d.id;c.push({uid:d.id,id:T,name:d.name,projectId:s,color:d.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!d.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:u});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var oC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function sC(e){return oC.test(e)||/^task-\d+/.test(e)}function iC(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 lC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],cC=["January","February","March","April","May","June","July","August","September","October","November","December"];function _0(e,t,r){return `${(r==="es"?lC:cC)[t]} ${e}`}var Kd=26,dC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Al({locale:e}){let t=W0(e);return jsxRuntime.jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsxRuntime.jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Il({bar:e,ws:t,money:r,projColor:a,slotH:n=Kd}){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??s.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxRuntime.jsxs("div",{className:c,style:d,children:[s.critical&&l>=3?jsxRuntime.jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"nom",children:s.name}),l>=3?jsxRuntime.jsx("span",{className:"val",children:i}):null]})}function Rl({chip:e,ws:t,slotH:r=Kd}){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 jsxRuntime.jsxs("div",{className:n,style:s,children:[jsxRuntime.jsx("span",{className:"ico",children:dC[e.it.type]}),jsxRuntime.jsx("span",{className:"lbl2",children:e.it.label})]})}function Bl({more:e,ws:t,slotH:r=Kd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxRuntime.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 K0({projects:e}){return jsxRuntime.jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var gC=[{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 q0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxRuntime.jsxs("div",{className:"cal-topbar",children:[jsxRuntime.jsxs("div",{className:"cal-projsel",children:[s,jsxRuntime.jsx("span",{className:"caret",children:"\u25BE"})]}),jsxRuntime.jsx("div",{className:"cal-spacer"}),jsxRuntime.jsx("div",{className:"cal-seg",children:gC.map(o=>jsxRuntime.jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsxRuntime.jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxRuntime.jsxs("div",{className:"cal-seg",children:[jsxRuntime.jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsxRuntime.jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function Y0({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:p}){let u=o?o.length:0,[m,f]=react.useState(false),v=react.useRef(null),h=d==="es";react.useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxRuntime.jsxs("div",{className:"cal-toolbar",children:[jsxRuntime.jsxs("div",{className:"cal-nav-arrows",children:[jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsxRuntime.jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsxRuntime.jsx("div",{className:"cal-month-label",children:e}),jsxRuntime.jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsxRuntime.jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxRuntime.jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsxRuntime.jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxRuntime.jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsxRuntime.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:jsxRuntime.jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsxRuntime.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:jsxRuntime.jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,p,jsxRuntime.jsx("div",{className:"cal-toolbar-right",children:jsxRuntime.jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxRuntime.jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var fC=[{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 X0({off:e,onToggle:t}){let r=e||[];return jsxRuntime.jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:fC.map(a=>{let n=r.includes(a.id);return jsxRuntime.jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsxRuntime.jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"nm",children:a.nm}),jsxRuntime.jsx("div",{className:"sub",children:a.sub})]}),jsxRuntime.jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var yC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},xC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Q0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=react.useRef(null);react.useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function p(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p);}},[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 jsxRuntime.jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} elementos`,children:[jsxRuntime.jsx("div",{className:"cal-pop-head",children:jsxRuntime.jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",l===1?"elemento":"elementos"]})}),jsxRuntime.jsxs("div",{className:"cal-pop-list",children:[r.map((d,p)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsxRuntime.jsx("span",{className:"tk",children:d.taskId}):null,jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsxRuntime.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,jsxRuntime.jsx("span",{className:"v",children:d.value})]},`t${p}`)),t.map((d,p)=>jsxRuntime.jsxs("div",{className:"cal-pop-item",children:[jsxRuntime.jsx("span",{className:"ico",style:{color:xC[d.type]},children:yC[d.type]}),jsxRuntime.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsxRuntime.jsx("span",{className:"v",children:i(d)})]},`i${p}`)),jsxRuntime.jsx("div",{className:"cal-scrollbar"})]})]})}var J0={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 Z0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=J0[r]||J0.es;return jsxRuntime.jsxs("div",{className:"cal-empty",children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:n.title}),jsxRuntime.jsxs("p",{children:[n.body,jsxRuntime.jsx("br",{}),jsxRuntime.jsx("b",{children:e})]}),a?jsxRuntime.jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxRuntime.jsxs("div",{className:"cal-empty-hitos",children:[jsxRuntime.jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxRuntime.jsxs("div",{className:"cal-empty-hito",children:[jsxRuntime.jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsxRuntime.jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function tf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function kC(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 ef=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function CC(e){return ef[e%ef.length]}function TC(e){return e>1?"over":e>=.9?"warn":"ok"}var qd="\xA0";function $o(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function rf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(tf(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:CC(c),initials:kC(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(p=>{let u=s.get(p.userId);return {name:p.name,initials:u.initials,color:u.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:r}}),d=i.reduce((p,u)=>p+u.hours,0);a.set(l,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function af({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsxRuntime.jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=tf(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,p="cal-cap-cell "+(o?"off":TC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxRuntime.jsxs("div",{className:p,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:u,onClick:m=>{!c||!a||a(s,u,m.currentTarget);},onKeyDown:m=>{!c||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,u,m.currentTarget));},children:[jsxRuntime.jsx("div",{className:"nums",children:o||!c?jsxRuntime.jsx("span",{children:o?"\u2014":`0h${qd}/${qd}\u2014`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[$o(l.assigned),"h"]}),jsxRuntime.jsxs("span",{children:["/",qd,$o(l.capacity),"h"]})]})}),jsxRuntime.jsx("div",{className:"cal-cap-track",children:c?jsxRuntime.jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function nf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=react.useRef(null);react.useEffect(()=>{let i=p=>{p.key==="Escape"&&r();},d=p=>{n.current&&!n.current.contains(p.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 jsxRuntime.jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxRuntime.jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[$o(s),"h asignadas / ",$o(o),"h"]}),l?jsxRuntime.jsx("div",{className:"rng",children:jsxRuntime.jsxs("b",{children:["+",$o(c),"h sobre capacidad"]})}):jsxRuntime.jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsxRuntime.jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxRuntime.jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsxRuntime.jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsxRuntime.jsx("span",{className:"nm",title:i.name,children:i.name}),jsxRuntime.jsx("div",{className:"cal-person-track",children:jsxRuntime.jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxRuntime.jsxs("span",{className:"hrs",children:[$o(i.hours),"h / ",$o(i.capacity),"h"]})]},i.name)})})]})}var Yd=28,DC=182;function sf({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:d,onMore:p,onCapDay:u}){let m=l==="es";return jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsxRuntime.jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxRuntime.jsxs("div",{style:{display:"contents"},children:[jsxRuntime.jsx(SC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:p}),c&&c[v]?jsxRuntime.jsx(af,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:u}):null]},f.ws))}),jsxRuntime.jsxs("div",{className:"cal-cap-label",children:[jsxRuntime.jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsxRuntime.jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function SC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let d=react.useMemo(()=>Fl(a,n,t,r),[a,n,t,r]),p=react.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 m={height:`${DC}px`,flex:"none"};return jsxRuntime.jsxs("div",{className:"cal-week",style:m,children:[jsxRuntime.jsx("div",{className:"cal-week-bg",children:u.map(f=>{let v=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return li(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsxRuntime.jsx("div",{className:b,children:jsxRuntime.jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxRuntime.jsxs("div",{className:"cal-items",children:[d.bars.map((f,v)=>jsxRuntime.jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsxRuntime.jsx(Il,{bar:f,ws:t,money:s,projColor:o,slotH:Yd})},`b${v}`)),d.chips.map((f,v)=>jsxRuntime.jsx(Rl,{chip:f,ws:t,slotH:Yd},`c${v}`)),d.more.map((f,v)=>jsxRuntime.jsx(Bl,{more:f,ws:t,slotH:Yd,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var EC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function MC(e){return EC.test(e)||/^task-\d+/.test(e)}function PC(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 lf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function FC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function cf(e,t){let r=FC(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?lf(l):lf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?PC(i.name):void 0),p=n.displayId||n.wbsCode||"",u=MC(p||n.id)?"":p||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:c,who:d,projColor:n.color});}return a}function df({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxRuntime.jsxs("div",{className:"cal-side",children:[jsxRuntime.jsxs("div",{className:"cal-side-head",children:[jsxRuntime.jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsxRuntime.jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxRuntime.jsxs("div",{className:"cal-side-sec",children:[jsxRuntime.jsx("span",{children:"Arrastra al calendario"}),jsxRuntime.jsx("span",{children:e.length})]}),e.length===0?jsxRuntime.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 jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"row1",children:[s.id?jsxRuntime.jsx("span",{className:"tk",children:s.id}):null,jsxRuntime.jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsxRuntime.jsx("div",{className:"nom",children:s.name}),jsxRuntime.jsxs("div",{className:"meta",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsxRuntime.jsx("span",{children:o}),s.who?jsxRuntime.jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function uf({onExpand:e}){return jsxRuntime.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:[jsxRuntime.jsx("span",{className:"pc",children:"\u27E8"}),jsxRuntime.jsx("span",{className:"dot"}),jsxRuntime.jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Ns(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function pf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=react.useRef(null),i=n==="es";react.useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,p=r.projectEndDeltaDays,u=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Ns(r.oldProjectEnd,n)} \u2192 ${Ns(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxRuntime.jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxRuntime.jsxs("div",{className:"cal-pop-head",children:[jsxRuntime.jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxRuntime.jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxRuntime.jsxs("div",{className:"rng",children:[Ns(r.oldStart,n)," \u2013 ",Ns(r.oldEnd,n)," \u2192 ",jsxRuntime.jsxs("b",{children:[Ns(r.newStart,n)," \u2013 ",Ns(r.newEnd,n)]})]})]}),d?jsxRuntime.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,jsxRuntime.jsxs("div",{className:"cal-impact",children:[jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsxRuntime.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(", "):""}`})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsxRuntime.jsx("span",{className:p>0?"v bad":"v good",children:u})]}),jsxRuntime.jsxs("div",{className:"cal-impact-row",children:[jsxRuntime.jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsxRuntime.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`})]})]}),jsxRuntime.jsxs("div",{className:"cal-pop-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:d||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var RC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function mf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=react.useMemo(()=>{let p=new Map,u=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&u(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&u(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxRuntime.jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsxRuntime.jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsxRuntime.jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsxRuntime.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=p=>p.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsxRuntime.jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(p=>jsxRuntime.jsxs("div",{className:"cal-agenda-day",children:[jsxRuntime.jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(u=>jsxRuntime.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:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsxRuntime.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?jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsxRuntime.jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),p.items.map((u,m)=>jsxRuntime.jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsxRuntime.jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:RC[u.type]??"\xB7"}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${m}`))]},p.serial))})}function BC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function $l(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Xd(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 gf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of $l(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 p=$l(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 p){let v=l(f);v>u&&(u=v);}let m=Xd(d)*864e5;return n.set(i,u),s.set(i,u+m),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 ff(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 $l(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 p of i){let u=s.get(p),m=a.get(p);u!=null&&m&&(d=Math.min(d,u-Xd(m)*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&&$l(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Ol(e,t,r,a){let n=BC(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=gf(n,new Map),i=ff(n,c.finish,c.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),p=gf(d,new Map([[t,r.getTime()]])),u=ff(d,p.finish,p.projectEnd),m=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),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=Xd(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.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:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function bf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var HC=132,Hl=26,UC="#5B7FD4";function hf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:p,onCreateTask:u,canReschedule:m,onReschedule:f,members:v=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[x,w]=react.useState("mes"),[k,M]=react.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]=react.useState(false),[C,P]=react.useState([]),[D,V]=react.useState("all"),[$,Z]=react.useState(null),[L,Ae]=react.useState(null),[W,Ce]=react.useState(false),[I,z]=react.useState(null),[Oe,ze]=react.useState(false),Q=react.useMemo(()=>G0(k.y,k.m),[k.y,k.m]),De=a||UC,oe=react.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]);react.useEffect(()=>{y?.({start:bf(Q.serialToDate(1)),end:bf(Q.serialToDate(42))});},[k.y,k.m]);let He=v.length,Se=react.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=react.useMemo(()=>Ll({tasks:e,grid:Q,projectColor:()=>De,hourlyRate:o,projectId:r}),[e,Q,De,o,r]),Ge=react.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=react.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=react.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(!m||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=Ol(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=_0(k.y,k.m,n),J=[{id:"",name:t,color:De}],R=react.useMemo(()=>cf(e,o),[e,o]),Y=react.useMemo(()=>{if(x==="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 x==="semana"?[Q.weeks.find(xe=>pt>=xe.ws&&pt<=xe.we)??Q.weeks[0]]:[]},[x,Q.weeks,pt]),ue=react.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:li(Q,Xe),isHoliday:oe.has(Xe)});let Ct=rf(v,Ue,Se);j[Ie]={days:Ue,capByDay:Ct};}),j},[Y,Q,oe,v,Se]),he=x==="semana"||x==="lookahead",Be=x==="agenda";return jsxRuntime.jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsxRuntime.jsx(q0,{view:x,onViewChange:w,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:p,onMoneyChange:j=>c(j==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsxRuntime.jsx(Y0,{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?jsxRuntime.jsx(X0,{off:C,onToggle:je}):null}),jsxRuntime.jsxs("div",{className:"cal-body",children:[jsxRuntime.jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Be?"hidden":void 0},children:[Be?jsxRuntime.jsx(mf,{grid:Q,tasks:Ze,items:_e,money:l,projColor:De,todaySerial:pt,locale:n,onTaskOpen:i}):he?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx(sf,{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?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(yf,{grid:Q,ws:j.ws,we:j.we,todaySerial:pt,showFestivos:$e,holidaySerials:oe,locale:n,deadlineDays:new Set},j.ws))}),jsxRuntime.jsx(Z0,{monthLabel:F,locale:n,onCreateTask:u})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Al,{locale:n}),jsxRuntime.jsx("div",{className:"cal-weeks",children:Q.weeks.map(j=>jsxRuntime.jsx(WC,{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:m,onDragReschedule:Le,pendingGhost:I?{uid:I.uid,days:Math.round((I.sim.newStart.getTime()-I.sim.oldStart.getTime())/864e5)}:null},j.ws))})]}),$?jsxRuntime.jsx(Q0,{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?jsxRuntime.jsx(nf,{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?jsxRuntime.jsx(pf,{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?jsxRuntime.jsx(df,{items:R,money:l,projColor:De,onItemClick:j=>i?.(j),onCollapse:()=>Ce(false)}):jsxRuntime.jsx(uf,{onExpand:()=>Ce(true)})]}),jsxRuntime.jsx(K0,{projects:J})]})}function yf({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 jsxRuntime.jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),d=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),u="cal-day";return li(e,c)&&(u+=" wknd"),p&&(u+=" festivo"),d||(u+=" out"),c===a&&(u+=" today"),o.has(c)&&(u+=" deadline-day"),jsxRuntime.jsxs("div",{className:u,children:[jsxRuntime.jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsxRuntime.jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function WC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,onTaskOpen:p,onMore:u,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=react.useMemo(()=>Fl(a,n,t,r),[a,n,t,r]),b=react.useMemo(()=>new Set(n.filter(B=>B.type==="deadline").map(B=>B.serial)),[n]),y=Math.max(HC,h.laneCount*Hl+36),x=react.useRef(null),[w,k]=react.useState(null),M=(B,T)=>{if(!m||!f){p?.(T);return}B.preventDefault();let C=x.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){p?.(T);return}let Ae=new DOMRect(L.clientX,L.clientY,0,0);f(T,V,Ae);};window.addEventListener("pointermove",$),window.addEventListener("pointerup",Z);};return jsxRuntime.jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsxRuntime.jsx(yf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:d,deadlineDays:b}),jsxRuntime.jsxs("div",{className:"cal-items",children:[h.bars.map((B,T)=>{let C=w?.id===B.t.uid?w.days:null,P=v?.uid===B.t.uid?v.days:null,D=C??P??0,V=C==null&&P!=null,$=D!==0?{...B,s:B.s+D,e:B.e+D}:B;return jsxRuntime.jsx("div",{onPointerDown:Z=>M(Z,B.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsxRuntime.jsx(Il,{bar:$,ws:t,money:s,projColor:o,slotH:Hl})},`b${T}`)}),h.chips.map((B,T)=>jsxRuntime.jsx(Rl,{chip:B,ws:t,slotH:Hl},`c${T}`)),h.more.map((B,T)=>jsxRuntime.jsx(Bl,{more:B,ws:t,slotH:Hl,onClick:()=>u(B.day,B.items,a.filter(C=>C.startSerial<=B.day&&C.endSerial>=B.day))},`m${T}`))]})]})}function GC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=react.useState(false),d=react.useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=react.useMemo(()=>{let m=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,v=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxRuntime.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:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:u,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:p.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[p.uniqueAssignees," assignees"]})]}),p.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[p.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:d.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:d.map(m=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsxRuntime.jsx("h4",{children:m.title}),m.description&&jsxRuntime.jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.id))})})]})}var vf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function di(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 ui(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 wf(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 kf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=react.useMemo(()=>({...vf,...o}),[o]),[i,d]=react.useState(new Set),p=react.useRef(null),u=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=react.useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{d(x=>{let w=new Set(x);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=react.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 react.useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:g("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,types:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxRuntime.jsxs("option",{value:y,children:[ui(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,users:x?[x]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),m.map(y=>jsxRuntime.jsx("option",{value:y,children:y},y))]}),jsxRuntime.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&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:p,children:u.map(y=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:y.events.map((x,w)=>{let k=i.has(x.id),M=s===x.id,B=wf(x.type);return jsxRuntime.jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:B},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:ui(x.type)})}),w<y.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:B}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&x.userAvatar&&jsxRuntime.jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:di(x)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(C.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(C.to)})]})]},T)),x.metadata&&Object.keys(x.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([T,C])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(C)})]},T))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Tf({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],p=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:g("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:g("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:p&&ui(p.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:p&&di(p)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:p&&p.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:m=>l(parseInt(m.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsxRuntime.jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:di(m)},m.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:d.map(m=>jsxRuntime.jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:p&&p.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(m=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxRuntime.jsxs("div",{className:g("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Qd(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 Zd(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 Nf(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 Df(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function YC(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 p=r/2,u=a/2;d.vx+=(p-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(m=>{if(d.id===m.id)return;let f=d.x-m.x,v=d.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=v/h*b;});}),t.forEach(d=>{let p=l.get(typeof d.source=="string"?d.source:d.source.id),u=l.get(typeof d.target=="string"?d.target:d.target.id);if(!p||!u)return;let m=u.x-p.x,f=u.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,u.vx-=m*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 Sf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=react.useRef(null),[d,p]=react.useState([]),[u,m]=react.useState(null),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(1),[w,k]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let $=YC(e,t,r.width,r.height,r,150);p($);},[e,t,r]);let M=react.useCallback(($,Z)=>{r.enableDragging&&(Z.stopPropagation(),m($));},[r.enableDragging]),B=react.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;p(Ce=>Ce.map(I=>I.id===u?{...I,x:Ae,y:W,fx:Ae,fy:W}:I));},[u,y,w]),T=react.useCallback(()=>{m(null);},[]),C=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"node-click",node:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),P=react.useCallback(($,Z)=>{Z.stopPropagation(),l?.({type:"edge-click",edge:$,position:{x:Z.clientX,y:Z.clientY}});},[l]),D=react.useCallback($=>{let Z=d.find(L=>L.id===$);return Z?{x:Z.x,y:Z.y}:{x:0,y:0}},[d]),V=react.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?jsxRuntime.jsxs("div",{className:g("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:g("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:Qd($)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[Nf($)," ",Zd($)]})]},$))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:B,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsxRuntime.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=Df($.type),W=h===$.id,Ce=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>b($.id),onMouseLeave:()=>b(null),onClick:I=>P($,I),children:[jsxRuntime.jsx("line",{x1:Z.x,y1:Z.y,x2:L.x,y2:L.y,stroke:Qd($.type),strokeWidth:Ce?r.edgeWidth*2:r.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&W&&jsxRuntime.jsx("text",{x:(Z.x+L.x)/2,y:(Z.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Zd($.type)})]},$.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:d.map($=>{let Z=f===$.id,L=$.onCriticalPath;return jsxRuntime.jsxs("g",{className:g("relationships-graph-node",Z&&"hovered",L&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Ae=>M($.id,Ae),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Ae=>C($,Ae),children:[jsxRuntime.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&&jsxRuntime.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)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Pf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=react.useState(""),[l,c]=react.useState(false),[i,d]=react.useState(null),[p,u]=react.useState(null),m=react.useRef(null),f=l||n;react.useEffect(()=>{e&&m.current&&m.current.focus();},[e]),react.useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{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=()=>{p&&(r(p),v());};return e?jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:v,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),p.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>jsxRuntime.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},x))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsxRuntime.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})]})},x)),p.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:m,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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,x)=>jsxRuntime.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},x))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:f&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:v,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"}),p?jsxRuntime.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"}):jsxRuntime.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 eu={"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 JC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},QC={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 ZC(e,t,r){let a=eu[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function pi(e){return `$${e.toFixed(4)}`}var tu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=ZC(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(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let a=r.length,n=r.reduce((p,u)=>p+u.cost,0),s=r.reduce((p,u)=>p+u.inputTokens,0),o=r.reduce((p,u)=>p+u.outputTokens,0),l=r.filter(p=>p.success),c=r.reduce((p,u)=>p+u.duration,0),i={},d={};return r.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,d[p.feature]=(d[p.feature]||0)+p.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)}},Ho=new tu;function Af({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=react.useState(Ho.getStats()),[s,o]=react.useState(Ho.checkLimit(r));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Ho.getStats()),o(Ho.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),react.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=Ho.getRecentOperations(5);return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:pi(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let d=a.costsByFeature[c]||0,p=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:pi(d)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:pi(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Bf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=react.useState(""),[c,i]=react.useState(""),[d,p]=react.useState(""),[u,m]=react.useState(false),[f,v]=react.useState(null),[h,b]=react.useState(null),[y,x]=react.useState(null),w=react.useRef(null),k=u||n;react.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),react.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(""),p(""),v(null),b(null),x(null),t());},B=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(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),x({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){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{h&&(r(h),M());};if(!e)return null;let C=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(nr,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxRuntime.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)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,D)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",D+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxRuntime.jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsxRuntime.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))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref: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}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value: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})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:d,onChange:P=>p(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&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,D)=>jsxRuntime.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))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick: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?jsxRuntime.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"}):jsxRuntime.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 zl({initialBoard:e,onPersist:t}){let[r,a]=react.useState(e),n=react.useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=react.useCallback(async(h,b,y)=>{a(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},B=x.cards.map(P=>P.id===h?M:P),T=x.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={...x,cards:B,columns:T};return n(C),C});},[n]),o=react.useCallback(async(h,b)=>{a(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=react.useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=react.useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=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:x,columns:w};return n(k),k});},[n]),i=react.useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),d=react.useCallback(async(h,b)=>{a(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=react.useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),u=react.useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=react.useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=react.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:p},setBoard:a,helpers:{addCard:u,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Of({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=zl({initialBoard:e,onPersist:r}),o=react.useMemo(()=>({addCard:(c,i,d={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(p=>p.columnId===c).length,...d});},addColumn:(c,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:react.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var mi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Uf={by:"none",order:"asc"};function Wf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=react.useState({...mi,...e}),[s,o]=react.useState({...Uf,...t}),l=react.useCallback(v=>{n(h=>({...h,...v}));},[]),c=react.useCallback(v=>{o(h=>({...h,...v}));},[]),i=react.useCallback(()=>{n(mi),o(Uf);},[]),d=react.useCallback(()=>{r&&n({...mi,assignees:[r]});},[r]),p=react.useCallback(()=>{n({...mi,dateFilter:"overdue"});},[]),u=react.useCallback(()=>{n({...mi,priorities:["HIGH","URGENT"]});},[]),m=react.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=react.useCallback(v=>{let h=[...v];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(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${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(x=>a.assignees.includes(x)))),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 x=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;x=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"];x=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();x=D-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let $=b.estimatedTime||0,Z=y.estimatedTime||0;x=$-Z;break;default:x=0;}return s.order==="asc"?x:-x}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:d,filterOverdue:p,filterHighPriority:u,applyFilters:f,hasActiveFilters:m}}var Gf,Vf;if(typeof window<"u")try{let e=vi("ai");Gf=e.generateObject,Vf=e.generateText;}catch{}function jf(e={}){let[t,r]=react.useState(false),[a,n]=react.useState(null),s=!!(Gf&&Vf&&e.apiKey),o=react.useCallback(async p=>{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:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(u){let m=u instanceof Error?u:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),l=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(u){let m=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),c=react.useCallback(async p=>{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 m=u instanceof Error?u:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(u){let m=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),d=react.useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(u){let m=u instanceof Error?u:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function au(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=react.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function _f(e){let{cards:t}=e,[r,a]=au(),n=react.useCallback(p=>r.selectedCardIds.includes(p),[r.selectedCardIds]),s=react.useCallback((p,u)=>{if(!u){a({selectedCardIds:[p],lastSelectedCardId:p});return}let m=u.ctrlKey||u.metaKey,f=u.shiftKey;if(m)r.selectedCardIds.includes(p)?a({selectedCardIds:r.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});else if(f&&r.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===r.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(T=>T.columnId===v.columnId).sort((T,C)=>T.position-C.position),y=b.findIndex(T=>T.id===r.lastSelectedCardId),x=b.findIndex(T=>T.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(T=>T.id),B=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:B,lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});},[t,r,a]),o=react.useCallback(p=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==p),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=react.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=react.useCallback(()=>{a({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=react.useCallback(p=>{r.selectedCardIds.includes(p)?o(p):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});},[r,o,a]),d=react.useCallback(()=>t.filter(p=>r.selectedCardIds.includes(p.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 Kf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function qf(e){let{cards:t,config:r,aiService:a}=e,n=react.useMemo(()=>({...Kf,...r}),[r]),[s,o]=react.useState([]),l=react.useCallback((v,h,b,y,x)=>{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:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=react.useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=react.useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),d=react.useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=react.useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=react.useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=react.useCallback(async v=>{let h=t.filter(k=>k.columnId===v);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:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.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:v,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:v,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:v,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=react.useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return react.useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:d,removeFromStack:p,getStacksForColumn:u,getSuggestions:m,applySuggestion:f,config:n}}var Yf=react.createContext(null);function Xf({children:e,initialData:t,onStateChange:r}){let a=react.useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:s,cards:o});}let n=a.current;return react.useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(Yf.Provider,{value:{store:n},children:e})}function Gl(){let e=react.useContext(Yf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function fi(){let e=Gl(),[t,r]=react.useState(e.getBoard()),[a,n]=react.useState(e.getAllColumns()),[s,o]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=react.useCallback(y=>{e.updateBoard(y);},[e]),c=react.useCallback(y=>{e.addColumn(y);},[e]),i=react.useCallback((y,x)=>{e.updateColumn(y,x);},[e]),d=react.useCallback(y=>{e.deleteColumn(y);},[e]),p=react.useCallback(y=>e.getColumn(y),[e]),u=react.useCallback(y=>{e.addCard(y);},[e]),m=react.useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=react.useCallback(y=>{e.deleteCard(y);},[e]),v=react.useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),h=react.useCallback(y=>e.getCard(y),[e]),b=react.useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:d,getColumn:p,addCard:u,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function Qf(e){let{cards:t}=fi();return react.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 Zf(e="position",t="asc"){let{cards:r}=fi();return react.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 Vl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ou.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);}},b5=new Vl;function tb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=react.useRef(null),d=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),p=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:u,className:n,children:jsxRuntime.jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,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 jsxRuntime.jsx("div",{style:b,"data-index":f.index,children:a(v,f.index)},h)})})})}function rb(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function nb({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=react.useRef(null),p=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:l}),u=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:d,style:m,className:s,children:jsxRuntime.jsx("div",{style:f,children:u.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsxRuntime.jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function ob(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function sb(e,t=10){return e>t}var iu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},cu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},du={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},uu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},pu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},mu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},gu={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)"},fu={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)"},bu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},hu={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}},yu={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}},jl={spacing:iu,borderRadius:lu,fontSize:cu,fontWeight:du,lineHeight:uu,zIndex:pu,duration:mu,easing:gu,shadows:fu,opacity:bu,kanban:hu,gantt:yu};function ib(e,t,r){return e[t]??r}function xu(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)?xu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function x5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function vu(e="asakaa"){let t=xu(jl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=x5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${r.join(`
|
|
416
416
|
`)}
|
|
417
417
|
}`}function bi(e,t="asakaa"){let r=[],a=xu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
|
|
@@ -440,6 +440,6 @@ ${bi(ku,"asakaa").split(`
|
|
|
440
440
|
`).slice(1,-1).join(`
|
|
441
441
|
`)}
|
|
442
442
|
}
|
|
443
|
-
`}var
|
|
444
|
-
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Af;exports.AI_FEATURES=QC;exports.AI_MODELS=eu;exports.AddCardButton=Ec;exports.AddColumnButton=Cc;exports.AttachmentUploader=ts;exports.BoardProvider=Xf;exports.BulkOperationsToolbar=Ki;exports.BurnDownChart=Bc;exports.CUSTOM_FIELD_TYPES=H0;exports.CalendarBoard=hf;exports.Card=An;exports.CardHistoryReplay=Tf;exports.CardHistoryTimeline=kf;exports.CardRelationshipsGraph=Sf;exports.CardStack=GC;exports.CardTemplateSelector=Gc;exports.CircuitBreaker=rc;exports.Column=Xo;exports.ColumnManager=Zi;exports.CommandPalette=Fc;exports.ConfigMenu=Kc;exports.ContextMenu=cs;exports.DEFAULT_SHORTCUTS=js;exports.DEFAULT_TABLE_COLUMNS=$0;exports.DEFAULT_TEMPLATES=zc;exports.DateRangePicker=Fs;exports.DependenciesSelector=As;exports.DependencyLine=Qs;exports.DistributionCharts=$c;exports.EditableColumnTitle=dc;exports.ErrorBoundary=es;exports.ExportDropdown=Mm;exports.ExportImportModal=jc;exports.FilterBar=_c;exports.GANTT_AI_SYSTEM_PROMPT=cg;exports.GanttAIAssistant=ul;exports.GanttBoard=og;exports.GanttI18nContext=ss;exports.GanttMilestone=il;exports.GanttToolbar=Qi;exports.GenerateGanttTasksDialog=Bf;exports.GeneratePlanModal=Pf;exports.GroupBySelector=Uc;exports.HealthBar=bc;exports.KanbanBoard=eo;exports.KanbanToolbar=wc;exports.KanbanViewAdapter=Gs;exports.KeyboardShortcutsHelp=Wc;exports.ListView=B0;exports.MenuIcons=tr;exports.PluginManager=Vl;exports.PrioritySelector=Co;exports.ProfitabilityReport=hc;exports.QuickTaskCreate=Ws;exports.RATE_LIMITS=JC;exports.STANDARD_FIELDS=O0;exports.SwimlaneBoardView=Oc;exports.TagBadge=pc;exports.TagList=wp;exports.TagPicker=Jo;exports.TaskBar=rl;exports.TaskDetailModal=Eo;exports.TaskFormModal=lg;exports.TaskGrid=tl;exports.ThemeModal=Jc;exports.ThemeProvider=hm;exports.ThemeSwitcher=cb;exports.TimeInputPopover=wn;exports.TimePill=mc;exports.TimePopover=gc;exports.Timeline=ll;exports.UserAssignmentSelector=No;exports.VelocityChart=Rc;exports.VirtualGrid=nb;exports.VirtualList=tb;exports.aiUsageTracker=Ho;exports.borderRadius=lu;exports.buildCalendar=Ll;exports.calculatePosition=ki;exports.cardToGanttTask=gl;exports.cardsToGanttTasks=bg;exports.cn=g;exports.createKanbanView=Jp;exports.createRetryWrapper=Fb;exports.darkTheme=qc;exports.darkTokenTheme=_l;exports.defaultTheme=Yi;exports.designTokens=jl;exports.duration=mu;exports.easing=gu;exports.exportTokensToCSS=lb;exports.findTaskByName=Un;exports.fontSize=cu;exports.fontWeight=du;exports.formatCost=pi;exports.ganttEnTranslations=Ji;exports.ganttEsTranslations=xm;exports.ganttTaskToCardUpdate=fg;exports.ganttThemes=it;exports.ganttTokens=yu;exports.ganttTranslations=Qc;exports.ganttUtils=Te;exports.generateCSSVariables=vu;exports.generateCompleteCSS=Cu;exports.generateInitialPositions=Sb;exports.generateTasksContext=dg;exports.generateThemeVariables=bi;exports.getListViewTheme=U0;exports.getListViewTranslations=wd;exports.getToken=ib;exports.getTranslations=vm;exports.kanbanTokens=hu;exports.lightTheme=Yc;exports.lightTokenTheme=wu;exports.lineHeight=uu;exports.listViewDarkTheme=Vd;exports.listViewEnTranslations=xd;exports.listViewEsTranslations=vd;exports.listViewLightTheme=jd;exports.listViewNeutralTheme=_d;exports.listViewThemes=Pl;exports.listViewTranslations=fl;exports.mergeListViewTranslations=bl;exports.mergeTranslations=Zc;exports.neutralTheme=Xc;exports.neutralTokenTheme=ku;exports.opacity=bu;exports.parseLocalCommand=mg;exports.parseNaturalDate=bd;exports.parseNaturalDuration=hd;exports.parseProgress=yd;exports.parseStatus=pg;exports.pluginManager=
|
|
443
|
+
`}var v5=({theme:e})=>{switch(e){case "dark":return jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function cb({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=ns();return jsxRuntime.jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,l])=>{let c=o,i=c===a;return jsxRuntime.jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsxRuntime.jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsxRuntime.jsx(v5,{theme:c})}),e&&!t&&jsxRuntime.jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
444
|
+
Object.defineProperty(exports,"BoardModel",{enumerable:true,get:function(){return core.Board}});Object.defineProperty(exports,"BoardStore",{enumerable:true,get:function(){return core.BoardStore}});Object.defineProperty(exports,"CardModel",{enumerable:true,get:function(){return core.Card}});Object.defineProperty(exports,"ColumnModel",{enumerable:true,get:function(){return core.Column}});Object.defineProperty(exports,"DependencyEngine",{enumerable:true,get:function(){return core.DependencyEngine}});Object.defineProperty(exports,"Store",{enumerable:true,get:function(){return core.Store}});exports.AIUsageDashboard=Af;exports.AI_FEATURES=QC;exports.AI_MODELS=eu;exports.AddCardButton=Ec;exports.AddColumnButton=Cc;exports.AttachmentUploader=ts;exports.BoardProvider=Xf;exports.BulkOperationsToolbar=Ki;exports.BurnDownChart=Bc;exports.CUSTOM_FIELD_TYPES=H0;exports.CalendarBoard=hf;exports.Card=An;exports.CardHistoryReplay=Tf;exports.CardHistoryTimeline=kf;exports.CardRelationshipsGraph=Sf;exports.CardStack=GC;exports.CardTemplateSelector=Gc;exports.CircuitBreaker=rc;exports.Column=Xo;exports.ColumnManager=Zi;exports.CommandPalette=Fc;exports.ConfigMenu=Kc;exports.ContextMenu=cs;exports.DEFAULT_SHORTCUTS=js;exports.DEFAULT_TABLE_COLUMNS=$0;exports.DEFAULT_TEMPLATES=zc;exports.DateRangePicker=Fs;exports.DependenciesSelector=As;exports.DependencyLine=Qs;exports.DistributionCharts=$c;exports.EditableColumnTitle=dc;exports.ErrorBoundary=es;exports.ExportDropdown=Mm;exports.ExportImportModal=jc;exports.FilterBar=_c;exports.GANTT_AI_SYSTEM_PROMPT=cg;exports.GanttAIAssistant=ul;exports.GanttBoard=og;exports.GanttI18nContext=ss;exports.GanttMilestone=il;exports.GanttToolbar=Qi;exports.GenerateGanttTasksDialog=Bf;exports.GeneratePlanModal=Pf;exports.GroupBySelector=Uc;exports.HealthBar=bc;exports.KanbanBoard=eo;exports.KanbanToolbar=wc;exports.KanbanViewAdapter=Gs;exports.KeyboardShortcutsHelp=Wc;exports.ListView=B0;exports.MenuIcons=tr;exports.PluginManager=Vl;exports.PrioritySelector=Co;exports.ProfitabilityReport=hc;exports.QuickTaskCreate=Ws;exports.RATE_LIMITS=JC;exports.STANDARD_FIELDS=O0;exports.SwimlaneBoardView=Oc;exports.TagBadge=pc;exports.TagList=wp;exports.TagPicker=Jo;exports.TaskBar=rl;exports.TaskDetailModal=Eo;exports.TaskFormModal=lg;exports.TaskGrid=tl;exports.ThemeModal=Jc;exports.ThemeProvider=hm;exports.ThemeSwitcher=cb;exports.TimeInputPopover=wn;exports.TimePill=mc;exports.TimePopover=gc;exports.Timeline=ll;exports.UserAssignmentSelector=No;exports.VelocityChart=Rc;exports.VirtualGrid=nb;exports.VirtualList=tb;exports.aiUsageTracker=Ho;exports.borderRadius=lu;exports.buildCalendar=Ll;exports.calculatePosition=ki;exports.cardToGanttTask=gl;exports.cardsToGanttTasks=bg;exports.cn=g;exports.createKanbanView=Jp;exports.createRetryWrapper=Fb;exports.darkTheme=qc;exports.darkTokenTheme=_l;exports.defaultTheme=Yi;exports.designTokens=jl;exports.duration=mu;exports.easing=gu;exports.exportTokensToCSS=lb;exports.findTaskByName=Un;exports.fontSize=cu;exports.fontWeight=du;exports.formatCost=pi;exports.ganttEnTranslations=Ji;exports.ganttEsTranslations=xm;exports.ganttTaskToCardUpdate=fg;exports.ganttThemes=it;exports.ganttTokens=yu;exports.ganttTranslations=Qc;exports.ganttUtils=Te;exports.generateCSSVariables=vu;exports.generateCompleteCSS=Cu;exports.generateInitialPositions=Sb;exports.generateTasksContext=dg;exports.generateThemeVariables=bi;exports.getListViewTheme=U0;exports.getListViewTranslations=wd;exports.getToken=ib;exports.getTranslations=vm;exports.kanbanTokens=hu;exports.lightTheme=Yc;exports.lightTokenTheme=wu;exports.lineHeight=uu;exports.listViewDarkTheme=Vd;exports.listViewEnTranslations=xd;exports.listViewEsTranslations=vd;exports.listViewLightTheme=jd;exports.listViewNeutralTheme=_d;exports.listViewThemes=Pl;exports.listViewTranslations=fl;exports.mergeListViewTranslations=bl;exports.mergeTranslations=Zc;exports.neutralTheme=Xc;exports.neutralTokenTheme=ku;exports.opacity=bu;exports.parseLocalCommand=mg;exports.parseNaturalDate=bd;exports.parseNaturalDuration=hd;exports.parseProgress=yd;exports.parseStatus=pg;exports.pluginManager=b5;exports.retrySyncOperation=Pb;exports.retryWithBackoff=Ci;exports.shadows=fu;exports.shouldVirtualizeGrid=sb;exports.simulateReschedule=Ol;exports.spacing=iu;exports.themes=Po;exports.useAI=jf;exports.useBoard=Of;exports.useBoardCore=fi;exports.useBoardStore=Gl;exports.useCardStacking=qf;exports.useDragState=xc;exports.useFilteredCards=Qf;exports.useFilters=Wf;exports.useGanttI18n=qa;exports.useKanbanState=zl;exports.useKeyboardShortcuts=gm;exports.useMultiSelect=_f;exports.useSelectionState=au;exports.useSortedCards=Zf;exports.useTheme=ns;exports.useVirtualGrid=ob;exports.useVirtualList=rb;exports.validateAIResponse=gg;exports.withErrorBoundary=Mc;exports.wouldCreateCircularDependency=Di;exports.zIndex=pu;//# sourceMappingURL=index.cjs.map
|
|
445
445
|
//# sourceMappingURL=index.cjs.map
|