@libxai/board 1.5.74 → 1.5.75
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/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -363,9 +363,9 @@
|
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ot,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${yt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ke,borderBottom:`1px solid ${xt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ct,border:`1px solid ${rt}`,color:"#2E94FF"},children:jsxRuntime.jsx(vm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:$},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsxRuntime.jsx(Pv,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsxRuntime.jsx(Fv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((U,oe)=>jsxRuntime.jsx("button",{onClick:()=>Ta(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ce,color:te,border:`1px solid ${W}`},onMouseEnter:$e=>{$e.currentTarget.style.borderColor=Ge,$e.currentTarget.style.color="#2E94FF";},onMouseLeave:$e=>{$e.currentTarget.style.borderColor=W,$e.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Te:Ne,color:U.role==="user"?"#2E94FF":Tt,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${Ve}`},children:[U.isLoading?jsxRuntime.jsx(Av,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:U=>{if(E&&Me.length>0){U.preventDefault();return}Ut(U);},className:"p-3 relative",style:{borderTop:`1px solid ${gt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&Me.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Wt,border:`1px solid ${Oe}`,boxShadow:Le,backdropFilter:"blur(12px)"},children:Me.map((U,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===D?ut:"transparent",color:ne},onMouseEnter:()=>X(oe),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map($e=>$e[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:fe},children:U.email})]})]},U.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:U=>qe(U.target.value),onKeyDown:U=>{Ie(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:qt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?At:"transparent",color:x.trim()?"#2E94FF":Dt,border:x.trim()?`1px solid ${vt}`:"1px solid transparent"},children:jsxRuntime.jsx(Mv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Rv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Cm(e){return {...Rv,...e}}var Vv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:v,toolbarRightContent:E,showBaseline:I,viewMode:D,onViewModeChange:X,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:Y,onTaskContextMenu:Z,onTaskUpdate:Se,onDependentTasksScheduled:R,onProgressChange:_,onTaskEdit:he,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Pe,onBeforeTaskAdd:ve,onAfterTaskAdd:We,onBeforeTaskUpdate:Re,onAfterTaskUpdate:st,onBeforeTaskDelete:ee,onAfterTaskDelete:it,permissions:le,onCopySnapshotLink:ot}=a,Pt=react.useContext(gi)?.theme,[ke,xt]=react.useState(Pt||s||"dark"),[ct,rt]=react.useState(n),[$,de]=react.useState(i),[S,q]=react.useState(1),[ce,Ce]=react.useState("all"),[W,te]=react.useState(D||"execution"),Ge=D??W,Te=react.useCallback(P=>{te(P),X?.(P);},[X]),Ue=I??Ge==="oracle",[Ne,Ve]=react.useState(a.showCriticalPath!==false),[Tt,gt]=react.useState(a.showDependencies!==false),[nt,et]=react.useState(a.highlightWeekends!==false),qt=react.useCallback(P=>{Ve(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),At=react.useCallback(P=>{gt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),vt=react.useCallback(P=>{et(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(ct);},[ct]),react.useEffect(()=>{a.onZoomChange?.(S);},[S]);let Dt=react.useRef(a.onDateRangeChange);Dt.current=a.onDateRangeChange;let ft=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Wt,Oe]=react.useState(()=>{if(!x)return "all";try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Le=k??Wt,ut=v??Oe,[ne,fe]=react.useState(()=>{if(!x)return false;try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=ft();if(P)try{let B={taskFilter:Le,hideCompleted:ne};localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Le,ne,ft]);let L=react.useRef(h);react.useEffect(()=>{if(L.current!==h&&h!==void 0){Oe("all"),fe(false);let P=ft();if(P)try{localStorage.removeItem(P);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,ft]);let[j,K]=react.useState(0),[me,Me]=react.useState(false),[qe,_e]=react.useState(null),[Ie,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Nt,Ut]=react.useState(null),[Ta,ta]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==ke&&xt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==ke&&xt(s);},[s]);let U=react.useCallback(P=>{xt(P),H?.(P);},[H]),{state:oe,setState:$e,undo:A,redo:ge,canUndo:je,canRedo:tt,clearHistory:oa}=wm(t,50),Gt=react.useMemo(()=>{let P=(B,V=0)=>{let Q=V;for(let we of B)we.subtasks?.length&&(Q=Math.max(Q,P(we.subtasks,V+1)));return Q};return P(oe)+1},[oe]),Na=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Ma=react.useRef(new Map),Ga=react.useRef(false);if(!Ga.current&&y){Ga.current=true;let P=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(P);if(B){let V=JSON.parse(B);Array.isArray(V)&&(Ma.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let ha=react.useCallback(()=>{let P=Na();if(P)try{let B=Array.from(Ma.current.entries());localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Na]),nr=react.useRef(0),M=react.useRef(oe);react.useEffect(()=>{M.current=oe;},[oe]);let se=react.useRef(false),xe=react.useCallback(P=>{Ce(P),nr.current+=1,$e(B=>{let V=(we,Ae=0)=>we.map(Mt=>{let dt=P==="all"||Ae<P-1;return Mt.subtasks?.length&&Ma.current.set(Mt.id,dt),{...Mt,isExpanded:dt,subtasks:Mt.subtasks?V(Mt.subtasks,Ae+1):void 0}}),Q=V(B);return ha(),Q});},[$e,ha]);react.useEffect(()=>{if(nr.current>0){nr.current-=1;return}let P=V=>{let Q=new Map;for(let we of V){let Ae=we.id;Q.get(Ae)||Q.set(Ae,we);}return Array.from(Q.values())},B=V=>V.map(Q=>{let we=Ma.current.get(Q.id),Ae=we!==void 0?{...Q,isExpanded:we}:Q;if(Ae.subtasks?.length){let Mt=P(Ae.subtasks);return {...Ae,subtasks:B(Mt)}}return Ae});if(Ma.current.size>0)$e(Or(B(t)));else {let V=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:P(V(we.subtasks))}:we);$e(Or(V(t)));}},[t,$e]);let Fe=react.useRef(t),Ke=react.useRef(true);react.useEffect(()=>{if(Ke.current){Ke.current=false,Fe.current=oe;return}if(se.current){se.current=false,Fe.current=oe;return}if(!r)return;let P=JSON.stringify(Fe.current),B=JSON.stringify(oe);P!==B&&(Fe.current=oe,r(oe));},[oe,r]);let Qe=react.useMemo(()=>yd(b,w),[b,w]),ye=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[He,lt]=react.useState(()=>ye(Qe));react.useEffect(()=>{lt(P=>P.map(B=>({...B,label:Qe.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Qe]);let wt=react.useMemo(()=>He.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[He]),Ot=react.useRef(He.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=He.filter(Q=>Q.visible),B=P.map(Q=>Q.id).join(","),V=Ot.current;if(B!==V){let Q=P.some(Ae=>Ae.id!=="name"),we=V.includes(",");Q?!we&&Q&&_e(null):_e(null),Ot.current=B;}},[He]);let St=60,Et=.6,ma=react.useMemo(()=>{let B=wt+St,V=typeof window<"u"?window.innerWidth*Et:800,Q=Math.max(B,V);return qe!==null?Math.max(200,Math.min(qe,Q)):Math.max(200,B)},[qe,wt]),na=react.useRef(null),Ya=react.useRef(null),fa=react.useRef(null),ya=react.useRef(null),Lt=react.useMemo(()=>zp(ke),[ke]),xr=react.useMemo(()=>({theme:Lt,themeName:ke}),[Lt,ke]),jc=react.useMemo(()=>Cm(p),[p]),il=react.useMemo(()=>{if(!g)return oe;let P=De.calculateCriticalPathFull(oe),B=V=>V.map(Q=>{let we=P.get(Q.id),Ae=Q.subtasks?B(Q.subtasks):void 0,Mt=Ae?.some(Fa=>Fa.isCriticalPath||Fa.subtasks&&Fa.subtasks.some(Yt=>Yt.isCriticalPath))||false,dt=we?we.isCritical:Mt;return {...Q,isCriticalPath:dt,cpmData:we||void 0,subtasks:Ae}});return B(oe)},[oe,g]),rf=react.useMemo(()=>De.flattenTasks(oe).some(B=>B.dependencies&&B.dependencies.length>0),[oe]),_c=react.useMemo(()=>{if(Le==="all"&&!ne)return il;let P=B=>{let V=[];for(let Q of B){let we=Q.subtasks?.length?P(Q.subtasks):void 0,Ae=false;if(ne)Ae=Q.progress<100;else switch(Le){case "all":Ae=true;break;case "incomplete":Ae=Q.progress<100;break;case "in_progress":Ae=Q.progress>0&&Q.progress<100;break;case "completed":Ae=Q.progress===100;break}(Ae||we&&we.length>0)&&V.push({...Q,subtasks:we});}return V};return P(il)},[il,Le,ne]),Rs=Vv($);km({undo:A,redo:ge,canUndo:je,canRedo:tt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>De.findTaskById(oe,P),addTask:(P,B)=>{$e(V=>{if(!B)return [...V,{...P,level:0}];let Q=we=>we.map(Ae=>Ae.id===B?{...Ae,subtasks:[...Ae.subtasks||[],{...P,parentId:B,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},updateTask:(P,B)=>{$e(V=>{let Q=we=>we.map(Ae=>Ae.id===P?{...Ae,...B}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},deleteTask:P=>{$e(B=>{let V=Q=>Q.filter(we=>we.id===P?false:(we.subtasks&&(we.subtasks=V(we.subtasks)),true));return V(B)});},deleteTasks:P=>{$e(B=>Sd(B,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let B=De.findTaskById(oe,P);B&&a.onTaskDuplicate(B);}else $e(B=>ms(B,[P]).tasks);},splitTask:(P,B,V=3)=>{$e(Q=>De.splitTask(Q,P,B,V));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(P,B)=>!De.validateDependencies(oe,P,B),getAllTasks:()=>De.flattenTasks(oe),getTasksByStatus:P=>De.flattenTasks(oe).filter(B=>B.status===P),getTasksByParent:P=>P?De.findTaskById(oe,P)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>De.flattenTasks(oe).filter(P=>P.isCriticalPath),indentTask:P=>{$e(B=>Or(Td(B,[P])));},outdentTask:P=>{$e(B=>Or(Nd(B,[P])));},moveTask:(P,B)=>{$e(V=>Dd(V,[P],B));},createSubtask:async P=>{let{tasks:B,newTask:V}=Fd(oe,P);if(ve){let Q=ve({...V,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}$e(Or(B)),We&&We({...V,parentId:P});},scrollToTask:P=>{let V=De.flattenTasks(oe).findIndex(Q=>Q.id===P);if(V!==-1&&na.current){let Q=V*Rs;na.current.scrollTo({top:Q,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,B=2e3)=>{},expandTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},collapseTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},expandAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseToLevel:P=>{xe(P);},undo:A,redo:ge,canUndo:()=>je,canRedo:()=>tt,clearHistory:oa,exportToPNG:async()=>{if(!ya.current||!na.current||!fa.current)throw new Error("Gantt container not found");let P=ya.current,B=na.current,V=Ya.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=Q.scrollTop,Mt=P.style.overflow,dt=P.style.height,Fa=B.style.overflow;try{let Yt=V?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),cr=Yt?.scrollHeight||V?.scrollHeight||600,Sr=ua?.getBoundingClientRect().height||Q.scrollHeight,Go=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(cr,Sr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Go}px`,B.style.overflow="visible",await new Promise(fn=>setTimeout(fn,100));let to=await htmlToImage.toPng(P,{backgroundColor:Lt.bgPrimary,pixelRatio:2,filter:fn=>{if(!(fn instanceof Element))return !0;let Os=window.getComputedStyle(fn),Kn=parseInt(Os.zIndex,10);return (isNaN(Kn)||Kn<50)&&Os.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=Mt,P.style.height=dt,B.style.overflow=Fa,V&&(V.scrollTop=we),Q.scrollTop=Ae;}},exportToPDF:async P=>{await De.exportToPDF(oe,P);},exportToExcel:async P=>{await De.exportToExcel(oe,P,ul.current);},exportToJSON:()=>De.exportToJSON(oe),exportToCSV:()=>De.exportToCSV(oe),importFromJSON:P=>{let B=De.importFromJSON(P);$e(B);},getTasks:()=>oe,refresh:()=>{$e(P=>[...P]);},clearAll:()=>{$e([]);}}),[oe,A,ge,je,tt,oa,Lt,Rs]);let of=react.useCallback(P=>{lt(B=>B.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),nf=react.useCallback((P,B)=>{lt(V=>V.map(Q=>{if(Q.id!==P)return Q;let we=Q.minWidth??100,Ae=Q.maxWidth??800,Mt=Math.max(we,Math.min(Ae,B));return {...Q,width:Mt}}));},[]),sf=react.useCallback(P=>{$e(B=>{let V=Md(B,P),Q=we=>{for(let Ae of we){if(Ae.id===P){Ma.current.set(P,Ae.isExpanded??true);return}Ae.subtasks?.length&&Q(Ae.subtasks);}};return Q(V),ha(),V}),a.onTaskToggleExpand?.(P);},[a,ha]),un=react.useCallback((P,B)=>{if(Re&&Re(P,B)===false)return;let Q=De.findTaskById(oe,P)?.progress,we=Mt=>Mt.map(dt=>dt.id===P?{...dt,...B}:dt.subtasks?{...dt,subtasks:we(dt.subtasks)}:dt);$e(we(oe));let Ae=De.findTaskById(we(oe),P);Ae&&(Se?.(Ae),st?.(Ae),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&_?.(P,Q,B.progress));},[oe,Se,Re,st,_]),lf=react.useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Td(B,P))),a.onTaskIndent?.(P[0]));},[a]),df=react.useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Nd(B,P))),a.onTaskOutdent?.(P[0]));},[a]),cf=react.useCallback((P,B,V)=>{nr.current+=1,se.current=true,$e(Q=>Or(lm(Q,P,B,V))),a.onTaskReparent?.(P,B,V);},[a]),uf=react.useCallback((P,B)=>{P.length!==0&&(nr.current+=1,se.current=true,$e(V=>Dd(V,P,B)),a.onTaskMove?.(P[0],B));},[a]),ll=react.useCallback(async P=>{let B=[];for(let V of P)ee&&await Promise.resolve(ee(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):($e(V=>Or(Sd(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),it&&B.forEach(V=>it(V)));},[a,ee,it]),pf=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(B=>{let V=De.findTaskById(oe,B);V&&a.onTaskDuplicate(V);}):$e(B=>ms(B,P).tasks);},[a,oe]),mf=react.useCallback((P,B)=>{$e(V=>{let{tasks:Q,newTask:we}=im(V,P,B);return ve&&ve(we)===false?V:(a.onTaskCreate?.(we.parentId,we.position||0),We?.(we),Q)});},[a,ve,We]),gf=react.useCallback((P,B)=>{$e(V=>Ed(V,P,B)),a.onTaskRename?.(P,B);},[a]),dl=react.useCallback(P=>{let{onTaskAddSubtask:B}=a;if(B){let V=An(oe,P);if(V){B(V);return}}$e(V=>{let{tasks:Q}=Fd(V,P);return a.onTaskCreate?.(P,0),Q});},[a,oe]),ff=react.useCallback((P,B,V)=>{let Q=!P.startDate&&!P.endDate,we=P.startDate?Math.round((B.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ae=Yt=>Yt.map(ua=>ua.id===P.id?{...ua,startDate:B,endDate:V,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Ae(ua.subtasks)}:ua),Mt=Ae(oe),dt=Mt;Mt=De.autoScheduleDependents(Mt,P.id,we),Mt=Or(Mt),$e(Mt);let Fa={...P,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,B,V):Se?.(Fa),R&&we!==0){let Yt=De.flattenTasks(dt),ua=De.flattenTasks(Mt),cr=[];for(let Sr of ua){if(Sr.id===P.id)continue;let ko=Yt.find(to=>to.id===Sr.id);if(!ko)continue;let gn=Sr.startDate?.getTime()!==ko.startDate?.getTime(),Go=Sr.endDate?.getTime()!==ko.endDate?.getTime();(gn||Go)&&cr.push(Sr);}cr.length>0&&R(cr);}},[oe,Se,R,a]),bf=react.useCallback((P,B)=>{Z?.(P,B),bt({isOpen:true,x:B.clientX,y:B.clientY,task:P});},[Z]),hf=react.useCallback((P,B)=>{let V=De.splitTask(oe,P.id,B);$e(V),bt({isOpen:false,x:0,y:0,task:null});},[oe]),Kc=react.useCallback(P=>{let B=De.findTaskById(oe,P.id)||P;Y?.(B),he||Ut(B);},[oe,Y,he]),qc=react.useCallback((P,B,V)=>{let Q=new Map,we=Yt=>{Yt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&we(ua.subtasks);});};we(V);let Ae=Q.get(B)||[];Q.set(B,[...Ae,P]);let Mt=new Set,dt=new Set,Fa=Yt=>{if(!Mt.has(Yt)){Mt.add(Yt),dt.add(Yt);let ua=Q.get(Yt)||[];for(let cr of ua){if(!Mt.has(cr)&&Fa(cr))return true;if(dt.has(cr))return true}}return dt.delete(Yt),false};return Fa(B)},[]),Yc=react.useCallback((P,B)=>{if(qc(P.id,B,M.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:l&&jsxRuntime.jsxs(framerMotion.motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ot,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${yt}`,boxShadow:Pt},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ke,borderBottom:`1px solid ${xt}`},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5",children:[jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ct,border:`1px solid ${rt}`,color:"#2E94FF"},children:jsxRuntime.jsx(vm,{size:14})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:$},children:"AI Assistant"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsxRuntime.jsx(Pv,{})}),jsxRuntime.jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsxRuntime.jsx(Fv,{})})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!d&&jsxRuntime.jsxs(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("p",{className:"text-xs text-center",style:{color:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((U,oe)=>jsxRuntime.jsx("button",{onClick:()=>Ta(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ce,color:te,border:`1px solid ${W}`},onMouseEnter:$e=>{$e.currentTarget.style.borderColor=Ge,$e.currentTarget.style.color="#2E94FF";},onMouseLeave:$e=>{$e.currentTarget.style.borderColor=W,$e.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxRuntime.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Te:Ne,color:U.role==="user"?"#2E94FF":Tt,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${Ve}`},children:[U.isLoading?jsxRuntime.jsx(Av,{}):jsxRuntime.jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxRuntime.jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsxRuntime.jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsxRuntime.jsx("div",{ref:H})]}),jsxRuntime.jsxs("form",{onSubmit:U=>{if(E&&Me.length>0){U.preventDefault();return}Ut(U);},className:"p-3 relative",style:{borderTop:`1px solid ${gt}`},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:E&&Me.length>0&&jsxRuntime.jsx(framerMotion.motion.div,{ref:Y,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Wt,border:`1px solid ${Oe}`,boxShadow:Le,backdropFilter:"blur(12px)"},children:Me.map((U,oe)=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===D?ut:"transparent",color:ne},onMouseEnter:()=>X(oe),children:[jsxRuntime.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map($e=>$e[0]).join("").slice(0,2).toUpperCase()}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsxRuntime.jsx("div",{className:"text-xs truncate",style:{color:fe},children:U.email})]})]},U.id))})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsxRuntime.jsx("input",{ref:O,type:"text",value:x,onChange:U=>qe(U.target.value),onKeyDown:U=>{Ie(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:qt,fontFamily:"Inter, sans-serif"}}),jsxRuntime.jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?At:"transparent",color:x.trim()?"#2E94FF":Dt,border:x.trim()?`1px solid ${vt}`:"1px solid transparent"},children:jsxRuntime.jsx(Mv,{})})]}),jsxRuntime.jsx("p",{className:"text-[10px] text-center mt-2",style:{color:ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=react.useState({past:[],present:e,future:[]}),o=react.useRef(false),s=react.useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=react.useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=react.useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=react.useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){react.useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Rv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Cm(e){return {...Rv,...e}}var Vv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=react.forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:v,toolbarRightContent:E,showBaseline:I,viewMode:D,onViewModeChange:X,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:Y,onTaskContextMenu:Z,onTaskUpdate:Se,onDependentTasksScheduled:R,onProgressChange:_,onTaskEdit:he,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Pe,onBeforeTaskAdd:ve,onAfterTaskAdd:We,onBeforeTaskUpdate:Re,onAfterTaskUpdate:st,onBeforeTaskDelete:ee,onAfterTaskDelete:it,permissions:le,onCopySnapshotLink:ot}=a,Pt=react.useContext(gi)?.theme,[ke,xt]=react.useState(Pt||s||"dark"),[ct,rt]=react.useState(n),[$,de]=react.useState(i),[S,q]=react.useState(1),[ce,Ce]=react.useState("all"),[W,te]=react.useState(D||"execution"),Ge=D??W,Te=react.useCallback(P=>{te(P),X?.(P);},[X]),Ue=I??Ge==="oracle",[Ne,Ve]=react.useState(a.showCriticalPath!==false),[Tt,gt]=react.useState(a.showDependencies!==false),[nt,et]=react.useState(a.highlightWeekends!==false),qt=react.useCallback(P=>{Ve(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),At=react.useCallback(P=>{gt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),vt=react.useCallback(P=>{et(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);react.useEffect(()=>{a.onTimeScaleChange?.(ct);},[ct]),react.useEffect(()=>{a.onZoomChange?.(S);},[S]);let Dt=react.useRef(a.onDateRangeChange);Dt.current=a.onDateRangeChange;let ft=react.useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Wt,Oe]=react.useState(()=>{if(!x)return "all";try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Le=k??Wt,ut=v??Oe,[ne,fe]=react.useState(()=>{if(!x)return false;try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});react.useEffect(()=>{let P=ft();if(P)try{let B={taskFilter:Le,hideCompleted:ne};localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Le,ne,ft]);let L=react.useRef(h);react.useEffect(()=>{if(L.current!==h&&h!==void 0){Oe("all"),fe(false);let P=ft();if(P)try{localStorage.removeItem(P);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,ft]);let[j,K]=react.useState(0),[me,Me]=react.useState(false),[qe,_e]=react.useState(null),[Ie,bt]=react.useState({isOpen:false,x:0,y:0,task:null}),[Nt,Ut]=react.useState(null),[Ta,ta]=react.useState(null);react.useEffect(()=>{Pt&&Pt!==ke&&xt(Pt);},[Pt]),react.useEffect(()=>{s&&s!==ke&&xt(s);},[s]);let U=react.useCallback(P=>{xt(P),H?.(P);},[H]),{state:oe,setState:$e,undo:A,redo:ge,canUndo:je,canRedo:tt,clearHistory:oa}=wm(t,50),Gt=react.useMemo(()=>{let P=(B,V=0)=>{let Q=V;for(let we of B)we.subtasks?.length&&(Q=Math.max(Q,P(we.subtasks,V+1)));return Q};return P(oe)+1},[oe]),Na=react.useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Ma=react.useRef(new Map),Ga=react.useRef(false);if(!Ga.current&&y){Ga.current=true;let P=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(P);if(B){let V=JSON.parse(B);Array.isArray(V)&&(Ma.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let ha=react.useCallback(()=>{let P=Na();if(P)try{let B=Array.from(Ma.current.entries());localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Na]),nr=react.useRef(0),M=react.useRef(oe);react.useEffect(()=>{M.current=oe;},[oe]);let se=react.useRef(false),xe=react.useCallback(P=>{Ce(P),nr.current+=1,$e(B=>{let V=(we,Ae=0)=>we.map(Mt=>{let dt=P==="all"||Ae<P-1;return Mt.subtasks?.length&&Ma.current.set(Mt.id,dt),{...Mt,isExpanded:dt,subtasks:Mt.subtasks?V(Mt.subtasks,Ae+1):void 0}}),Q=V(B);return ha(),Q});},[$e,ha]);react.useEffect(()=>{if(nr.current>0){nr.current-=1;return}let P=V=>{let Q=new Map;for(let we of V){let Ae=we.id;Q.get(Ae)||Q.set(Ae,we);}return Array.from(Q.values())},B=V=>V.map(Q=>{let we=Ma.current.get(Q.id),Ae=we!==void 0?{...Q,isExpanded:we}:Q;if(Ae.subtasks?.length){let Mt=P(Ae.subtasks);return {...Ae,subtasks:B(Mt)}}return Ae});if(Ma.current.size>0)$e(Or(B(t)));else {let V=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:P(V(we.subtasks))}:we);$e(Or(V(t)));}},[t,$e]);let Fe=react.useRef(t),Ke=react.useRef(true);react.useEffect(()=>{if(Ke.current){Ke.current=false,Fe.current=oe;return}if(se.current){se.current=false,Fe.current=oe;return}if(!r)return;let P=JSON.stringify(Fe.current),B=JSON.stringify(oe);P!==B&&(Fe.current=oe,r(oe));},[oe,r]);let Qe=react.useMemo(()=>yd(b,w),[b,w]),ye=react.useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[He,lt]=react.useState(()=>ye(Qe));react.useEffect(()=>{lt(P=>P.map(B=>({...B,label:Qe.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Qe]);let wt=react.useMemo(()=>He.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[He]),Lt=react.useRef(He.filter(P=>P.visible).map(P=>P.id).join(","));react.useEffect(()=>{let P=He.filter(Q=>Q.visible),B=P.map(Q=>Q.id).join(","),V=Lt.current;if(B!==V){let Q=P.some(Ae=>Ae.id!=="name"),we=V.includes(",");Q?!we&&Q&&_e(null):_e(null),Lt.current=B;}},[He]);let St=60,Et=.6,ma=react.useMemo(()=>{let B=wt+St,V=typeof window<"u"?window.innerWidth*Et:800,Q=Math.max(B,V);return qe!==null?Math.max(200,Math.min(qe,Q)):Math.max(200,B)},[qe,wt]),na=react.useRef(null),Va=react.useRef(null),fa=react.useRef(null),ya=react.useRef(null),It=react.useMemo(()=>zp(ke),[ke]),xr=react.useMemo(()=>({theme:It,themeName:ke}),[It,ke]),jc=react.useMemo(()=>Cm(p),[p]),il=react.useMemo(()=>{if(!g)return oe;let P=De.calculateCriticalPathFull(oe),B=V=>V.map(Q=>{let we=P.get(Q.id),Ae=Q.subtasks?B(Q.subtasks):void 0,Mt=Ae?.some(Fa=>Fa.isCriticalPath||Fa.subtasks&&Fa.subtasks.some(Yt=>Yt.isCriticalPath))||false,dt=we?we.isCritical:Mt;return {...Q,isCriticalPath:dt,cpmData:we||void 0,subtasks:Ae}});return B(oe)},[oe,g]),rf=react.useMemo(()=>De.flattenTasks(oe).some(B=>B.dependencies&&B.dependencies.length>0),[oe]),_c=react.useMemo(()=>{if(Le==="all"&&!ne)return il;let P=B=>{let V=[];for(let Q of B){let we=Q.subtasks?.length?P(Q.subtasks):void 0,Ae=false;if(ne)Ae=Q.progress<100;else switch(Le){case "all":Ae=true;break;case "incomplete":Ae=Q.progress<100;break;case "in_progress":Ae=Q.progress>0&&Q.progress<100;break;case "completed":Ae=Q.progress===100;break}(Ae||we&&we.length>0)&&V.push({...Q,subtasks:we});}return V};return P(il)},[il,Le,ne]),Rs=Vv($);km({undo:A,redo:ge,canUndo:je,canRedo:tt,enabled:true}),react.useImperativeHandle(o,()=>({getTask:P=>De.findTaskById(oe,P),addTask:(P,B)=>{$e(V=>{if(!B)return [...V,{...P,level:0}];let Q=we=>we.map(Ae=>Ae.id===B?{...Ae,subtasks:[...Ae.subtasks||[],{...P,parentId:B,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},updateTask:(P,B)=>{$e(V=>{let Q=we=>we.map(Ae=>Ae.id===P?{...Ae,...B}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},deleteTask:P=>{$e(B=>{let V=Q=>Q.filter(we=>we.id===P?false:(we.subtasks&&(we.subtasks=V(we.subtasks)),true));return V(B)});},deleteTasks:P=>{$e(B=>Sd(B,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let B=De.findTaskById(oe,P);B&&a.onTaskDuplicate(B);}else $e(B=>ms(B,[P]).tasks);},splitTask:(P,B,V=3)=>{$e(Q=>De.splitTask(Q,P,B,V));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(P,B)=>!De.validateDependencies(oe,P,B),getAllTasks:()=>De.flattenTasks(oe),getTasksByStatus:P=>De.flattenTasks(oe).filter(B=>B.status===P),getTasksByParent:P=>P?De.findTaskById(oe,P)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>De.flattenTasks(oe).filter(P=>P.isCriticalPath),indentTask:P=>{$e(B=>Or(Td(B,[P])));},outdentTask:P=>{$e(B=>Or(Nd(B,[P])));},moveTask:(P,B)=>{$e(V=>Dd(V,[P],B));},createSubtask:async P=>{let{tasks:B,newTask:V}=Fd(oe,P);if(ve){let Q=ve({...V,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}$e(Or(B)),We&&We({...V,parentId:P});},scrollToTask:P=>{let V=De.flattenTasks(oe).findIndex(Q=>Q.id===P);if(V!==-1&&na.current){let Q=V*Rs;na.current.scrollTo({top:Q,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,B=2e3)=>{},expandTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},collapseTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},expandAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseToLevel:P=>{xe(P);},undo:A,redo:ge,canUndo:()=>je,canRedo:()=>tt,clearHistory:oa,exportToPNG:async()=>{if(!ya.current||!na.current||!fa.current)throw new Error("Gantt container not found");let P=ya.current,B=na.current,V=Va.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=Q.scrollTop,Mt=P.style.overflow,dt=P.style.height,Fa=B.style.overflow;try{let Yt=V?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),cr=Yt?.scrollHeight||V?.scrollHeight||600,Sr=ua?.getBoundingClientRect().height||Q.scrollHeight,Go=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(cr,Sr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Go}px`,B.style.overflow="visible",await new Promise(fn=>setTimeout(fn,100));let to=await htmlToImage.toPng(P,{backgroundColor:It.bgPrimary,pixelRatio:2,filter:fn=>{if(!(fn instanceof Element))return !0;let Os=window.getComputedStyle(fn),Kn=parseInt(Os.zIndex,10);return (isNaN(Kn)||Kn<50)&&Os.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=Mt,P.style.height=dt,B.style.overflow=Fa,V&&(V.scrollTop=we),Q.scrollTop=Ae;}},exportToPDF:async P=>{await De.exportToPDF(oe,P);},exportToExcel:async P=>{await De.exportToExcel(oe,P,ul.current);},exportToJSON:()=>De.exportToJSON(oe),exportToCSV:()=>De.exportToCSV(oe),importFromJSON:P=>{let B=De.importFromJSON(P);$e(B);},getTasks:()=>oe,refresh:()=>{$e(P=>[...P]);},clearAll:()=>{$e([]);}}),[oe,A,ge,je,tt,oa,It,Rs]);let of=react.useCallback(P=>{lt(B=>B.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),nf=react.useCallback((P,B)=>{lt(V=>V.map(Q=>{if(Q.id!==P)return Q;let we=Q.minWidth??100,Ae=Q.maxWidth??800,Mt=Math.max(we,Math.min(Ae,B));return {...Q,width:Mt}}));},[]),sf=react.useCallback(P=>{$e(B=>{let V=Md(B,P),Q=we=>{for(let Ae of we){if(Ae.id===P){Ma.current.set(P,Ae.isExpanded??true);return}Ae.subtasks?.length&&Q(Ae.subtasks);}};return Q(V),ha(),V}),a.onTaskToggleExpand?.(P);},[a,ha]),un=react.useCallback((P,B)=>{if(Re&&Re(P,B)===false)return;let Q=De.findTaskById(oe,P)?.progress,we=Mt=>Mt.map(dt=>dt.id===P?{...dt,...B}:dt.subtasks?{...dt,subtasks:we(dt.subtasks)}:dt);$e(we(oe));let Ae=De.findTaskById(we(oe),P);Ae&&(Se?.(Ae),st?.(Ae),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&_?.(P,Q,B.progress));},[oe,Se,Re,st,_]),lf=react.useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Td(B,P))),a.onTaskIndent?.(P[0]));},[a]),df=react.useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Nd(B,P))),a.onTaskOutdent?.(P[0]));},[a]),cf=react.useCallback((P,B,V)=>{nr.current+=1,se.current=true,$e(Q=>Or(lm(Q,P,B,V))),a.onTaskReparent?.(P,B,V);},[a]),uf=react.useCallback((P,B)=>{P.length!==0&&(nr.current+=1,se.current=true,$e(V=>Dd(V,P,B)),a.onTaskMove?.(P[0],B));},[a]),ll=react.useCallback(async P=>{let B=[];for(let V of P)ee&&await Promise.resolve(ee(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):($e(V=>Or(Sd(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),it&&B.forEach(V=>it(V)));},[a,ee,it]),pf=react.useCallback(P=>{a.onTaskDuplicate?P.forEach(B=>{let V=De.findTaskById(oe,B);V&&a.onTaskDuplicate(V);}):$e(B=>ms(B,P).tasks);},[a,oe]),mf=react.useCallback((P,B)=>{$e(V=>{let{tasks:Q,newTask:we}=im(V,P,B);return ve&&ve(we)===false?V:(a.onTaskCreate?.(we.parentId,we.position||0),We?.(we),Q)});},[a,ve,We]),gf=react.useCallback((P,B)=>{$e(V=>Ed(V,P,B)),a.onTaskRename?.(P,B);},[a]),dl=react.useCallback(P=>{let{onTaskAddSubtask:B}=a;if(B){let V=An(oe,P);if(V){B(V);return}}$e(V=>{let{tasks:Q}=Fd(V,P);return a.onTaskCreate?.(P,0),Q});},[a,oe]),ff=react.useCallback((P,B,V)=>{let Q=!P.startDate&&!P.endDate,we=P.startDate?Math.round((B.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ae=Yt=>Yt.map(ua=>ua.id===P.id?{...ua,startDate:B,endDate:V,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Ae(ua.subtasks)}:ua),Mt=Ae(oe),dt=Mt;Mt=De.autoScheduleDependents(Mt,P.id,we),Mt=Or(Mt),$e(Mt);let Fa={...P,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,B,V):Se?.(Fa),R&&we!==0){let Yt=De.flattenTasks(dt),ua=De.flattenTasks(Mt),cr=[];for(let Sr of ua){if(Sr.id===P.id)continue;let ko=Yt.find(to=>to.id===Sr.id);if(!ko)continue;let gn=Sr.startDate?.getTime()!==ko.startDate?.getTime(),Go=Sr.endDate?.getTime()!==ko.endDate?.getTime();(gn||Go)&&cr.push(Sr);}cr.length>0&&R(cr);}},[oe,Se,R,a]),bf=react.useCallback((P,B)=>{Z?.(P,B),bt({isOpen:true,x:B.clientX,y:B.clientY,task:P});},[Z]),hf=react.useCallback((P,B)=>{let V=De.splitTask(oe,P.id,B);$e(V),bt({isOpen:false,x:0,y:0,task:null});},[oe]),Kc=react.useCallback(P=>{let B=De.findTaskById(oe,P.id)||P;Y?.(B),he||Ut(B);},[oe,Y,he]),qc=react.useCallback((P,B,V)=>{let Q=new Map,we=Yt=>{Yt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&we(ua.subtasks);});};we(V);let Ae=Q.get(B)||[];Q.set(B,[...Ae,P]);let Mt=new Set,dt=new Set,Fa=Yt=>{if(!Mt.has(Yt)){Mt.add(Yt),dt.add(Yt);let ua=Q.get(Yt)||[];for(let cr of ua){if(!Mt.has(cr)&&Fa(cr))return true;if(dt.has(cr))return true}}return dt.delete(Yt),false};return Fa(B)},[]),Yc=react.useCallback((P,B)=>{if(qc(P.id,B,M.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let V=Q=>Q.map(we=>{if(we.id===B){let Ae=we.dependencies||[];if(!Ae.includes(P.id))return {...we,dependencies:[...Ae,P.id]}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),J?.(P.id,B);},[J,qc]),Xc=react.useCallback((P,B)=>{let V=Q=>Q.map(we=>{if(we.id===P&&we.dependencies){let Ae=we.dependencies.filter(Mt=>Mt!==B);return {...we,dependencies:Ae}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),Pe?.(P,B);},[Pe]),{startDate:pn,endDate:cl}=react.useMemo(()=>{let P=oe.filter(Ae=>Ae.startDate&&Ae.endDate);if(P.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let dt=new Date(Ae);return dt.setDate(dt.getDate()+60),{startDate:Mt,endDate:dt}}let B=P.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),V=new Date(Math.min(...B.map(Ae=>Ae.getTime()))),Q=new Date(Math.max(...B.map(Ae=>Ae.getTime()))),we=ct==="day"?7:ct==="week"?14:30;return V.setDate(V.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:V,endDate:Q}},[oe,ct]);react.useEffect(()=>{Dt.current?.(pn,cl);},[pn,cl]);let yf=react.useCallback(async()=>{if(!ya.current||!na.current||!fa.current)return;await new Promise(Go=>setTimeout(Go,200));let P=ya.current,B=na.current,V=Ya.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=V?.scrollLeft||0,Mt=Q.scrollTop,dt=Q.scrollLeft,Fa=P.style.overflow,Yt=P.style.height,ua=V?.style.overflow||"",cr=Q.style.overflow,Sr=B.style.overflow,ko=P.style.width,gn=Q.style.width;try{let Go=V?.querySelector(".gantt-taskgrid-content"),to=Q.querySelector("svg"),ml=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,fn=Go?.scrollHeight||V?.scrollHeight||600,Os=Math.max(ml,Q.scrollHeight),Kn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||Q.scrollWidth,Df=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,gl=Math.max(fn,Os,ml),Zc=Df+gl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+Kn+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Zc}px`,P.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${gl+50}px`),Q.style.overflow="visible",Q.style.height=`${gl+50}px`,Q.style.width=`${Kn+10}px`,await new Promise($s=>setTimeout($s,150));let Sf=await htmlToImage.toPng(P,{backgroundColor:Lt.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:$s=>{if(!($s instanceof Element))return !0;let tu=window.getComputedStyle($s),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),fl=document.createElement("a");fl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,fl.href=Sf,fl.click();}finally{P.style.overflow=Fa,P.style.height=Yt,P.style.width=ko,B.style.overflow=Sr,V&&(V.style.overflow=ua,V.style.height="",V.scrollTop=we,V.scrollLeft=Ae),Q.style.overflow=cr,Q.style.height="",Q.style.width=gn,Q.scrollTop=Mt,Q.scrollLeft=dt;}},[Lt]),xf=react.useCallback(async()=>{await De.exportToPDF(oe);},[oe]),ul=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});ul.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let vf=react.useCallback(async()=>{let P=new Date,B=we=>String(we).padStart(2,"0"),V=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(oe,`${Q}_${V}.xlsx`,ul.current);},[oe,m]),wf=react.useCallback(()=>{let P=De.exportToCSV(oe),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),kf=react.useCallback(()=>{let P=De.exportToJSON(oe),B=new Blob([P],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Cf=react.useCallback(()=>{De.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Tf=P=>{P.preventDefault(),Me(true);},mn=react.useRef(false),[pl,Jc]=react.useState(false),_n=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=fa.current,B=na.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let V=()=>{if(mn.current)return;mn.current=true;let dt=P.scrollTop;K(dt),B.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},Q=()=>{if(mn.current)return;mn.current=true;let dt=B.scrollTop;K(dt),P.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},we=dt=>{if(me&&B){let Yt=B.parentElement?.getBoundingClientRect()?.left||0,ua=dt.clientX-Yt,cr=200,Sr=wt+St,ko=window.innerWidth*Et,gn=Math.max(Sr,ko);ua>=cr&&ua<=gn&&_e(ua);}if(pl&&P){let Fa=dt.clientX-_n.current.x,Yt=dt.clientY-_n.current.y;P.scrollLeft=_n.current.scrollLeft-Fa,P.scrollTop=_n.current.scrollTop-Yt;}},Ae=()=>{Me(false),Jc(false);},Mt=dt=>{if(dt.button!==0)return;let Fa=dt.target;Fa.closest("[data-task-bar]")||Fa.closest("[data-dependency-line]")||Fa.closest("button")||Fa.closest('[role="button"]')||Fa.tagName==="rect"&&Fa.getAttribute("data-clickable")==="true"||(Jc(true),_n.current={x:dt.clientX,y:dt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},dt.preventDefault());};return P.addEventListener("scroll",V),B.addEventListener("scroll",Q),P.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Ae),()=>{P.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Ae);}},[me,pl,wt]);let Qc=react.useRef(false),Nf=react.useRef(null);return react.useLayoutEffect(()=>{if(Qc.current||oe.length===0||!fa.current)return;Qc.current=true,Nf.current=pn;let P=fa.current,B=new Date,V=ct==="day"?60:ct==="week"?20:8,Q=(B.getTime()-pn.getTime())/(1e3*60*60*24),we=P.clientWidth,Mt=Q*V*S-we/2;Q>=0&&we>0&&(P.scrollLeft=Math.max(0,Mt));},[oe.length,pn,ct,S]),jsxRuntime.jsx(En.Provider,{value:Qe,children:jsxRuntime.jsx(vl.Provider,{value:xr,children:jsxRuntime.jsxs("div",{ref:ya,className:"flex flex-col h-full w-full",style:{backgroundColor:Lt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Lt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Lt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(bi,{theme:Lt,timeScale:ct,onTimeScaleChange:rt,zoom:S,onZoomChange:q,currentTheme:ke,onThemeChange:U,rowDensity:$,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:C&&le?.canCreateTask!==false&&!le?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Le,onTaskFilterChange:ut,hideCompleted:ne,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:ce,onWbsLevelChange:xe,maxWbsDepth:Gt,viewMode:Ge,onViewModeChange:Te,projectForecast:O,onExportPNG:l?yf:void 0,onExportPDF:l?xf:void 0,onExportExcel:l?vf:void 0,onExportCSV:l?wf:void 0,onExportJSON:l?kf:void 0,onExportMSProject:l?Cf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:qt,showDependencies:Tt,onShowDependenciesChange:At,highlightWeekends:nt,onHighlightWeekendsChange:vt,showBaseline:Ue,onShowBaselineChange:P=>{P&&Ge!=="oracle"&&Te("oracle"),!P&&Ge==="oracle"&&Te("execution");},onCopySnapshotLink:ot,hasDependencies:rf})}),jsxRuntime.jsxs("div",{ref:na,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Ya,className:"gantt-grid-scroll flex-shrink-0",style:{width:ma,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(xi,{tasks:_c,theme:Lt,rowHeight:Rs,availableUsers:d,templates:jc,showCriticalPath:Ne,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:Z,onTaskToggle:sf,scrollTop:j,columns:He,onToggleColumn:of,onColumnResize:nf,onTaskUpdate:un,onTaskIndent:lf,onTaskOutdent:df,onTaskMove:uf,onMultiTaskDelete:ll,onTaskDuplicate:pf,onTaskCreate:mf,onTaskRename:gf,onCreateSubtask:dl,onOpenTaskModal:F?P=>F(P):void 0,onDeleteRequest:(P,B)=>ta({taskId:P,taskName:B}),onTaskReparent:cf,scrollContainerRef:Ya})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Lt.border,zIndex:15},onMouseDown:Tf}),jsxRuntime.jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:pl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Mi,{tasks:_c,theme:Lt,rowHeight:Rs,timeScale:ct,startDate:pn,endDate:cl,zoom:S,locale:b,templates:jc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:bf,onTaskDateChange:ff,onDependencyCreate:Yc,onDependencyDelete:Xc,showBaseline:Ue,showCriticalPath:Ne,showDependencies:Tt,highlightWeekends:nt,canEditTask:le?.canEditTask})})]}),Ie.task&&jsxRuntime.jsx(Fn,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:Lt,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Ie.task;if(!P)return [];let B=De.findTaskById(oe,P.id)||P,V=B.subtasks&&B.subtasks.length>0,Q=le?.canCreateTask!==false,we=le?.canDeleteTask!==false;if(V){let Yt=[],ua=le?.canDuplicateTask!==false;return Q&&Yt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),ua&&Yt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(cr=>ms(cr,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),we&&(Yt.length>0&&Yt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Yt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),Yt}let Ae=le?.canUpdateTask!==false,Mt=le?.canDuplicateTask!==false,dt=[];return Ae&&dt.push({id:"edit",label:Qe.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{he?he(B):Ut(B);}}),Q&&dt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),dt.length>0&&Ae&&dt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(dt.push({id:"markIncomplete",label:Qe.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{z?z(B):un(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),dt.push({id:"setInProgress",label:Qe.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{re?re(B):un(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),dt.push({id:"markComplete",label:Qe.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{un(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Mt||Ae&&B.startDate&&B.endDate)&&dt.length>0&&dt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&dt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(Yt=>ms(Yt,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Ae&&B.startDate&&B.endDate&&dt.push({id:"split",label:Qe.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Yt=B.startDate.getTime(),ua=B.endDate.getTime(),cr=Yt+(ua-Yt)/2,Sr=new Date(cr);hf(B,Sr);}}),we&&(dt.length>0&&dt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),dt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),dt})()}),jsxRuntime.jsx(fo,{task:Nt,isOpen:!!Nt,onClose:()=>Ut(null),onTaskUpdate:P=>{Nt&&(un(Nt.id,P),Ut(null));},theme:ke==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ta&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>ta(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Lt.bgSecondary,border:`1px solid ${Lt.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Lt.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:Lt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:Lt.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Lt.bgPrimary,borderTop:`1px solid ${Lt.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ta(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Lt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ll([Ta.taskId]),ta(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ai,{tasks:oe,theme:Lt,config:f,onTasksUpdate:$e,onTaskUpdate:un,onTaskCreate:P=>{$e(B=>[...B,P]);},onTaskDelete:P=>{ll([P]);},onDependencyCreate:(P,B)=>{let V=De.findTaskById(oe,P);V&&Yc(V,B);},onDependencyDelete:Xc})]})})})});function t2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function a2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Id=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Mm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Ld,...l.filter(S=>!Ld.some(q=>q.id===S.id))],f=pt[c]||pt.dark,[b,w]=react.useState(false),[C,N]=react.useState(false),[T,k]=react.useState(false),[v,E]=react.useState(false),[I,D]=react.useState({top:0,left:0}),[X,O]=react.useState(null),[H,F]=react.useState(new Date),[Y,Z]=react.useState({top:0,left:0}),[Se,R]=react.useState(false),[_,he]=react.useState([]),[Je,z]=react.useState(false),[re,J]=react.useState(""),Pe=react.useRef(null),ve=react.useRef(null),We=react.useRef(null),Re=react.useRef(null),st=react.useRef(null),[ee,it]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[le,ot]=react.useState({});react.useEffect(()=>{a?(it({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(it({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),he([]));},[a,e,x]),react.useEffect(()=>{let S=q=>{Pe.current&&!Pe.current.contains(q.target)&&w(false),ve.current&&!ve.current.contains(q.target)&&N(false),We.current&&!We.current.contains(q.target)&&k(false),Re.current&&!Re.current.contains(q.target)&&E(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let yt=()=>{let S={};return ee.name.trim()||(S.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),ot(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!yt())try{let q=i==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(q),he([]),t();}catch(q){console.error("Error submitting task:",q);}},ke=(S,q)=>{it(ce=>{let Ce={...ce,[S]:q};if(S==="status"){let W=q;W==="todo"?Ce.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Ce.progress=50):W==="completed"||W==="closed"?Ce.progress=100:(W==="in-review"||W==="review")&&(Ce.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Ce.status="completed":W>0&&W<100&&ce.status==="todo"?Ce.status="in-progress":W===0&&ce.status!=="todo"&&(Ce.status="todo");}return Ce}),le[S]&&ot(ce=>{let Ce={...ce};return delete Ce[S],Ce});},xt=h.find(S=>S.id===ee.status)??Ld[0],ct=Id.find(S=>S.id===ee.priority)??Id[1],rt=Yo.find(S=>S.value===ee.color)??Yo[0],$=c==="dark",de={backgroundColor:$?"#1d1f27":f.bgSecondary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:$?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.border}`,boxShadow:$?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:Pt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:ee.name,onChange:S=>ke("name",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),le.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),le.name]}),jsxRuntime.jsx("textarea",{value:ee.description||"",onChange:S=>ke("description",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ee.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ve,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{children:ct.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Id.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("priority",S.id),N(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ee.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:We,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ee.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ee.assignees?.some(ce=>ce.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ee.assignees||[]).filter(Ce=>Ce.name!==S.name):[...ee.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ke("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:Re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)E(false);else {if(Re.current){let S=Re.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;D({top:W,left:S.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsxRuntime.jsx("span",{children:rt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Yo.slice(0,18).map(S=>{let q=ee.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),ke("color",S.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Do,{selectedTags:ee.tags||[],availableTags:m,onChange:S=>ke("tags",S),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:$?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:st,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="start")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("start"),F(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="end")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("end"),F(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ce=new Date(S);ce.setDate(S.getDate()+7);let Ce=new Date(S);return Ce.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Ce}].map((te,Ge)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{X==="start"?(ke("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&ke("endDate",te.date),O("end")):(ke("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&ke("startDate",te.date),O(null));},children:te.label},Ge))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("startDate",void 0),ke("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ce=new Date(S,q,1).getDay(),Ce=new Date(S,q+1,0).getDate(),W=new Date,te=[];for(let Te=ce-1;Te>=0;Te--)te.push({day:new Date(S,q,-Te).getDate(),date:new Date(S,q-1,new Date(S,q,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=Ce;Te++)te.push({day:Te,date:new Date(S,q,Te),isCurrentMonth:true});let Ge=42-te.length;for(let Te=1;Te<=Ge;Te++)te.push({day:Te,date:new Date(S,q+1,Te),isCurrentMonth:false});return te.map((Te,Ue)=>{let Ne=Te.date.toDateString()===W.toDateString(),Ve=ee.startDate?.toDateString()===Te.date.toDateString(),Tt=ee.endDate?.toDateString()===Te.date.toDateString(),gt=ee.startDate&&ee.endDate&&Te.date>=ee.startDate&&Te.date<=ee.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Te.isCurrentMonth?Ve||Tt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ve?f.accent:Tt?"#7C3AED":gt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ve&&!Tt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X==="start"?(ke("startDate",Te.date),ee.endDate&&Te.date>ee.endDate&&ke("endDate",Te.date),O("end")):(ke("endDate",Te.date),ee.startDate&&Te.date<ee.startDate&&ke("startDate",Te.date),O(null));},children:Te.day},Ue)})})()})]})]})]})})]}),le.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:le.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:$?"#33343c":"#E5E7EB"},onClick:S=>{if(n)return;let q=S.currentTarget.getBoundingClientRect(),ce=Math.round((S.clientX-q.left)/q.width*100/5)*5;ke("progress",Math.max(0,Math.min(100,ce)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!Se),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Se?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?t2(ee.effortMinutes):"",onChange:S=>{let q=a2(S.target.value);ke("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ee.parentId||"",onChange:S=>ke("parentId",S.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(S=>S.id!==a?.id).map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:S=>ke("location",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:S=>ke("equipment",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?_.length>0&&`(${_.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(so,{cardId:"pending",attachments:_.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>he(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);he(ce=>ce.filter((Ce,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(so,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&_.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:S=>ke("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(S=>{let q=r.find(ce=>ce.id===S);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ee.dependencies||[]).filter(Ce=>Ce!==S);ke("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(!Je),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:S=>J(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>re===""||S.name.toLowerCase().includes(re.toLowerCase())).map(S=>{let q=ee.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ee.dependencies||[],Ce;q?Ce=ce.filter(W=>W!==S.id):Ce=[...ce,S.id],ke("dependencies",Ce);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${$?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:$?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>S.currentTarget.style.color=f.textPrimary,onMouseLeave:S=>S.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:S=>!n&&(S.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:S=>!n&&(S.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Fm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let V=Q=>Q.map(we=>{if(we.id===B){let Ae=we.dependencies||[];if(!Ae.includes(P.id))return {...we,dependencies:[...Ae,P.id]}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),J?.(P.id,B);},[J,qc]),Xc=react.useCallback((P,B)=>{let V=Q=>Q.map(we=>{if(we.id===P&&we.dependencies){let Ae=we.dependencies.filter(Mt=>Mt!==B);return {...we,dependencies:Ae}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),Pe?.(P,B);},[Pe]),{startDate:pn,endDate:cl}=react.useMemo(()=>{let P=oe.filter(Ae=>Ae.startDate&&Ae.endDate);if(P.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let dt=new Date(Ae);return dt.setDate(dt.getDate()+60),{startDate:Mt,endDate:dt}}let B=P.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),V=new Date(Math.min(...B.map(Ae=>Ae.getTime()))),Q=new Date(Math.max(...B.map(Ae=>Ae.getTime()))),we=ct==="day"?7:ct==="week"?14:30;return V.setDate(V.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:V,endDate:Q}},[oe,ct]);react.useEffect(()=>{Dt.current?.(pn,cl);},[pn,cl]);let yf=react.useCallback(async()=>{if(!ya.current||!na.current||!fa.current)return;await new Promise(Go=>setTimeout(Go,200));let P=ya.current,B=na.current,V=Va.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=V?.scrollLeft||0,Mt=Q.scrollTop,dt=Q.scrollLeft,Fa=P.style.overflow,Yt=P.style.height,ua=V?.style.overflow||"",cr=Q.style.overflow,Sr=B.style.overflow,ko=P.style.width,gn=Q.style.width;try{let Go=V?.querySelector(".gantt-taskgrid-content"),to=Q.querySelector("svg"),ml=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,fn=Go?.scrollHeight||V?.scrollHeight||600,Os=Math.max(ml,Q.scrollHeight),Kn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||Q.scrollWidth,Df=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,gl=Math.max(fn,Os,ml),Zc=Df+gl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+Kn+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Zc}px`,P.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${gl+50}px`),Q.style.overflow="visible",Q.style.height=`${gl+50}px`,Q.style.width=`${Kn+10}px`,await new Promise($s=>setTimeout($s,150));let Sf=await htmlToImage.toPng(P,{backgroundColor:It.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:$s=>{if(!($s instanceof Element))return !0;let tu=window.getComputedStyle($s),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),fl=document.createElement("a");fl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,fl.href=Sf,fl.click();}finally{P.style.overflow=Fa,P.style.height=Yt,P.style.width=ko,B.style.overflow=Sr,V&&(V.style.overflow=ua,V.style.height="",V.scrollTop=we,V.scrollLeft=Ae),Q.style.overflow=cr,Q.style.height="",Q.style.width=gn,Q.scrollTop=Mt,Q.scrollLeft=dt;}},[It]),xf=react.useCallback(async()=>{await De.exportToPDF(oe);},[oe]),ul=react.useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});ul.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let vf=react.useCallback(async()=>{let P=new Date,B=we=>String(we).padStart(2,"0"),V=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(oe,`${Q}_${V}.xlsx`,ul.current);},[oe,m]),wf=react.useCallback(()=>{let P=De.exportToCSV(oe),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),kf=react.useCallback(()=>{let P=De.exportToJSON(oe),B=new Blob([P],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Cf=react.useCallback(()=>{De.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Tf=P=>{P.preventDefault(),Me(true);},mn=react.useRef(false),[pl,Jc]=react.useState(false),_n=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0});react.useEffect(()=>{let P=fa.current,B=na.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let V=()=>{if(mn.current)return;mn.current=true;let dt=P.scrollTop;K(dt),B.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},Q=()=>{if(mn.current)return;mn.current=true;let dt=B.scrollTop;K(dt),P.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},we=dt=>{if(me&&B){let Yt=B.parentElement?.getBoundingClientRect()?.left||0,ua=dt.clientX-Yt,cr=200,Sr=wt+St,ko=window.innerWidth*Et,gn=Math.max(Sr,ko);ua>=cr&&ua<=gn&&_e(ua);}if(pl&&P){let Fa=dt.clientX-_n.current.x,Yt=dt.clientY-_n.current.y;P.scrollLeft=_n.current.scrollLeft-Fa,P.scrollTop=_n.current.scrollTop-Yt;}},Ae=()=>{Me(false),Jc(false);},Mt=dt=>{if(dt.button!==0)return;let Fa=dt.target;Fa.closest("[data-task-bar]")||Fa.closest("[data-dependency-line]")||Fa.closest("button")||Fa.closest('[role="button"]')||Fa.tagName==="rect"&&Fa.getAttribute("data-clickable")==="true"||(Jc(true),_n.current={x:dt.clientX,y:dt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},dt.preventDefault());};return P.addEventListener("scroll",V),B.addEventListener("scroll",Q),P.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Ae),()=>{P.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Ae);}},[me,pl,wt]);let Qc=react.useRef(false),Nf=react.useRef(null);return react.useLayoutEffect(()=>{if(Qc.current||oe.length===0||!fa.current)return;Qc.current=true,Nf.current=pn;let P=fa.current,B=new Date,V=ct==="day"?60:ct==="week"?20:8,Q=(B.getTime()-pn.getTime())/(1e3*60*60*24),we=P.clientWidth,Mt=Q*V*S-we/2;Q>=0&&we>0&&(P.scrollLeft=Math.max(0,Mt));},[oe.length,pn,ct,S]),jsxRuntime.jsx(En.Provider,{value:Qe,children:jsxRuntime.jsx(vl.Provider,{value:xr,children:jsxRuntime.jsxs("div",{ref:ya,className:"flex flex-col h-full w-full",style:{backgroundColor:It.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...It.dotGrid&&{backgroundImage:`radial-gradient(circle, ${It.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx("div",{style:{position:"relative",zIndex:100},children:jsxRuntime.jsx(bi,{theme:It,timeScale:ct,onTimeScaleChange:rt,zoom:S,onZoomChange:q,currentTheme:ke,onThemeChange:U,rowDensity:$,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:C&&le?.canCreateTask!==false&&!le?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Le,onTaskFilterChange:ut,hideCompleted:ne,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:ce,onWbsLevelChange:xe,maxWbsDepth:Gt,viewMode:Ge,onViewModeChange:Te,projectForecast:O,onExportPNG:l?yf:void 0,onExportPDF:l?xf:void 0,onExportExcel:l?vf:void 0,onExportCSV:l?wf:void 0,onExportJSON:l?kf:void 0,onExportMSProject:l?Cf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:qt,showDependencies:Tt,onShowDependenciesChange:At,highlightWeekends:nt,onHighlightWeekendsChange:vt,showBaseline:Ue,onShowBaselineChange:P=>{P&&Ge!=="oracle"&&Te("oracle"),!P&&Ge==="oracle"&&Te("execution");},onCopySnapshotLink:ot,hasDependencies:rf})}),jsxRuntime.jsxs("div",{ref:na,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsxRuntime.jsx("div",{ref:Va,className:"gantt-grid-scroll flex-shrink-0",style:{width:ma,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsxRuntime.jsx(xi,{tasks:_c,theme:It,rowHeight:Rs,availableUsers:d,templates:jc,showCriticalPath:Ne,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:Z,onTaskToggle:sf,scrollTop:j,columns:He,onToggleColumn:of,onColumnResize:nf,onTaskUpdate:un,onTaskIndent:lf,onTaskOutdent:df,onTaskMove:uf,onMultiTaskDelete:ll,onTaskDuplicate:pf,onTaskCreate:mf,onTaskRename:gf,onCreateSubtask:dl,onOpenTaskModal:F?P=>F(P):void 0,onDeleteRequest:(P,B)=>ta({taskId:P,taskName:B}),onTaskReparent:cf,scrollContainerRef:Va})}),jsxRuntime.jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:It.border,zIndex:15},onMouseDown:Tf}),jsxRuntime.jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:pl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Mi,{tasks:_c,theme:It,rowHeight:Rs,timeScale:ct,startDate:pn,endDate:cl,zoom:S,locale:b,templates:jc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:bf,onTaskDateChange:ff,onDependencyCreate:Yc,onDependencyDelete:Xc,showBaseline:Ue,showCriticalPath:Ne,showDependencies:Tt,highlightWeekends:nt,canEditTask:le?.canEditTask})})]}),Ie.task&&jsxRuntime.jsx(Fn,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:It,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Ie.task;if(!P)return [];let B=De.findTaskById(oe,P.id)||P,V=B.subtasks&&B.subtasks.length>0,Q=le?.canCreateTask!==false,we=le?.canDeleteTask!==false;if(V){let Yt=[],ua=le?.canDuplicateTask!==false;return Q&&Yt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),ua&&Yt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(cr=>ms(cr,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),we&&(Yt.length>0&&Yt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Yt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),Yt}let Ae=le?.canUpdateTask!==false,Mt=le?.canDuplicateTask!==false,dt=[];return Ae&&dt.push({id:"edit",label:Qe.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{he?he(B):Ut(B);}}),Q&&dt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),dt.length>0&&Ae&&dt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(dt.push({id:"markIncomplete",label:Qe.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{z?z(B):un(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),dt.push({id:"setInProgress",label:Qe.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{re?re(B):un(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),dt.push({id:"markComplete",label:Qe.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{un(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Mt||Ae&&B.startDate&&B.endDate)&&dt.length>0&&dt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&dt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(Yt=>ms(Yt,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Ae&&B.startDate&&B.endDate&&dt.push({id:"split",label:Qe.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Yt=B.startDate.getTime(),ua=B.endDate.getTime(),cr=Yt+(ua-Yt)/2,Sr=new Date(cr);hf(B,Sr);}}),we&&(dt.length>0&&dt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),dt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),dt})()}),jsxRuntime.jsx(fo,{task:Nt,isOpen:!!Nt,onClose:()=>Ut(null),onTaskUpdate:P=>{Nt&&(un(Nt.id,P),Ut(null));},theme:ke==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ta&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>ta(null),children:jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:It.bgSecondary,border:`1px solid ${It.border}`},children:[jsxRuntime.jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${It.border}`},children:jsxRuntime.jsxs("div",{className:"flex items-start gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("h3",{className:"text-lg font-semibold",style:{color:It.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qe.contextMenu?.deleteTask||"Delete Task","?"]}),jsxRuntime.jsx("p",{className:"text-sm mt-1",style:{color:It.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsxRuntime.jsx("div",{className:"px-6 py-4",children:jsxRuntime.jsxs("p",{className:"text-sm leading-relaxed",style:{color:It.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxRuntime.jsxs("span",{className:"font-semibold",style:{color:It.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:It.bgPrimary,borderTop:`1px solid ${It.border}`},children:[jsxRuntime.jsx("button",{onClick:()=>ta(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:It.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=It.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxRuntime.jsxs("button",{onClick:()=>{ll([Ta.taskId]),ta(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsxRuntime.jsx(Ai,{tasks:oe,theme:It,config:f,onTasksUpdate:$e,onTaskUpdate:un,onTaskCreate:P=>{$e(B=>[...B,P]);},onTaskDelete:P=>{ll([P]);},onDependencyCreate:(P,B)=>{let V=De.findTaskById(oe,P);V&&Yc(V,B);},onDependencyDelete:Xc})]})})})});function t2(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function a2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Id=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Mm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Ld,...l.filter(S=>!Ld.some(q=>q.id===S.id))],f=pt[c]||pt.dark,[b,w]=react.useState(false),[C,N]=react.useState(false),[T,k]=react.useState(false),[v,E]=react.useState(false),[I,D]=react.useState({top:0,left:0}),[X,O]=react.useState(null),[H,F]=react.useState(new Date),[Y,Z]=react.useState({top:0,left:0}),[Se,R]=react.useState(false),[_,he]=react.useState([]),[Je,z]=react.useState(false),[re,J]=react.useState(""),Pe=react.useRef(null),ve=react.useRef(null),We=react.useRef(null),Re=react.useRef(null),st=react.useRef(null),[ee,it]=react.useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[le,ot]=react.useState({});react.useEffect(()=>{a?(it({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(it({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),he([]));},[a,e,x]),react.useEffect(()=>{let S=q=>{Pe.current&&!Pe.current.contains(q.target)&&w(false),ve.current&&!ve.current.contains(q.target)&&N(false),We.current&&!We.current.contains(q.target)&&k(false),Re.current&&!Re.current.contains(q.target)&&E(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let yt=()=>{let S={};return ee.name.trim()||(S.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),ot(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!yt())try{let q=i==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(q),he([]),t();}catch(q){console.error("Error submitting task:",q);}},ke=(S,q)=>{it(ce=>{let Ce={...ce,[S]:q};if(S==="status"){let W=q;W==="todo"?Ce.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Ce.progress=50):W==="completed"||W==="closed"?Ce.progress=100:(W==="in-review"||W==="review")&&(Ce.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Ce.status="completed":W>0&&W<100&&ce.status==="todo"?Ce.status="in-progress":W===0&&ce.status!=="todo"&&(Ce.status="todo");}return Ce}),le[S]&&ot(ce=>{let Ce={...ce};return delete Ce[S],Ce});},xt=h.find(S=>S.id===ee.status)??Ld[0],ct=Id.find(S=>S.id===ee.priority)??Id[1],rt=Yo.find(S=>S.value===ee.color)??Yo[0],$=c==="dark",de={backgroundColor:$?"#1d1f27":f.bgSecondary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.textPrimary};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:$?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.border}`,boxShadow:$?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsxs("form",{onSubmit:Pt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxRuntime.jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsxRuntime.jsx("input",{type:"text",value:ee.name,onChange:S=>ke("name",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),le.name&&jsxRuntime.jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3 h-3"}),le.name]}),jsxRuntime.jsx("textarea",{value:ee.description||"",onChange:S=>ke("description",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxRuntime.jsxs("div",{ref:Pe,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsxRuntime.jsx("span",{style:{color:xt.color},children:xt.title}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:b&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("status",S.id),w(false);},children:[jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ee.status===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxRuntime.jsxs("div",{ref:ve,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsxRuntime.jsx("span",{children:ct.label}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:C&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Id.map(S=>jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("priority",S.id),N(false);},children:[jsxRuntime.jsx("span",{children:S.icon}),S.label,ee.priority===S.id&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxRuntime.jsxs("div",{ref:We,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((S,q)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ee.assignees.length>3&&jsxRuntime.jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:T&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ee.assignees?.some(ce=>ce.name===S.name);return jsxRuntime.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ee.assignees||[]).filter(Ce=>Ce.name!==S.name):[...ee.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ke("assignees",ce);},children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:f.accent},children:S.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left",children:S.name}),jsxRuntime.jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},S.id)})})})]}),jsxRuntime.jsxs("div",{ref:Re,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)E(false);else {if(Re.current){let S=Re.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;D({top:W,left:S.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsxRuntime.jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsxRuntime.jsx("span",{children:rt.name}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:v&&jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(false)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsxRuntime.jsx("div",{style:{padding:"6px 8px"},children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Yo.slice(0,18).map(S=>{let q=ee.color===S.value;return jsxRuntime.jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),ke("color",S.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsxRuntime.jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsxRuntime.jsx(Do,{selectedTags:ee.tags||[],availableTags:m,onChange:S=>ke("tags",S),onCreateTag:d,theme:f,disabled:n}):null]}),jsxRuntime.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:$?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxRuntime.jsxs("div",{ref:st,className:"flex items-center gap-2 flex-1 relative",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="start")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("start"),F(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsxRuntime.jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X==="end")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("end"),F(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:X&&jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ce=new Date(S);ce.setDate(S.getDate()+7);let Ce=new Date(S);return Ce.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Ce}].map((te,Ge)=>jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{X==="start"?(ke("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&ke("endDate",te.date),O("end")):(ke("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&ke("startDate",te.date),O(null));},children:te.label},Ge))})(),jsxRuntime.jsx("div",{style:{borderTop:`1px solid ${f.border}`,margin:"0.5rem 0"}}),jsxRuntime.jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("startDate",void 0),ke("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxRuntime.jsxs("div",{className:"p-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsxRuntime.jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsxRuntime.jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsxRuntime.jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ce=new Date(S,q,1).getDay(),Ce=new Date(S,q+1,0).getDate(),W=new Date,te=[];for(let Te=ce-1;Te>=0;Te--)te.push({day:new Date(S,q,-Te).getDate(),date:new Date(S,q-1,new Date(S,q,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=Ce;Te++)te.push({day:Te,date:new Date(S,q,Te),isCurrentMonth:true});let Ge=42-te.length;for(let Te=1;Te<=Ge;Te++)te.push({day:Te,date:new Date(S,q+1,Te),isCurrentMonth:false});return te.map((Te,Ue)=>{let Ne=Te.date.toDateString()===W.toDateString(),Ve=ee.startDate?.toDateString()===Te.date.toDateString(),Tt=ee.endDate?.toDateString()===Te.date.toDateString(),gt=ee.startDate&&ee.endDate&&Te.date>=ee.startDate&&Te.date<=ee.endDate;return jsxRuntime.jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Te.isCurrentMonth?Ve||Tt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ve?f.accent:Tt?"#7C3AED":gt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ve&&!Tt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X==="start"?(ke("startDate",Te.date),ee.endDate&&Te.date>ee.endDate&&ke("endDate",Te.date),O("end")):(ke("endDate",Te.date),ee.startDate&&Te.date<ee.startDate&&ke("startDate",Te.date),O(null));},children:Te.day},Ue)})})()})]})]})]})})]}),le.endDate&&jsxRuntime.jsx("span",{className:"text-xs text-red-400",children:le.endDate})]})]}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:f.textTertiary},children:"Progreso Inicial"}),jsxRuntime.jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsxRuntime.jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:$?"#33343c":"#E5E7EB"},onClick:S=>{if(n)return;let q=S.currentTarget.getBoundingClientRect(),ce=Math.round((S.clientX-q.left)/q.width*100/5)*5;ke("progress",Math.max(0,Math.min(100,ce)));},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxRuntime.jsxs("div",{style:{borderTop:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>R(!Se),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsxRuntime.jsx(lucideReact.ChevronDown,{className:`w-4 h-4 transition-transform ${Se?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsxRuntime.jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Se&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxRuntime.jsxs("div",{className:"pt-3 space-y-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:[jsxRuntime.jsx("path",{d:"M12 6v6l4 2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?t2(ee.effortMinutes):"",onChange:S=>{let q=a2(S.target.value);ke("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}})]}),r.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Fase Padre"})]}),jsxRuntime.jsxs("select",{value:ee.parentId||"",onChange:S=>ke("parentId",S.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsxRuntime.jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(S=>S.id!==a?.id).map(S=>jsxRuntime.jsx("option",{value:S.id,children:S.name},S.id))]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:S=>ke("location",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsxRuntime.jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Activo / Equipo"})]}),jsxRuntime.jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:S=>ke("equipment",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||p.length>0||i==="create")&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.textTertiary},children:jsxRuntime.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxRuntime.jsxs("span",{className:"text-xs",style:{color:f.textTertiary},children:["Adjuntos ",i==="create"?_.length>0&&`(${_.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsxRuntime.jsx(so,{cardId:"pending",attachments:_.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>he(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);he(ce=>ce.filter((Ce,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsxRuntime.jsx(so,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&_.length>0&&jsxRuntime.jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:S=>ke("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:f.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:f.textTertiary},children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(S=>{let q=r.find(ce=>ce.id===S);return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsxRuntime.jsx("button",{type:"button",onClick:()=>{let ce=(ee.dependencies||[]).filter(Ce=>Ce!==S);ke("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]},S)})}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>{z(!Je),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"}),jsxRuntime.jsx("span",{children:"Agregar dependencia"})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Je&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),J("");}}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsxRuntime.jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${f.border}`},children:jsxRuntime.jsx("input",{type:"text",value:re,onChange:S=>J(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxRuntime.jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>re===""||S.name.toLowerCase().includes(re.toLowerCase())).map(S=>{let q=ee.dependencies?.includes(S.id);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let ce=ee.dependencies||[],Ce;q?Ce=ce.filter(W=>W!==S.id):Ce=[...ce,S.id],ke("dependencies",Ce);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.accent}10`:"transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:q?f.accent:"transparent",borderColor:q?f.accent:f.borderLight},children:q&&jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"})}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:S.name}),jsxRuntime.jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsxRuntime.jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${$?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:$?"rgba(25,27,34,0.2)":void 0},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>S.currentTarget.style.color=f.textPrimary,onMouseLeave:S=>S.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsxRuntime.jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:S=>!n&&(S.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:S=>!n&&(S.currentTarget.style.filter="brightness(1)"),children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Fm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function Pm(e){return
|
|
|
410
410
|
${Am(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Am(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function vo(e,t){let a=Am(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}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},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Rd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Lm(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 Im(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=vo(t,l),p=Bd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=vo(t,l),p=Rd(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=vo(t,l),p=Od(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=vo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=vo(t,l),p=vo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=vo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Bm(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 r2(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 o2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Bi(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Bi(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:r2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:o2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Om(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Bi(r,e,t))}var $d={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"}},Hd={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"}},Ri={en:$d,es:Hd};function zd(e){return Ri[e]||Ri.en}function Oi(e,t){let a=zd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Ud=[{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 $m(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 Hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=$m(e),l=Ud[0],m=Ud.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch($m(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ud.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Wd=[{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 Um({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Wd.find(m=>m.value===e)??Wd[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(m=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function xs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Vd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:xs(x.name),color:x.color||Gd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.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:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):xs(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&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"}})})]},x.id)})})]})]})}function Km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=react.useState(false),[d,p]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),E=new Date(k,v,1),D=new Date(k,v+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,v,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,v-1,F-Z),isCurrentMonth:false});for(let Z=1;Z<=D;Z++)O.push({date:new Date(k,v,Z),isCurrentMonth:true});let Y=42-O.length;for(let Z=1;Z<=Y;Z++)O.push({date:new Date(k,v+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),p("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),m(false);}},N=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let D=new Date(k);D.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),m(!l);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,v)=>jsxRuntime.jsxs("button",{className:u("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:()=>C(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("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:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),D=f?.toDateString()===k.date.toDateString(),X=I||D,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",D&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function zi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Km,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function $n(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ui(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),m=react.useRef([]);return react.useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),m=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Xm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),{isFlashing:d,triggerFlash:p}=$n(),{displayValue:g,isAnimating:y}=Ui(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&p());},h=react.useCallback(C=>{r||!t||(C.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=react.useCallback(()=>{i(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=react.useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&i(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:m,value:c,onChange:C=>l(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function ag({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=react.useState(false),[d,p]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=$n(),{displayValue:h,isAnimating:f}=Ui(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function rg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function ng({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function lg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function W2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function G2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=react.useState(false),[p,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=$n(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:W2(e,r);react.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let w=()=>{let T=G2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=f?lucideReact.DollarSign:lucideReact.Clock;return s||!t?!e||e===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsxRuntime.jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:b})]})}function pg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===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:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function gg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=Z=>m?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[p,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,E=v>100?Math.round((w-C)/60*10)/10:0,I=v>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let Z=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let D=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Se)=>{h==="log"&&r&&Z?r(e,Z,Se):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},H=r||o||s||n,F=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),Y=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&w===0&&N===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:F.map(Z=>jsxRuntime.jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," ",l?"Excedido":"Over"]})]}),C>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(v,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),H&&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:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:F.map(Z=>jsxRuntime.jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function X2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function J2(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 fg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function bg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=X2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(fg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?J2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(fg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Q2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function yg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Tg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?wg.es:wg.en;if(react.useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},v=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),i&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],D=E.some(X=>X.name===v.name)?E.filter(X=>X.name!==v.name):[...E,{name:v.name,initials:m1(v.name),color:v.color||g1(v.name),avatar:v.avatarUrl}];i({...e.task,assignees:D}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return l&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?w():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(f1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function f1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("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(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("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:i.icon}),i.label]},i.id))})]})}var wg={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 Ag={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"})},A1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Ig({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=react.useState(""),[m,d]=react.useState(null),[p,g]=react.useState(null),y=react.useRef(null),x=i==="es"?Lg.es:Lg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let X=v.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),D=window.innerHeight-E.top-20;d(Math.max(300,D));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...A1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let v=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(v);},w=(k,v)=>{let E=a.find(D=>D.type===k&&(!v||D.customFieldId===v));if(E){b(E.id);return}let I={id:v||k,type:k,label:v?r.find(D=>D.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",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 ${n?"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:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>l(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(D=>D.type===k&&!D.customFieldId),E=v?.visible??false,I=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{I||(v?b(v.id):w(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:D=>{I||(D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.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:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Lg={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",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 U1=[{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 Og({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,m]=react.useState([""]),d=o==="es"?Rg.es:Rg.en;react.useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==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:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:U1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"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"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Rg={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 zg={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 Ug({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),m=s==="es"?zg.es:zg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),m.filters,p&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Wg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Cs(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function Gg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxRuntime.jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("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:s?"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"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Cs(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Cs(c)})]}),l>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cs(l)})]}),i>0&&jsxRuntime.jsx("div",{className:u("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(p,100)}%`,backgroundColor:y}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm 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:[m>=0?`+${Cs(m)} ${s?"Disp.":"Avail."}`:`${Cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#F87171":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Wg(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Wg(c)})]}),c>0&&jsxRuntime.jsx("div",{className:u("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:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#F87171]/15 text-[#F87171]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#F87171":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("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(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var rw=[{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 Yg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yg(r.subtasks,t+1));return a}function ow(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function Gn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Gn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Wn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function nw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Xg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:v="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:D=false,showProjectTotals:X=false}=t,O=Oi(d,p),H=m==="dark",F=M=>{if(!I||!M.assignees||M.assignees.length===0)return E;let se=M.assignees.map(xe=>xe.id?I[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return se.length===0?E:se.reduce((xe,Fe)=>xe+Fe,0)/se.length},Y=M=>{let se=0,xe=0,Fe=0,Ke=Qe=>{for(let ye of Qe)if(ye.subtasks&&ye.subtasks.length>0){let He={s:se,a:xe,q:Fe};if(Ke(ye.subtasks),se-He.s+(xe-He.a)+(Fe-He.q)===0){let wt=F(ye);se+=(ye.timeLoggedMinutes??0)/60*wt,xe+=(ye.effortMinutes??0)/60*wt,Fe+=(ye.soldEffortMinutes??0)/60*wt;}}else {let He=F(ye);se+=(ye.timeLoggedMinutes??0)/60*He,xe+=(ye.effortMinutes??0)/60*He,Fe+=(ye.soldEffortMinutes??0)/60*He;}};return M.subtasks&&Ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Fe}},Z=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=react.useMemo(()=>{function M(se){let xe=0,Fe=0,Ke=0,Qe=0,ye=0,He=0;for(let lt of se)if(lt.subtasks&<.subtasks.length>0){let wt=M(lt.subtasks);if(wt.spent+wt.allocated+wt.quoted>0)xe+=wt.spent,Fe+=wt.allocated,Ke+=wt.quoted,Qe+=wt.dollarSpent,ye+=wt.dollarAllocated,He+=wt.dollarQuoted;else {let St=lt.timeLoggedMinutes??0,Et=lt.effortMinutes??0,ma=lt.soldEffortMinutes??0;xe+=St,Fe+=Et,Ke+=ma;let na=F(lt);Qe+=St/60*na,ye+=Et/60*na,He+=ma/60*na;}}else {let wt=lt.timeLoggedMinutes??0,Ot=lt.effortMinutes??0,St=lt.soldEffortMinutes??0;xe+=wt,Fe+=Ot,Ke+=St;let Et=F(lt);Qe+=wt/60*Et,ye+=Ot/60*Et,He+=St/60*Et;}return {spent:xe,allocated:Fe,quoted:Ke,dollarSpent:Qe,dollarAllocated:ye,dollarQuoted:He}}return M(e)},[e]),R=react.useMemo(()=>{let M=new Map;function se(xe){let Fe=0;for(let Ke of xe)if(Ke.subtasks&&Ke.subtasks.length>0){let Qe=se(Ke.subtasks);M.set(Ke.id,Qe),Fe+=Qe;}else Fe+=Ke.weight||0;return Fe}return se(e),M},[e]),_=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[he,Je]=react.useState(true),[z,re]=react.useState("position"),[J,Pe]=react.useState("asc"),[ve,We]=react.useState(""),[Re,st]=react.useState(()=>Z().statusFilter),[ee,it]=react.useState(()=>Z().hideCompleted),[le,ot]=react.useState(x||rw),[yt,Pt]=react.useState(false),[ke,xt]=react.useState(false),[ct,rt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[$,de]=react.useState(null),[S,q]=react.useState(false),[ce,Ce]=react.useState(null),[W,te]=react.useState(null),[Ge,Te]=react.useState(null),Ue=react.useRef(0),Ne=react.useRef(false),Ve=!!(a.onTaskMove||a.onTaskReparent),Tt=react.useCallback((M,se)=>{Ve&&(se.preventDefault(),Ue.current=se.clientY,de(M),Ne.current=false,q(false),Te({x:se.clientX,y:se.clientY}));},[Ve]),gt=react.useCallback(M=>{if(!$||(Math.abs(M.clientY-Ue.current)>5&&!Ne.current&&(Ne.current=true,q(true)),Te({x:M.clientX,y:M.clientY}),!Ne.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Fe=null,Ke=null;xe.forEach(Qe=>{let ye=Qe.getBoundingClientRect(),He=Qe.getAttribute("data-listview-row");if(He&&He!==$&&M.clientY>=ye.top&&M.clientY<=ye.bottom){Fe=He;let lt=M.clientY-ye.top,wt=ye.height;Ke=lt<wt*.25?"above":lt>wt*.75?"below":"child";}}),Ce(Fe),te(Ke);},[$]),nt=react.useCallback(()=>{if(Ne.current&&$&&ce&&W){if(W==="child"&&a.onTaskReparent)a.onTaskReparent($,ce);else if(W==="above"||W==="below"){let M=(Fe,Ke,Qe=null)=>{for(let ye of Fe){if(ye.id===Ke)return Qe;if(ye.subtasks){let He=M(ye.subtasks,Ke,ye.id);if(He!==void 0)return He}}},se=M(e,$,null),xe=M(e,ce,null);if(a.onTaskReparent){let Fe=(wt,Ot)=>{if(Ot===null)return wt;for(let St of wt){if(St.id===Ot)return St.subtasks||[];if(St.subtasks){let Et=Fe(St.subtasks,Ot);if(Et.length>0||St.subtasks.some(ma=>ma.id===Ot))return Et}}return []},Ke=Fe(e,xe??null),Qe=Ke.findIndex(wt=>wt.id===ce),ye=se===xe,He=ye?Ke.findIndex(wt=>wt.id===$):-1,lt=W==="below"?Qe+1:Qe;ye&&He!==-1&&He<Qe&&(lt-=1),a.onTaskReparent($,xe??null,Math.max(0,lt));}}}de(null),Ce(null),te(null),Te(null),Ne.current=false,q(false);},[$,ce,W,e,a]);react.useEffect(()=>{if($)return document.addEventListener("mousemove",gt),document.addEventListener("mouseup",nt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",nt),document.body.style.cursor="",document.body.style.userSelect="";}},[$,gt,nt]);let[et,qt]=react.useState("all"),[At,vt]=react.useState(false),Dt=react.useRef(null),ft=react.useRef(null),Wt=react.useMemo(()=>{let M=0;function se(xe,Fe){for(let Ke of xe)Fe>M&&(M=Fe),Ke.subtasks?.length&&se(Ke.subtasks,Fe+1);}return se(e,1),M},[e]);react.useEffect(()=>{if(!At)return;let M=se=>{Dt.current?.contains(se.target)||ft.current?.contains(se.target)||vt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[At]),react.useEffect(()=>{if(et==="all"){let xe=function(Fe){for(let Ke of Fe)Ke.subtasks?.length&&(Ke.isExpanded===false&&a.onTaskToggleExpand?.(Ke.id),xe(Ke.subtasks));};xe(e);}else {let xe=function(Fe,Ke){for(let Qe of Fe)if(Qe.subtasks?.length){let ye=Ke<et,He=Qe.isExpanded!==false;ye!==He&&a.onTaskToggleExpand?.(Qe.id),xe(Qe.subtasks,Ke+1);}};xe(e,1);}},[et]);let[Oe,Le]=react.useState(null),[ut,ne]=react.useState(0),[fe,L]=react.useState(0),j=react.useRef(null),[K,me]=react.useState(null),[Me,qe]=react.useState(null);react.useEffect(()=>{x&&ot(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Fe=M[xe],Ke=x[xe];if(!Fe||!Ke||Fe.id!==Ke.id||Fe.visible!==Ke.visible||Fe.width!==Ke.width||Fe.label!==Ke.label){se=false;break}}if(se)return M}return x});},[x]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Re,hideCompleted:ee}));}catch(M){console.error("Error persisting filter state:",M);}},[N,Re,ee]);let _e=react.useMemo(()=>{let M=new Set;function se(xe){for(let Fe of xe)Fe.subtasks?.length&&(Fe.isExpanded!==false&&M.add(Fe.id),se(Fe.subtasks));}return se(e),M},[e]),Ie=react.useMemo(()=>le.filter(M=>M.visible),[le]),bt=react.useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Nt=react.useCallback(M=>{z===M?Pe(se=>se==="asc"?"desc":"asc"):(re(M),Pe("asc")),a.onSortChange?.({column:M,direction:J==="asc"?"desc":"asc"});},[z,J,a]),Ut=react.useCallback(M=>{ot(M),a.onColumnsChange?.(M);},[a]),Ta=react.useCallback(M=>{let se=le.map(xe=>xe.id===M?{...xe,visible:false}:xe);Ut(se);},[le,Ut]),ta=react.useCallback((M,se)=>{re(M),Pe(se);},[]),U=react.useCallback((M,se,xe)=>{b&&(M.preventDefault(),rt({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),oe=react.useCallback(()=>{rt(M=>({...M,isOpen:false}));},[]),$e=react.useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=le.find(Fe=>Fe.id===se);xe&&(Le(se),ne(M.clientX),L(xe.width));},[le,f]);react.useEffect(()=>{if(!Oe)return;let M=le,se=Fe=>{let Ke=Fe.clientX-ut,Qe=Math.max(50,fe+Ke);M=M.map(ye=>ye.id===Oe?{...ye,width:Qe}:ye),ot(M);},xe=()=>{a.onColumnsChange?.(M),Le(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[Oe,ut,fe,a]);let A=react.useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}me(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),ge=react.useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),me(null),qe(null);},[]),je=react.useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",qe(se));},[]),tt=react.useCallback(()=>{qe(null);},[]),oa=react.useCallback((M,se)=>{if(M.preventDefault(),!K||K===se||se==="name")return;let xe=[...le],Fe=xe.findIndex(ye=>ye.id===K),Ke=xe.findIndex(ye=>ye.id===se);if(Fe===-1||Ke===-1)return;let Qe=xe.splice(Fe,1);Qe[0]&&(xe.splice(Ke,0,Qe[0]),Ut(xe),me(null),qe(null));},[K,le,Ut]),Gt=react.useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}xt(false);},[a]),Na=react.useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Ma=react.useMemo(()=>{let M=Yg(e);if(ve.trim()){let se=ve.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return Re!=="all"&&(M=M.filter(se=>Na(se)===Re)),ee&&(M=M.filter(se=>Na(se)!=="completed")),M.sort((se,xe)=>{let Fe,Ke;switch(z){case "name":Fe=se.name.toLowerCase(),Ke=xe.name.toLowerCase();break;case "startDate":Fe=se.startDate?.getTime()||0,Ke=xe.startDate?.getTime()||0;break;case "endDate":Fe=se.endDate?.getTime()||0,Ke=xe.endDate?.getTime()||0;break;case "progress":Fe=se.progress||0,Ke=xe.progress||0;break;case "status":Fe=se.status||"todo",Ke=xe.status||"todo";break;case "priority":let Qe={urgent:0,high:1,medium:2,low:3,none:4};Fe=Qe[se.priority]??4,Ke=Qe[xe.priority]??4;break;case "position":return 0;default:return 0}return Fe<Ke?J==="asc"?-1:1:Fe>Ke?J==="asc"?1:-1:0}),M},[e,ve,Re,ee,z,J,Na]),Ga=react.useCallback((M,se)=>{let xe=Qe=>{a.onTaskUpdate?.({...M,...Qe});},Fe=Qe=>Qe?M.customFields?.find(He=>He.fieldId===Qe)?.value:void 0,Ke=(Qe,ye)=>{if(!Qe)return;let lt=[...M.customFields||[]],wt=lt.findIndex(Ot=>Ot.fieldId===Qe);wt>=0?lt[wt]={fieldId:Qe,value:ye}:lt.push({fieldId:Qe,value:ye}),xe({customFields:lt});};switch(se.type){case "name":return null;case "status":return jsxRuntime.jsx(Hm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:ye=>{xe({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Um,{value:M.priority,onChange:ye=>xe({priority:ye}),isDark:H,locale:d});case "assignees":{let ye=M.hasChildren,He=M.assignees||[];if(ye&&M.subtasks?.length){let lt=new Map;(M.assignees||[]).forEach(Ot=>lt.set(Ot.name,Ot));let wt=Ot=>{(Ot||[]).forEach(St=>{(St.assignees||[]).forEach(Et=>{lt.has(Et.name)||lt.set(Et.name,Et);}),St.subtasks?.length&&wt(St.subtasks);});};wt(M.subtasks),He=Array.from(lt.values());}return jsxRuntime.jsx(Vd,{value:He,availableUsers:i,onChange:lt=>xe({assignees:lt}),isDark:H,locale:d,disabled:ye})}case "startDate":return jsxRuntime.jsx(zi,{value:M.startDate,onChange:ye=>xe({startDate:ye}),isDark:H,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsxRuntime.jsx(zi,{value:M.endDate,onChange:ye=>xe({endDate:ye}),isDark:H,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let ye=!!(M.subtasks&&M.subtasks.length>0);return jsxRuntime.jsx(Xm,{value:M.progress||0,onChange:ye?void 0:He=>{let lt=He===100?"completed":He>0?"in-progress":"todo";xe({progress:He,status:lt});},isDark:H,disabled:ye})}case "tags":return jsxRuntime.jsx(lg,{value:M.tags||[],isDark:H});case "text":return jsxRuntime.jsx(Zm,{value:Fe(se.customFieldId)||"",onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "number":return jsxRuntime.jsx(ag,{value:Fe(se.customFieldId)||0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "date":let Qe=Fe(se.customFieldId);return jsxRuntime.jsx(zi,{value:Qe?new Date(Qe):void 0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H,locale:d});case "dropdown":return jsxRuntime.jsx(rg,{value:Fe(se.customFieldId)||"",options:se.options||[],onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "checkbox":return jsxRuntime.jsx(ng,{value:Fe(se.customFieldId)||false,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "estimatedTime":{let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.estimatedTime,onChange:He=>xe({estimatedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "quotedTime":{let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(Dr,{value:M.quotedTime,onChange:lt=>xe({quotedTime:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "elapsedTime":{let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.elapsedTime,onChange:He=>xe({elapsedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "effortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{allocated:Ot}=Gn(M);if(v==="financial"){let St=Y(M),Et=Math.round(St.dollarAllocated),ma=Math.round(St.dollarQuoted),na=ma-Et;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Et>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Et.toLocaleString("es-CO")]}):null,na!==0&&Et>0&&ma>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",na>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[na>0?"+":"",Math.abs(na)>=1e3?`$${(na/1e3).toFixed(1)}K`:`$${na}`]})]})}return jsxRuntime.jsx(Dr,{value:Ot>0?Ot:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:E})}let ye=M.status==="completed"||M.progress===100,He=M.effortMinutes||0,lt=M.soldEffortMinutes||0,wt=F(M);if(v==="financial"&&wt&&He>0&<>0){let Ot=Math.round(He/60*wt),Et=Math.round(lt/60*wt)-Ot;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Dr,{value:He,onChange:ma=>xe({effortMinutes:ma}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)}),Et!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Et>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Et>0?"+":"",Math.abs(Et)>=1e3?`$${(Et/1e3).toFixed(1)}K`:`$${Et}`]})]})}return jsxRuntime.jsx(Dr,{value:He,onChange:Ot=>xe({effortMinutes:Ot}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{spent:He}=Gn(M);return jsxRuntime.jsx(Dr,{value:He>0?He:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?He=>{a.onLogTime?.(M,He);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ye,lens:v,hourlyRate:F(M)})}case "soldEffortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{quoted:lt}=Gn(M),wt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:lt>0?lt:void 0,isDark:H,locale:d,disabled:true,isBlurred:wt,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:M.soldEffortMinutes,onChange:lt=>xe({soldEffortMinutes:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "scheduleVariance":{let ye=M.effortMinutes||0,He=M.soldEffortMinutes||0,lt=M.timeLoggedMinutes||0,wt=ye>0||He>0||lt>0;return jsxRuntime.jsx(pg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:wt})}case "hoursBar":{if(D&&M.hasChildren){let{spent:ye,allocated:He,quoted:lt}=Gn(M),wt=ye>He&&He>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",wt?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Wn(ye)}),He>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-white/60":"text-gray-600",children:Wn(He)})]}),lt>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Wn(lt)})]})]})}return jsxRuntime.jsx(gg,{task:M,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:F(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsxRuntime.jsx(bg,{task:M,isDark:H,locale:d}):jsxRuntime.jsx(Vd,{value:M.assignees||[],availableUsers:i,onChange:He=>{a.onTaskUpdate?.({...M,assignees:He});},isDark:H,locale:d});case "blockers":return jsxRuntime.jsx(yg,{blockers:M.blockers,isDark:H,locale:d});case "weight":{let ye=R.get(M.id);if(ye!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",ye>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?`${Number(ye.toFixed(2))}%`:"\u2014"});let He=M.weight||0;return jsxRuntime.jsx(nw,{value:He,onChange:lt=>xe({weight:lt}),isDark:H})}default:return jsxRuntime.jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,D,R]),ha=react.useCallback(M=>{let xe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),nr=react.useMemo(()=>{let xe=Ie.reduce((Ke,Qe)=>Ke+Qe.width,0)+(h?48:0),Fe={};for(let Ke of Ie)Fe[Ke.id]=`${Ke.width/xe*100}%`;return Fe},[Ie,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:j,className:u(H?"bg-[#0D0D0D]":"bg-white",Oe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ma.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:ve,onChange:M=>We(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"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"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),y&&Wt>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Dt,onClick:()=>vt(!At),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?At?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":At?"bg-blue-50 border-blue-300 text-blue-600":"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"}),et==="all"?d==="es"?"Todos":"All":`L${et}`]}),At&&jsxRuntime.jsx("div",{ref:ft,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Wt,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{qt(M.value),vt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?et===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":et===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:M.label}),et===M.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsxRuntime.jsx(Ug,{value:Re,hideCompleted:ee,onChange:st,onHideCompletedChange:it,isDark:H,locale:d}),_?.enabled&&_.data&&!he&&jsxRuntime.jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"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:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&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, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.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:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(M=>{let se=M.id!=="name",xe=Me===M.id&&K!==M.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",se&&"cursor-grab",K===M.id&&"opacity-50",xe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:nr[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Fe=>A(Fe,M.id):void 0,onDragEnd:se?ge:void 0,onDragOver:se?Fe=>je(Fe,M.id):void 0,onDragLeave:se?tt:void 0,onDrop:se?Fe=>oa(Fe,M.id):void 0,onContextMenu:Fe=>U(Fe,void 0,M.id),children:[se&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Nt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ha(M),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",z===M.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:ha(M)}),f&&M.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Oe===M.id&&"bg-[#007BFF]"),onMouseDown:Fe=>$e(Fe,M.id)})]},M.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),Pt(se=>!se);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",yt&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Ig,{isOpen:yt,onClose:()=>Pt(false),columns:le,customFields:c,onColumnsChange:Ut,onCreateCustomField:()=>{Pt(false),xt(true);},isDark:H,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ma.map((M,se)=>{let xe=_e.has(M.id),Fe=Math.min(se*.01,.2),Ke=M.hasChildren&&M.level===0,Qe=M.subtasks?.length||0;if(Ke){let{spent:St,allocated:Et,quoted:ma}=Gn(M),na=ow(M);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Ya=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:nr[Ya.id],minWidth:Ya.minWidth},children:Ya.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:H?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",H?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",H?"text-white/30":"text-gray-500"),children:["(",Qe," ",d==="es"?Qe===1?"Tarea":"Tareas":Qe===1?"Item":"Items",")"]}),na!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",na>=1?"text-[#32D74B] bg-[#32D74B]/10":na>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",na.toFixed(2)]})]})]}):Ya.type==="timeLoggedMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarSpent);return ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:St>0?St:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ya.type==="soldEffortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarQuoted);return ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:ma>0?ma:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ya.type==="effortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarAllocated),Lt=Math.round(fa.dollarQuoted),xr=Lt-ya;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("es-CO")]}):null,xr!==0&&ya>0&&Lt>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})})():jsxRuntime.jsx(Dr,{value:Et>0?Et:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ga(M,Ya)},Ya.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let ye=$===M.id,He=ce===M.id,lt=He&&W==="above",wt=He&&W==="below",Ot=He&&W==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-b transition-colors relative group",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),style:{opacity:ye?.4:1,backgroundColor:Ot?H?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Ot?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>U(St,M),children:[lt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),wt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Ve&&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:St=>Tt(M.id,St),style:{color:H?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Ie.map(St=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:nr[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsxRuntime.jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:Et=>{Et.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate text-[13px]",M.hasChildren?"font-semibold":"font-medium",M.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Ga(M,St)},St.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&Ma.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Se,Fe=se-M,Ke=Fe<0,Qe=Ke?`+${Wn(Math.abs(Fe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Wn(Fe)} ${d==="es"?"AHORRADO":"SAVED"}`,ye=v==="financial"&&E>0,He=(Ot,St)=>{if(ye){let Et=St??Ot/60*E;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Wn(Ot)},lt=ye?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,wt=ye?`${Ke?"+":"-"}$${lt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Qe;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Ot=>jsxRuntime.jsx("div",{className:"flex items-center px-4 py-3",style:{width:nr[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Ot.type==="hoursBar"?jsxRuntime.jsxs("div",{className:"flex flex-col w-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(M,ye?Se.dollarSpent:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,ye?Se.dollarAllocated:void 0)})]}),se>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye?wt:Qe})]}):Ot.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?He(xe,ye?Se.dollarQuoted:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(ye&&xe>0&&se>0){let St=Math.round(Se.dollarQuoted),Et=Math.round(Se.dollarAllocated),ma=St-Et,na=St>0?Math.round(ma/St*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,Se.dollarAllocated)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ma>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ma>=0?"+":"",Math.abs(ma)>=1e3?`$${(ma/1e3).toFixed(1)}K`:`$${ma}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?He(se,ye?Se.dollarAllocated:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?He(M,ye?Se.dollarSpent:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let St=e||[],Et=[],ma=Lt=>{for(let xr of Lt)xr.subtasks&&xr.subtasks.length>0?ma(xr.subtasks):Et.push({progress:xr.progress||0,weight:xr.weight||0});};ma(St);let na=0,Ya=0,fa=0;for(let Lt of Et)Lt.weight>0&&(na+=Lt.progress*Lt.weight,Ya+=Lt.weight),fa+=Lt.progress;let ya=Ya>0?Math.round(na/Ya*10)/10:Et.length>0?Math.round(fa/Et.length):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ya,"%"]})})():Ot.type==="weight"?(()=>{let St=e||[],Et=[],ma=ya=>{for(let Lt of ya)Et.push(Lt),Lt.subtasks?.length&&ma(Lt.subtasks);};ma(St);let Ya=Et.filter(ya=>!ya.subtasks?.length||ya.subtasks.length===0).reduce((ya,Lt)=>ya+(Lt.weight||0),0),fa=Math.abs(Ya-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",fa?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ya.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ma.length===0&&ve&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&he&&jsxRuntime.jsx(Gg,{data:_.data,isDark:H,locale:d,onClose:()=>Je(false),lens:t?.lens})]}),jsxRuntime.jsx(Tg,{state:ct,onClose:oe,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ta,onColumnSort:ta,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),S&&Ge&&$&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ge.x+12,top:Ge.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=De.flattenTasks(e).find(xe=>xe.id===$);return se?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:H?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${H?"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:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:H?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsxRuntime.jsx(Og,{isOpen:ke,onClose:()=>xt(false),onSave:Gt,isDark:H,locale:d})]})}var Jg=[{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}],Qg=[{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"}],Zg=[{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 ic={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},lc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},dc={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"},qi={dark:ic,light:lc,neutral:dc};function e0(e){return qi[e]||qi.dark}var cc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},uc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Yi={en:cc,es:uc};function Ns(e){return Yi[e]||Yi.en}function Xi(e,t){let a=Ns(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function t0(e){let t=Ns(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function a0(e,t=0,a=true){let r=Ns(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ss(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function mc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function n0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var l0=26,mw=22,gw=10;function s0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function gc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function d0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function i0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?gc(c.effortMinutes,n,i):null,f=p?d0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*l0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function c0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:E,onDiscardTimer:I,blurFinancials:D=false,suppressDetailModal:X=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:Y="en",customTranslations:Z,showBacklog:Se=true}=t,R=Xi(Y,Z),_=F==="dark"||F==="neutral",[he,Je]=react.useState(r||new Date),[z,re]=react.useState(null),[J,Pe]=react.useState(null),[ve,We]=react.useState(null),[Re,st]=react.useState({}),ee=3,it=3,le=react.useCallback(W=>{Pe(W.id),X||re(W),h?.(W.id);},[X,h]),[ot,yt]=react.useState(null),Pt=react.useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),ke=react.useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),xt=react.useCallback(()=>{Je(new Date);},[]),ct=react.useMemo(()=>{let W=he.getFullYear(),te=he.getMonth(),Ge=new Date(W,te,1),Te=new Date(W,te+1,0),Ue=Ge.getDay(),Ne=Te.getDate(),Ve=Ss(e),Tt=new Date;Tt.setHours(0,0,0,0);let gt=[],nt=Ue,et=new Date(W,te,0).getDate();for(let At=nt-1;At>=0;At--){let vt=new Date(W,te-1,et-At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}for(let At=1;At<=Ne;At++){let vt=new Date(W,te,At),Dt=vt.getTime()===Tt.getTime();gt.push({date:vt,isCurrentMonth:true,isToday:Dt,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(ft=>mc(vt,ft)).map(ft=>({id:ft.id,title:ft.name,start:ft.startDate,end:ft.endDate,task:ft}))});}let qt=42-gt.length;for(let At=1;At<=qt;At++){let vt=new Date(W,te+1,At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}return gt},[he,e]),rt=react.useMemo(()=>Ss(e).filter(W=>!W.startDate||!W.endDate),[e]),$=react.useMemo(()=>{let W=Ss(e),te=0,Ge=0,Te=0,Ue=0,Ne=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(Ge+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Te+=et.scheduleVariance,Ue++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ve=Ge>0?Math.min(100,Math.round(te/Ge*100)):0,Tt=Ue>0?Math.round(Te/Ue):0,nt=`${Ne<0?"-":"+"}${i0(Ne,O,H)}`;return {budgetUtil:Ve,avgVariance:Tt,costDisplay:nt,hasCostData:Ge>0}},[e,O,H]),de=react.useMemo(()=>{let W=[0,0,0,0,0,0];return ct.forEach((te,Ge)=>{let Te=Math.floor(Ge/7);te.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Ne=new Date(Ue.task.startDate),Ve=te.date;Ne.getFullYear()===Ve.getFullYear()&&Ne.getMonth()===Ve.getMonth()&&Ne.getDate()===Ve.getDate()&&Te<W.length&&(W[Te]-=Ue.task.soldEffortMinutes);}});}),W},[ct]),S=react.useMemo(()=>{let W=Ss(e),te=new Map,Ge=new Set,Te=[0,0,0,0,0,0];if(ct.length===0)return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te};let Ue=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=Ue(ct[0].date),Ve=Ue(ct[ct.length-1].date),Tt=[];for(let nt of W){if(!nt.startDate||!nt.endDate)continue;let et=Ue(nt.startDate),qt=Ue(nt.endDate);if(et.getTime()===qt.getTime()||qt<Ne||et>Ve)continue;let At=et<Ne?Ne:et,vt=qt>Ve?Ve:qt,Dt=s0(At,Ne),ft=s0(vt,Ne);Dt<0||Dt>41||ft<0||ft>41||Dt!==ft&&(Ge.add(nt.id),Tt.push({task:nt,startIdx:Dt,endIdx:ft}));}Tt.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let gt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:qt}of Tt){let At=Math.floor(et/7),vt=Math.floor(qt/7),Dt=Ue(nt.startDate),ft=Ue(nt.endDate),Wt=false;for(let Oe=At;Oe<=vt;Oe++){let Le=Oe===At?et%7:0,ut=Oe===vt?qt%7:6,ne=ut-Le+1,fe=0,L=gt[Oe]??[];for(gt[Oe]||(gt[Oe]=L);fe<L.length&&(L[fe]??-1)>=Le;)fe++;if(fe>=gw){Wt=true;break}fe>=L.length?L.push(ut):L[fe]=ut,Te[Oe]=Math.max(Te[Oe]??0,fe+1);let j=Oe===At&&Dt>=Ne,K=Oe===vt&&ft<=Ve,me=Oe*7+Le,Me={taskId:nt.id,task:nt,rowIndex:Oe,startCol:Le,endCol:ut,spanCols:ne,lane:fe,isStart:j,isEnd:K};te.has(me)||te.set(me,[]),te.get(me).push(Me);}Wt&&(Ge.delete(nt.id),te.forEach((Oe,Le)=>{let ut=Oe.filter(ne=>ne.taskId!==nt.id);ut.length===0?te.delete(Le):te.set(Le,ut);}));}return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te}},[ct,e]),q=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=he.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ce=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Ce}),jsxRuntime.jsx("button",{onClick:ke,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Pe(null),children:ct.map((W,te)=>{let Ge=te%7===6,Te=te>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ge&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(te/7),Ne=(S.maxLanesPerRow[Ue]??0)*l0,Ve=S.segmentsByCell.get(te);return Ne===0&&!Ve?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ve?.map(Tt=>jsxRuntime.jsx(fw,{segment:Tt,isDark:_,blurFinancials:D,isSelected:J===Tt.taskId,t:R,lens:O,hourlyRate:H,onClick:()=>{le(Tt.task),a.onEventClick?.({id:Tt.task.id,title:Tt.task.name,start:Tt.task.startDate,end:Tt.task.endDate,task:Tt.task});}},Tt.taskId))})})(),(()=>{let Ue=W.events.filter(Ne=>Ne.task.isMilestone&&!S.multiDayTaskIds.has(Ne.id));return Ue.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Ne=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ve=>{Ve.stopPropagation(),le(Ne.task);}},Ne.id)),Ue.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];W.events.forEach(Ve=>{Ve.task.blockers?.forEach(Tt=>{(Tt.severity==="warning"||Tt.severity==="critical")&&Ue.push({taskId:Ve.id,type:Tt.type,severity:Tt.severity,variance:Ve.task.scheduleVariance});});});let Ne=Ue[0];return Ne?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=W.events.filter(gt=>!S.multiDayTaskIds.has(gt.id)),Ne=Re[te]||ee,Ve=Ue.slice(0,Ne),Tt=Ue.length-Ne;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ve.map(gt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{le(gt.task),a.onEventClick?.(gt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",gt.task.progress===100||gt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?gt.task.progress===100||gt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:gt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",gt.task.isMilestone?_?"text-amber-400":"text-amber-600":gt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:gt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:gt.title})]},gt.id)),Tt>0&&jsxRuntime.jsxs("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:Ne+it}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",Tt," ",Y==="es"?"m\xE1s":"more"]}),Ne>ee&&Ue.length>ee&&jsxRuntime.jsx("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=te>=28,Ne=te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ve=>{Ve.stopPropagation(),yt(ot===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ot===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",ot===te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot===te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Xo,{onSubmit:Ve=>{a.onTaskCreate?.({name:Ve.name,startDate:Ve.startDate||W.date,endDate:Ve.endDate||W.date,priority:Ve.priority,assignees:Ve.assignee?[Ve.assignee]:void 0}),yt(null);},onCancel:()=>yt(null),availableUsers:t.availableUsers,isDark:_,locale:Y==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let Ue=Math.floor(te/7),Ne=de[Ue];if(!Ne||Ne===0)return null;let Ve=i0(Ne,O,H);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Ne<0?"-":"+",Ve]})})()]},te)})})})]}),Se&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:rt.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:rt.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):rt.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{le(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",D&&"blur-sm select-none"),children:[gc(W.effortMinutes,O,H)&&jsxRuntime.jsxs("span",{children:[R.labels.estimate,": ",gc(W.effortMinutes,O,H)]}),(()=>{let te=d0(W,O,H);return te?jsxRuntime.jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(n0,{task:W,isDark:_})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,Ge)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Ge))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),$.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",D&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${$.budgetUtil}%`,background:$.budgetUtil>90?"#EF4444":$.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",R.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!X&&jsxRuntime.jsx(fo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:F==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ss(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:E,onTimerDiscard:I,blurFinancials:D}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>We(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>We(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ve.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{We(null),le(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(n0,{task:W.task,isDark:_}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var fc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},bc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},hc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Zi={dark:fc,light:bc,neutral:hc};function u0(e){return Zi[e]||Zi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),m=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,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:u("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:d.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:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.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:[d.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:m.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:m.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var m0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ms(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 Fs(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 g0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function f0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...m0,...n}),[n]),[l,m]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),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:u("history-timeline",c.compact&&"compact",i),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:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Fs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((w,C)=>{let N=l.has(w.id),T=s===w.id,k=g0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Fs(w.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),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&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ms(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},v)),w.metadata&&Object.keys(w.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(w.metadata).map(([v,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function h0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Fs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Ms(d)}),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:d&&d.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:g=>i(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:Ms(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.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(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function yc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function xc(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 y0(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 x0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function v0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[m,d]=react.useState([]),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(1),[C,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=react.useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),k=react.useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),Y=(O.clientX-F.left-C.x)/b,Z=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(R=>R.id===p?{...R,x:Y,y:Z,fx:Y,fy:Z}:R));},[p,b,C]),v=react.useCallback(()=>{g(null);},[]),E=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),I=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),D=react.useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),X=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:yc(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[y0(O)," ",xc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=D(typeof O.source=="string"?O.source:O.source.id),F=D(typeof O.target=="string"?O.target:O.target.id),Y=x0(O.type),Z=h===O.id,Se=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:yc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Y=>T(O.id,Y),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Y=>E(O,Y),children:[jsxRuntime.jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),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 C0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,m]=react.useState(null),[d,p]=react.useState(null),g=react.useRef(null),y=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?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!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>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:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.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:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vc={"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 Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ps(e){return `$${e.toFixed(4)}`}var wc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},sn=new wc;function D0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(sn.getStats()),[s,n]=react.useState(sn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(sn.getStats()),n(sn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=sn.getRecentOperations(5);return jsxRuntime.jsxs(Xt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ps(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.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:Ps(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 M0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[m,d]=react.useState(""),[p,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(null),C=react.useRef(null),N=p||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let I=D=>{D.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(i(""),l(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),w(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),w({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Xt,{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:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:N,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:[b?.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% 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:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((I,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:I.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:n,onChange:I=>i(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),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:I=>l(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),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:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,D)=>jsxRuntime.jsx("button",{onClick:()=>i(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function al({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Ws(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(I=>I.id===h);if(!C)return w;let N=C.columnId,T={...C,columnId:f,position:b},k=w.cards.map(I=>I.id===h?T:I),v=w.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(D=>D!==h)};if(I.id===f){let D=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:D.map(X=>X.id)}}return I}),E={...w,cards:k,columns:v};return o(E),E});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:w};return o(C),C});},[o]),i=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,w],columns:C};return o(N),N});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:w,columns:C};return o(N),N});},[o]),l=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),m=react.useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:w};return o(C),C});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),w=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),p=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function P0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=al({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var As={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},L0={by:"none",order:"asc"};function I0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...As,...e}),[s,n]=react.useState({...L0,...t}),i=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),l=react.useCallback(()=>{o(As),n(L0);},[]),m=react.useCallback(()=>{a&&o({...As,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...As,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...As,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${w}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");v=`${E}-${I}-${D}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(v+"T00:00:00"),D=new Date(E);return D.setDate(D.getDate()+7),I>=E&&I<=D;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;w=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],v=T[b.priority||"LOW"];w=k-v;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let D=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();w=D-X;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var R0,O0;if(typeof window<"u")try{let e=Hs("ai");R0=e.generateObject,O0=e.generateText;}catch{}function $0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(R0&&O0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{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: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Cc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function H0(e){let{cards:t}=e,[a,r]=Cc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,E)=>v.position-E.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,N]=b<w?[b,w]:[w,b],T=f.slice(C,N+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var z0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function U0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...z0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(N);});}),w.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(v=>v.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,D)=>I+D.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var W0=react.createContext(null);function G0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Hs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Hs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Hs("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(W0.Provider,{value:{store:o},children:e})}function rl(){let e=react.useContext(W0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Is(){let e=rl(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),l=react.useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),p=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=Is();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function _0(e="position",t="asc"){let{cards:a}=Is();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ol=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Vw=new ol;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:p,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Y0(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 J0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Q0(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 Z0(e,t=10){return e>t}var Sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ec={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Pc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ac={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Lc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ic={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)"},Bc={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)"},Rc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Oc={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}},$c={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}},nl={spacing:Sc,borderRadius:Ec,fontSize:Mc,fontWeight:Fc,lineHeight:Pc,zIndex:Ac,duration:Lc,easing:Ic,shadows:Bc,opacity:Rc,kanban:Oc,gantt:$c};function ef(e,t,a){return e[t]??a}function Hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zc(e="asakaa"){let t=Hc(nl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Am(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function vo(e,t){let a=Am(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}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},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Rd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Lm(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 Im(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=vo(t,l),p=Bd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=vo(t,l),p=Rd(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=vo(t,l),p=Od(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=vo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=vo(t,l),p=vo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=vo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Bm(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 r2(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 o2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Bi(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Bi(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:r2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rm(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:o2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Om(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Bi(r,e,t))}var $d={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"}},Hd={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"}},Ri={en:$d,es:Hd};function zd(e){return Ri[e]||Ri.en}function Oi(e,t){let a=zd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Ud=[{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 $m(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 Hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=$m(e),l=Ud[0],m=Ud.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch($m(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsxRuntime.jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ud.map(g=>{let y=g.icon;return jsxRuntime.jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(y,{className:u("w-4 h-4",g.color)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Wd=[{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 Um({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Wd.find(m=>m.value===e)??Wd[4],l=r==="es"?"es":"en";return o||!t?jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxRuntime.jsxs("div",{ref:i,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Flag,{className:u("w-4 h-4",c.color)}),jsxRuntime.jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(m=>jsxRuntime.jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsxRuntime.jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function xs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Vd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),d=react.useRef(null);react.useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),react.useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:xs(x.name),color:x.color||Gd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>3&&jsxRuntime.jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxRuntime.jsxs("div",{ref:m,className:"relative",children:[jsxRuntime.jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxRuntime.jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsxRuntime.jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>2&&jsxRuntime.jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxRuntime.jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsxRuntime.jsx(lucideReact.Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsxRuntime.jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxRuntime.jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsxRuntime.jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsxRuntime.jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)}),x.name.split(" ")[0],jsxRuntime.jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsxRuntime.jsx(lucideReact.X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsxRuntime.jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsxRuntime.jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxRuntime.jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.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:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsxRuntime.jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):xs(x.name)}),jsxRuntime.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&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"}})})]},x.id)})})]})]})}function Km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=react.useState(false),[d,p]=react.useState(o),[g,y]=react.useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=react.useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;react.useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),react.useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=react.useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),E=new Date(k,v,1),D=new Date(k,v+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,v,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,v-1,F-Z),isCurrentMonth:false});for(let Z=1;Z<=D;Z++)O.push({date:new Date(k,v,Z),isCurrentMonth:true});let Y=42-O.length;for(let Z=1;Z<=Y;Z++)O.push({date:new Date(k,v+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),p("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),m(false);}},N=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let D=new Date(k);D.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let k=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxRuntime.jsxs("div",{ref:x,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:k=>{k.stopPropagation(),m(!l);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxRuntime.jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,v)=>jsxRuntime.jsxs("button",{className:u("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:()=>C(k.date),children:[jsxRuntime.jsx("span",{children:k.label}),jsxRuntime.jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsxRuntime.jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("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:n==="es"?"Quitar fecha":"Clear date"}),jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxRuntime.jsxs("div",{className:"p-4",children:[!r&&jsxRuntime.jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsxRuntime.jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsxRuntime.jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsxRuntime.jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsxRuntime.jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),D=f?.toDateString()===k.date.toDateString(),X=I||D,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsxRuntime.jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",D&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function zi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsxRuntime.jsx(Km,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function $n(e=600){let[t,a]=react.useState(false),r=react.useRef(null),o=react.useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return react.useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ui(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=react.useState(e),[i,c]=react.useState(false),l=react.useRef(e),m=react.useRef([]);return react.useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=react.useState(null),[n,i]=react.useState(0),c=react.useRef(null),l=react.useRef(null),m=react.useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=react.useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return react.useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Xm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=react.useState(false),[c,l]=react.useState(""),m=react.useRef(null),{isFlashing:d,triggerFlash:p}=$n(),{displayValue:g,isAnimating:y}=Ui(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&p());},h=react.useCallback(C=>{r||!t||(C.stopPropagation(),l(String(e)),i(true));},[r,t,e]);react.useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=react.useCallback(()=>{i(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=react.useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&i(false);},[f]),w=g??e;return jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsxRuntime.jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsxRuntime.jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsxRuntime.jsx("input",{ref:m,value:c,onChange:C=>l(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsxRuntime.jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxRuntime.jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=react.useState(false),[i,c]=react.useState(e),l=react.useRef(null);react.useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),react.useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsxRuntime.jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsxRuntime.jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function ag({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=react.useState(false),[d,p]=react.useState(e?.toString()||""),g=react.useRef(null),{isFlashing:y,triggerFlash:x}=$n(),{displayValue:h,isAnimating:f}=Ui(e,{enabled:i&&!l});react.useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),react.useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsxRuntime.jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsxRuntime.jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(a?"text-white/30":"text-gray-400"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function rg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=react.useState(false),c=react.useRef(null);return react.useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsxRuntime.jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsxRuntime.jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsxRuntime.jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxRuntime.jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function ng({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxRuntime.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxRuntime.jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsxRuntime.jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsxRuntime.jsx(lucideReact.X,{className:"w-3 h-3"})})]})}function lg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsxRuntime.jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxRuntime.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsxRuntime.jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxRuntime.jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function W2(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function G2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=react.useState(false),[p,g]=react.useState(""),y=react.useRef(null),{isFlashing:x,triggerFlash:h}=$n(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:W2(e,r);react.useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),react.useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let w=()=>{let T=G2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsxRuntime.jsx(lucideReact.Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let N=f?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(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsxRuntime.jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxRuntime.jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsxRuntime.jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:"truncate font-mono",children:b})]})}function pg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="es";return a===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:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsxRuntime.jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function gg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=Z=>m?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[p,g]=react.useState(false),[y,x]=react.useState(false),[h,f]=react.useState(null),b=react.useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,E=v>100?Math.round((w-C)/60*10)/10:0,I=v>100?"#EF4444":"#00E5CC";react.useEffect(()=>{if(!y&&!h)return;let Z=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let D=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Se)=>{h==="log"&&r&&Z?r(e,Z,Se):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},H=r||o||s||n,F=[{mode:"log",icon:lucideReact.Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:lucideReact.Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:lucideReact.DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),Y=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&w===0&&N===0?jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:F.map(Z=>jsxRuntime.jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxRuntime.jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(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:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxRuntime.jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxRuntime.jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," ",l?"Excedido":"Over"]})]}),C>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(v,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),H&&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:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:y&&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:F.map(Z=>jsxRuntime.jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsxRuntime.jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function X2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function J2(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 fg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsxRuntime.jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsxRuntime.jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function bg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=X2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsxRuntime.jsx(fg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxRuntime.jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?J2(i):null;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(fg,{assignee:s,size:28,isDark:t}),jsxRuntime.jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxRuntime.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Q2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function yg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsxRuntime.jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsxRuntime.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxRuntime.jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Tg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=react.useRef(null),b=r==="es"?wg.es:wg.en;if(react.useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},v=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),i&&(k.push({id:"status",label:b.changeStatus,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsxRuntime.jsx(lucideReact.Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],D=E.some(X=>X.name===v.name)?E.filter(X=>X.name!==v.name):[...E,{name:v.name,initials:m1(v.name),color:v.color||g1(v.name),avatar:v.avatarUrl}];i({...e.task,assignees:D}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsxRuntime.jsx(lucideReact.Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return l&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?w():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsxRuntime.jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsxRuntime.jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsxRuntime.jsx(f1,{item:k,isDark:a},k.id):jsxRuntime.jsxs("button",{onClick:k.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsxRuntime.jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function f1({item:e,isDark:t}){let[a,r]=react.useState(false),o=react.useRef();return jsxRuntime.jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxRuntime.jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsxRuntime.jsx("div",{className:u("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(i=>jsxRuntime.jsxs("button",{onClick:i.onClick,className:u("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:i.icon}),i.label]},i.id))})]})}var wg={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 Ag={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"})},A1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Ig({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=react.useState(""),[m,d]=react.useState(null),[p,g]=react.useState(null),y=react.useRef(null),x=i==="es"?Lg.es:Lg.en;react.useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let X=v.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),D=window.innerHeight-E.top-20;d(Math.max(300,D));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),react.useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=react.useMemo(()=>{let k=new Set([...A1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let v=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(v);},w=(k,v)=>{let E=a.find(D=>D.type===k&&(!v||D.customFieldId===v));if(E){b(E.id);return}let I={id:v||k,type:k,label:v?r.find(D=>D.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxRuntime.jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",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 ${n?"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:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsxRuntime.jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsxRuntime.jsx("input",{type:"text",value:c,onChange:k=>l(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(D=>D.type===k&&!D.customFieldId),E=v?.visible??false,I=k==="name";return jsxRuntime.jsxs("button",{onClick:()=>{I||(v?b(v.id):w(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:D=>{I||(D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k]}),jsxRuntime.jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsxRuntime.jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxRuntime.jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.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:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&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:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k.type]||jsxRuntime.jsx(lucideReact.Type,{className:"w-4 h-4"})}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Lg={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",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 U1=[{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 Og({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=react.useState(""),[i,c]=react.useState("text"),[l,m]=react.useState([""]),d=o==="es"?Rg.es:Rg.en;react.useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),react.useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==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:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsxRuntime.jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxRuntime.jsxs("div",{className:"p-6 space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsxRuntime.jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsxRuntime.jsx("div",{className:"grid grid-cols-5 gap-2",children:U1.map(h=>jsxRuntime.jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsxRuntime.jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsxRuntime.jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsxRuntime.jsx("button",{onClick:()=>x(f),className:u("p-2 rounded-lg transition-colors",r?"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"})})]},f)),jsxRuntime.jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxRuntime.jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsxRuntime.jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Rg={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 zg={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 Ug({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=react.useState(false),c=react.useRef(null),l=react.useRef(0),m=s==="es"?zg.es:zg.en;react.useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsxRuntime.jsx(lucideReact.Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxRuntime.jsxs("div",{ref:c,className:"relative",children:[jsxRuntime.jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsxRuntime.jsx(lucideReact.Filter,{className:"w-4 h-4"}),m.filters,p&&jsxRuntime.jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxRuntime.jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsxRuntime.jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsxRuntime.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxRuntime.jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsxRuntime.jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsxRuntime.jsx("div",{className:"py-1",children:jsxRuntime.jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsxRuntime.jsx(lucideReact.EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsxRuntime.jsx(lucideReact.Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Wg(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Cs(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function Gg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxRuntime.jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsxRuntime.jsx("button",{onClick:r,className:u("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:s?"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"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#F87171":"#00E5CC";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"PRESUPUESTO":"BUDGET"}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Cs(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Cs(c)})]}),l>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cs(l)})]}),i>0&&jsxRuntime.jsx("div",{className:u("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(p,100)}%`,backgroundColor:y}})}),jsxRuntime.jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm 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:[m>=0?`+${Cs(m)} ${s?"Disp.":"Avail."}`:`${Cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#F87171":l>=80?"#FFD60A":"#3BF06E";return jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Wg(i)})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsxRuntime.jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Wg(c)})]}),c>0&&jsxRuntime.jsx("div",{className:u("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:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsxRuntime.jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxRuntime.jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsxRuntime.jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsxRuntime.jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#F87171]/15 text-[#F87171]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxRuntime.jsxs("div",{className:"px-5 py-4",children:[jsxRuntime.jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsxRuntime.jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#F87171":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsxRuntime.jsx("div",{className:u("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(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var rw=[{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 Yg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yg(r.subtasks,t+1));return a}function ow(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function Gn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Gn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Wn(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function nw({value:e,onChange:t,isDark:a}){let[r,o]=react.useState(false),[s,n]=react.useState(String(e||""));return r?jsxRuntime.jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsxRuntime.jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Xg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:v="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:D=false,showProjectTotals:X=false}=t,O=Oi(d,p),H=m==="dark",F=M=>{if(!I||!M.assignees||M.assignees.length===0)return E;let se=M.assignees.map(xe=>xe.id?I[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return se.length===0?E:se.reduce((xe,Fe)=>xe+Fe,0)/se.length},Y=M=>{let se=0,xe=0,Fe=0,Ke=Qe=>{for(let ye of Qe)if(ye.subtasks&&ye.subtasks.length>0){let He={s:se,a:xe,q:Fe};if(Ke(ye.subtasks),se-He.s+(xe-He.a)+(Fe-He.q)===0){let wt=F(ye);se+=(ye.timeLoggedMinutes??0)/60*wt,xe+=(ye.effortMinutes??0)/60*wt,Fe+=(ye.soldEffortMinutes??0)/60*wt;}}else {let He=F(ye);se+=(ye.timeLoggedMinutes??0)/60*He,xe+=(ye.effortMinutes??0)/60*He,Fe+=(ye.soldEffortMinutes??0)/60*He;}};return M.subtasks&&Ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Fe}},Z=react.useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=react.useMemo(()=>{function M(se){let xe=0,Fe=0,Ke=0,Qe=0,ye=0,He=0;for(let lt of se)if(lt.subtasks&<.subtasks.length>0){let wt=M(lt.subtasks);if(wt.spent+wt.allocated+wt.quoted>0)xe+=wt.spent,Fe+=wt.allocated,Ke+=wt.quoted,Qe+=wt.dollarSpent,ye+=wt.dollarAllocated,He+=wt.dollarQuoted;else {let St=lt.timeLoggedMinutes??0,Et=lt.effortMinutes??0,ma=lt.soldEffortMinutes??0;xe+=St,Fe+=Et,Ke+=ma;let na=F(lt);Qe+=St/60*na,ye+=Et/60*na,He+=ma/60*na;}}else {let wt=lt.timeLoggedMinutes??0,Lt=lt.effortMinutes??0,St=lt.soldEffortMinutes??0;xe+=wt,Fe+=Lt,Ke+=St;let Et=F(lt);Qe+=wt/60*Et,ye+=Lt/60*Et,He+=St/60*Et;}return {spent:xe,allocated:Fe,quoted:Ke,dollarSpent:Qe,dollarAllocated:ye,dollarQuoted:He}}return M(e)},[e]),R=react.useMemo(()=>{let M=new Map;function se(xe){let Fe=0;for(let Ke of xe)if(Ke.subtasks&&Ke.subtasks.length>0){let Qe=se(Ke.subtasks);M.set(Ke.id,Qe),Fe+=Qe;}else Fe+=Ke.weight||0;return Fe}return se(e),M},[e]),_=react.useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[he,Je]=react.useState(true),[z,re]=react.useState("position"),[J,Pe]=react.useState("asc"),[ve,We]=react.useState(""),[Re,st]=react.useState(()=>Z().statusFilter),[ee,it]=react.useState(()=>Z().hideCompleted),[le,ot]=react.useState(x||rw),[yt,Pt]=react.useState(false),[ke,xt]=react.useState(false),[ct,rt]=react.useState({isOpen:false,x:0,y:0,type:"task"}),[$,de]=react.useState(null),[S,q]=react.useState(false),[ce,Ce]=react.useState(null),[W,te]=react.useState(null),[Ge,Te]=react.useState(null),Ue=react.useRef(0),Ne=react.useRef(false),Ve=!!(a.onTaskMove||a.onTaskReparent),Tt=react.useCallback((M,se)=>{Ve&&(se.preventDefault(),Ue.current=se.clientY,de(M),Ne.current=false,q(false),Te({x:se.clientX,y:se.clientY}));},[Ve]),gt=react.useCallback(M=>{if(!$||(Math.abs(M.clientY-Ue.current)>5&&!Ne.current&&(Ne.current=true,q(true)),Te({x:M.clientX,y:M.clientY}),!Ne.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Fe=null,Ke=null;xe.forEach(Qe=>{let ye=Qe.getBoundingClientRect(),He=Qe.getAttribute("data-listview-row");if(He&&He!==$&&M.clientY>=ye.top&&M.clientY<=ye.bottom){Fe=He;let lt=M.clientY-ye.top,wt=ye.height;Ke=lt<wt*.25?"above":lt>wt*.75?"below":"child";}}),Ce(Fe),te(Ke);},[$]),nt=react.useCallback(()=>{if(Ne.current&&$&&ce&&W){if(W==="child"&&a.onTaskReparent)a.onTaskReparent($,ce);else if(W==="above"||W==="below"){let M=(Fe,Ke,Qe=null)=>{for(let ye of Fe){if(ye.id===Ke)return Qe;if(ye.subtasks){let He=M(ye.subtasks,Ke,ye.id);if(He!==void 0)return He}}},se=M(e,$,null),xe=M(e,ce,null);if(a.onTaskReparent){let Fe=(wt,Lt)=>{if(Lt===null)return wt;for(let St of wt){if(St.id===Lt)return St.subtasks||[];if(St.subtasks){let Et=Fe(St.subtasks,Lt);if(Et.length>0||St.subtasks.some(ma=>ma.id===Lt))return Et}}return []},Ke=Fe(e,xe??null),Qe=Ke.findIndex(wt=>wt.id===ce),ye=se===xe,He=ye?Ke.findIndex(wt=>wt.id===$):-1,lt=W==="below"?Qe+1:Qe;ye&&He!==-1&&He<Qe&&(lt-=1),a.onTaskReparent($,xe??null,Math.max(0,lt));}}}de(null),Ce(null),te(null),Te(null),Ne.current=false,q(false);},[$,ce,W,e,a]);react.useEffect(()=>{if($)return document.addEventListener("mousemove",gt),document.addEventListener("mouseup",nt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",nt),document.body.style.cursor="",document.body.style.userSelect="";}},[$,gt,nt]);let[et,qt]=react.useState("all"),[At,vt]=react.useState(false),Dt=react.useRef(null),ft=react.useRef(null),Wt=react.useMemo(()=>{let M=0;function se(xe,Fe){for(let Ke of xe)Fe>M&&(M=Fe),Ke.subtasks?.length&&se(Ke.subtasks,Fe+1);}return se(e,1),M},[e]);react.useEffect(()=>{if(!At)return;let M=se=>{Dt.current?.contains(se.target)||ft.current?.contains(se.target)||vt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[At]),react.useEffect(()=>{if(et==="all"){let xe=function(Fe){for(let Ke of Fe)Ke.subtasks?.length&&(Ke.isExpanded===false&&a.onTaskToggleExpand?.(Ke.id),xe(Ke.subtasks));};xe(e);}else {let xe=function(Fe,Ke){for(let Qe of Fe)if(Qe.subtasks?.length){let ye=Ke<et,He=Qe.isExpanded!==false;ye!==He&&a.onTaskToggleExpand?.(Qe.id),xe(Qe.subtasks,Ke+1);}};xe(e,1);}},[et]);let[Oe,Le]=react.useState(null),[ut,ne]=react.useState(0),[fe,L]=react.useState(0),j=react.useRef(null),[K,me]=react.useState(null),[Me,qe]=react.useState(null);react.useEffect(()=>{x&&ot(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Fe=M[xe],Ke=x[xe];if(!Fe||!Ke||Fe.id!==Ke.id||Fe.visible!==Ke.visible||Fe.width!==Ke.width||Fe.label!==Ke.label){se=false;break}}if(se)return M}return x});},[x]),react.useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Re,hideCompleted:ee}));}catch(M){console.error("Error persisting filter state:",M);}},[N,Re,ee]);let _e=react.useMemo(()=>{let M=new Set;function se(xe){for(let Fe of xe)Fe.subtasks?.length&&(Fe.isExpanded!==false&&M.add(Fe.id),se(Fe.subtasks));}return se(e),M},[e]),Ie=react.useMemo(()=>le.filter(M=>M.visible),[le]),bt=react.useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Nt=react.useCallback(M=>{z===M?Pe(se=>se==="asc"?"desc":"asc"):(re(M),Pe("asc")),a.onSortChange?.({column:M,direction:J==="asc"?"desc":"asc"});},[z,J,a]),Ut=react.useCallback(M=>{ot(M),a.onColumnsChange?.(M);},[a]),Ta=react.useCallback(M=>{let se=le.map(xe=>xe.id===M?{...xe,visible:false}:xe);Ut(se);},[le,Ut]),ta=react.useCallback((M,se)=>{re(M),Pe(se);},[]),U=react.useCallback((M,se,xe)=>{b&&(M.preventDefault(),rt({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),oe=react.useCallback(()=>{rt(M=>({...M,isOpen:false}));},[]),$e=react.useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=le.find(Fe=>Fe.id===se);xe&&(Le(se),ne(M.clientX),L(xe.width));},[le,f]);react.useEffect(()=>{if(!Oe)return;let M=le,se=Fe=>{let Ke=Fe.clientX-ut,Qe=Math.max(50,fe+Ke);M=M.map(ye=>ye.id===Oe?{...ye,width:Qe}:ye),ot(M);},xe=()=>{a.onColumnsChange?.(M),Le(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[Oe,ut,fe,a]);let A=react.useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}me(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),ge=react.useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),me(null),qe(null);},[]),je=react.useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",qe(se));},[]),tt=react.useCallback(()=>{qe(null);},[]),oa=react.useCallback((M,se)=>{if(M.preventDefault(),!K||K===se||se==="name")return;let xe=[...le],Fe=xe.findIndex(ye=>ye.id===K),Ke=xe.findIndex(ye=>ye.id===se);if(Fe===-1||Ke===-1)return;let Qe=xe.splice(Fe,1);Qe[0]&&(xe.splice(Ke,0,Qe[0]),Ut(xe),me(null),qe(null));},[K,le,Ut]),Gt=react.useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}xt(false);},[a]),Na=react.useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Ma=react.useMemo(()=>{let M=Yg(e);if(ve.trim()){let se=ve.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return Re!=="all"&&(M=M.filter(se=>Na(se)===Re)),ee&&(M=M.filter(se=>Na(se)!=="completed")),M.sort((se,xe)=>{let Fe,Ke;switch(z){case "name":Fe=se.name.toLowerCase(),Ke=xe.name.toLowerCase();break;case "startDate":Fe=se.startDate?.getTime()||0,Ke=xe.startDate?.getTime()||0;break;case "endDate":Fe=se.endDate?.getTime()||0,Ke=xe.endDate?.getTime()||0;break;case "progress":Fe=se.progress||0,Ke=xe.progress||0;break;case "status":Fe=se.status||"todo",Ke=xe.status||"todo";break;case "priority":let Qe={urgent:0,high:1,medium:2,low:3,none:4};Fe=Qe[se.priority]??4,Ke=Qe[xe.priority]??4;break;case "position":return 0;default:return 0}return Fe<Ke?J==="asc"?-1:1:Fe>Ke?J==="asc"?1:-1:0}),M},[e,ve,Re,ee,z,J,Na]),Ga=react.useCallback((M,se)=>{let xe=Qe=>{a.onTaskUpdate?.({...M,...Qe});},Fe=Qe=>Qe?M.customFields?.find(He=>He.fieldId===Qe)?.value:void 0,Ke=(Qe,ye)=>{if(!Qe)return;let lt=[...M.customFields||[]],wt=lt.findIndex(Lt=>Lt.fieldId===Qe);wt>=0?lt[wt]={fieldId:Qe,value:ye}:lt.push({fieldId:Qe,value:ye}),xe({customFields:lt});};switch(se.type){case "name":return null;case "status":return jsxRuntime.jsx(Hm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:ye=>{xe({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsxRuntime.jsx(Um,{value:M.priority,onChange:ye=>xe({priority:ye}),isDark:H,locale:d});case "assignees":{let ye=M.hasChildren,He=M.assignees||[];if(ye&&M.subtasks?.length){let lt=new Map;(M.assignees||[]).forEach(Lt=>lt.set(Lt.name,Lt));let wt=Lt=>{(Lt||[]).forEach(St=>{(St.assignees||[]).forEach(Et=>{lt.has(Et.name)||lt.set(Et.name,Et);}),St.subtasks?.length&&wt(St.subtasks);});};wt(M.subtasks),He=Array.from(lt.values());}return jsxRuntime.jsx(Vd,{value:He,availableUsers:i,onChange:lt=>xe({assignees:lt}),isDark:H,locale:d,disabled:ye})}case "startDate":return jsxRuntime.jsx(zi,{value:M.startDate,onChange:ye=>xe({startDate:ye}),isDark:H,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsxRuntime.jsx(zi,{value:M.endDate,onChange:ye=>xe({endDate:ye}),isDark:H,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let ye=!!(M.subtasks&&M.subtasks.length>0);return jsxRuntime.jsx(Xm,{value:M.progress||0,onChange:ye?void 0:He=>{let lt=He===100?"completed":He>0?"in-progress":"todo";xe({progress:He,status:lt});},isDark:H,disabled:ye})}case "tags":return jsxRuntime.jsx(lg,{value:M.tags||[],isDark:H});case "text":return jsxRuntime.jsx(Zm,{value:Fe(se.customFieldId)||"",onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "number":return jsxRuntime.jsx(ag,{value:Fe(se.customFieldId)||0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "date":let Qe=Fe(se.customFieldId);return jsxRuntime.jsx(zi,{value:Qe?new Date(Qe):void 0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H,locale:d});case "dropdown":return jsxRuntime.jsx(rg,{value:Fe(se.customFieldId)||"",options:se.options||[],onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "checkbox":return jsxRuntime.jsx(ng,{value:Fe(se.customFieldId)||false,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "estimatedTime":{let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.estimatedTime,onChange:He=>xe({estimatedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "quotedTime":{let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsxRuntime.jsx(Dr,{value:M.quotedTime,onChange:lt=>xe({quotedTime:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "elapsedTime":{let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.elapsedTime,onChange:He=>xe({elapsedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "effortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{allocated:Lt}=Gn(M);if(v==="financial"){let St=Y(M),Et=Math.round(St.dollarAllocated),ma=Math.round(St.dollarQuoted),na=ma-Et;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[Et>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Et.toLocaleString("es-CO")]}):null,na!==0&&Et>0&&ma>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",na>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[na>0?"+":"",Math.abs(na)>=1e3?`$${(na/1e3).toFixed(1)}K`:`$${na}`]})]})}return jsxRuntime.jsx(Dr,{value:Lt>0?Lt:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:E})}let ye=M.status==="completed"||M.progress===100,He=M.effortMinutes||0,lt=M.soldEffortMinutes||0,wt=F(M);if(v==="financial"&&wt&&He>0&<>0){let Lt=Math.round(He/60*wt),Et=Math.round(lt/60*wt)-Lt;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx(Dr,{value:He,onChange:ma=>xe({effortMinutes:ma}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)}),Et!==0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Et>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Et>0?"+":"",Math.abs(Et)>=1e3?`$${(Et/1e3).toFixed(1)}K`:`$${Et}`]})]})}return jsxRuntime.jsx(Dr,{value:He,onChange:Lt=>xe({effortMinutes:Lt}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{spent:He}=Gn(M);return jsxRuntime.jsx(Dr,{value:He>0?He:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100;return jsxRuntime.jsx(Dr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?He=>{a.onLogTime?.(M,He);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ye,lens:v,hourlyRate:F(M)})}case "soldEffortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{quoted:lt}=Gn(M),wt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:lt>0?lt:void 0,isDark:H,locale:d,disabled:true,isBlurred:wt,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsxRuntime.jsx(Dr,{value:M.soldEffortMinutes,onChange:lt=>xe({soldEffortMinutes:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "scheduleVariance":{let ye=M.effortMinutes||0,He=M.soldEffortMinutes||0,lt=M.timeLoggedMinutes||0,wt=ye>0||He>0||lt>0;return jsxRuntime.jsx(pg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:wt})}case "hoursBar":{if(D&&M.hasChildren){let{spent:ye,allocated:He,quoted:lt}=Gn(M),wt=ye>He&&He>0;return jsxRuntime.jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsxRuntime.jsx("span",{className:u("font-bold",wt?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Wn(ye)}),He>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-white/60":"text-gray-600",children:Wn(He)})]}),lt>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[" / ",jsxRuntime.jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Wn(lt)})]})]})}return jsxRuntime.jsx(gg,{task:M,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:F(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsxRuntime.jsx(bg,{task:M,isDark:H,locale:d}):jsxRuntime.jsx(Vd,{value:M.assignees||[],availableUsers:i,onChange:He=>{a.onTaskUpdate?.({...M,assignees:He});},isDark:H,locale:d});case "blockers":return jsxRuntime.jsx(yg,{blockers:M.blockers,isDark:H,locale:d});case "weight":{let ye=R.get(M.id);if(ye!==void 0)return jsxRuntime.jsx("span",{className:u("text-xs font-mono",ye>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?`${Number(ye.toFixed(2))}%`:"\u2014"});let He=M.weight||0;return jsxRuntime.jsx(nw,{value:He,onChange:lt=>xe({weight:lt}),isDark:H})}default:return jsxRuntime.jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,D,R]),ha=react.useCallback(M=>{let xe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),nr=react.useMemo(()=>{let xe=Ie.reduce((Ke,Qe)=>Ke+Qe.width,0)+(h?48:0),Fe={};for(let Ke of Ie)Fe[Ke.id]=`${Ke.width/xe*100}%`;return Fe},[Ie,h]);return r?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.List,{className:"w-8 h-8 text-[#007BFF]"})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsxRuntime.jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxRuntime.jsxs("div",{ref:j,className:u(H?"bg-[#0D0D0D]":"bg-white",Oe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ma.length," ",O.pagination.tasks]}),g&&jsxRuntime.jsxs("div",{className:"relative flex-1 max-w-md",children:[jsxRuntime.jsx(lucideReact.Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsxRuntime.jsx("input",{type:"text",value:ve,onChange:M=>We(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"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"}),l&&jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:l}),y&&Wt>1&&jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("button",{ref:Dt,onClick:()=>vt(!At),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?At?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":At?"bg-blue-50 border-blue-300 text-blue-600":"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"}),et==="all"?d==="es"?"Todos":"All":`L${et}`]}),At&&jsxRuntime.jsx("div",{ref:ft,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Wt,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxRuntime.jsxs("button",{onClick:()=>{qt(M.value),vt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?et===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":et===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsxRuntime.jsx("span",{children:M.label}),et===M.value&&jsxRuntime.jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsxRuntime.jsx(Ug,{value:Re,hideCompleted:ee,onChange:st,onHideCompletedChange:it,isDark:H,locale:d}),_?.enabled&&_.data&&!he&&jsxRuntime.jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"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:d==="es"?"Abrir panel de salud":"Open health panel",children:jsxRuntime.jsx(lucideReact.PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&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, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{children:O.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:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(M=>{let se=M.id!=="name",xe=Me===M.id&&K!==M.id;return jsxRuntime.jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",se&&"cursor-grab",M.type!=="name"&&"justify-center",K===M.id&&"opacity-50",xe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:nr[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Fe=>A(Fe,M.id):void 0,onDragEnd:se?ge:void 0,onDragOver:se?Fe=>je(Fe,M.id):void 0,onDragLeave:se?tt:void 0,onDrop:se?Fe=>oa(Fe,M.id):void 0,onContextMenu:Fe=>U(Fe,void 0,M.id),children:[se&&jsxRuntime.jsx(lucideReact.GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxRuntime.jsxs("button",{draggable:false,onClick:()=>Nt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ha(M),jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:u("w-3 h-3",z===M.id&&"text-[#007BFF]")})]}):jsxRuntime.jsx("span",{draggable:false,children:ha(M)}),f&&M.resizable&&jsxRuntime.jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Oe===M.id&&"bg-[#007BFF]"),onMouseDown:Fe=>$e(Fe,M.id)})]},M.id)}),h&&jsxRuntime.jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsxRuntime.jsx("button",{onClick:M=>{M.stopPropagation(),Pt(se=>!se);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",yt&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3 h-3"})}),jsxRuntime.jsx(Ig,{isOpen:yt,onClose:()=>Pt(false),columns:le,customFields:c,onColumnsChange:Ut,onCreateCustomField:()=>{Pt(false),xt(true);},isDark:H,locale:d})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"popLayout",children:Ma.map((M,se)=>{let xe=_e.has(M.id),Fe=Math.min(se*.01,.2),Ke=M.hasChildren&&M.level===0,Qe=M.subtasks?.length||0;if(Ke){let{spent:St,allocated:Et,quoted:ma}=Gn(M),na=ow(M);return jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Va=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Va.type!=="name"&&"justify-center"),style:{width:nr[Va.id],minWidth:Va.minWidth},children:Va.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsxRuntime.jsx("button",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsxRuntime.jsx("span",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsxRuntime.jsx(lucideReact.FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsxRuntime.jsx(lucideReact.Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsxRuntime.jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:H?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0",children:[jsxRuntime.jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",H?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono",H?"text-white/30":"text-gray-500"),children:["(",Qe," ",d==="es"?Qe===1?"Tarea":"Tareas":Qe===1?"Item":"Items",")"]}),na!==null&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",na>=1?"text-[#32D74B] bg-[#32D74B]/10":na>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",na.toFixed(2)]})]})]}):Va.type==="timeLoggedMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarSpent);return ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:St>0?St:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Va.type==="soldEffortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarQuoted);return ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsxRuntime.jsx(Dr,{value:ma>0?ma:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Va.type==="effortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarAllocated),It=Math.round(fa.dollarQuoted),xr=It-ya;return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[ya>0?jsxRuntime.jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("es-CO")]}):null,xr!==0&&ya>0&&It>0&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})})():jsxRuntime.jsx(Dr,{value:Et>0?Et:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ga(M,Va)},Va.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let ye=$===M.id,He=ce===M.id,lt=He&&W==="above",wt=He&&W==="below",Lt=He&&W==="child";return jsxRuntime.jsxs(framerMotion.motion.div,{"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-b transition-colors relative group",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),style:{opacity:ye?.4:1,backgroundColor:Lt?H?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Lt?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>U(St,M),children:[lt&&jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),wt&&jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Ve&&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:St=>Tt(M.id,St),style:{color:H?"#888":"#999"},children:jsxRuntime.jsx(lucideReact.GripVertical,{className:"w-3 h-3"})}),Ie.map(St=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",St.type!=="name"&&"justify-center"),style:{width:nr[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsxRuntime.jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsxRuntime.jsx("button",{onClick:Et=>{Et.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsxRuntime.jsx(lucideReact.ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsxRuntime.jsx("span",{className:u("truncate text-[13px]",M.hasChildren?"font-semibold":"font-medium",M.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Ga(M,St)},St.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&Ma.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Se,Fe=se-M,Ke=Fe<0,Qe=Ke?`+${Wn(Math.abs(Fe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Wn(Fe)} ${d==="es"?"AHORRADO":"SAVED"}`,ye=v==="financial"&&E>0,He=(Lt,St)=>{if(ye){let Et=St??Lt/60*E;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Wn(Lt)},lt=ye?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,wt=ye?`${Ke?"+":"-"}$${lt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Qe;return jsxRuntime.jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ve&&jsxRuntime.jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Lt=>jsxRuntime.jsx("div",{className:u("flex items-center px-4 py-3",Lt.type!=="name"&&"justify-center"),style:{width:nr[Lt.id],minWidth:Lt.minWidth},children:Lt.type==="name"?jsxRuntime.jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Lt.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:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(M,ye?Se.dollarSpent:void 0)}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,ye?Se.dollarAllocated:void 0)})]}),se>0&&jsxRuntime.jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye?wt:Qe})]}):Lt.type==="soldEffortMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?He(xe,ye?Se.dollarQuoted:void 0):"\u2013"}):Lt.type==="effortMinutes"?(()=>{if(ye&&xe>0&&se>0){let St=Math.round(Se.dollarQuoted),Et=Math.round(Se.dollarAllocated),ma=St-Et,na=St>0?Math.round(ma/St*100):0;return jsxRuntime.jsxs("div",{className:"flex flex-col items-center",children:[jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,Se.dollarAllocated)}),jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ma>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ma>=0?"+":"",Math.abs(ma)>=1e3?`$${(ma/1e3).toFixed(1)}K`:`$${ma}`,jsxRuntime.jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?He(se,ye?Se.dollarAllocated:void 0):"\u2013"})})():Lt.type==="timeLoggedMinutes"?jsxRuntime.jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?He(M,ye?Se.dollarSpent:void 0):"\u2013"}):Lt.type==="progress"?(()=>{let St=e||[],Et=[],ma=It=>{for(let xr of It)xr.subtasks&&xr.subtasks.length>0?ma(xr.subtasks):Et.push({progress:xr.progress||0,weight:xr.weight||0});};ma(St);let na=0,Va=0,fa=0;for(let It of Et)It.weight>0&&(na+=It.progress*It.weight,Va+=It.weight),fa+=It.progress;let ya=Va>0?Math.round(na/Va*10)/10:Et.length>0?Math.round(fa/Et.length):0;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ya,"%"]})})():Lt.type==="weight"?(()=>{let St=e||[],Et=[],ma=ya=>{for(let It of ya)Et.push(It),It.subtasks?.length&&ma(It.subtasks);};ma(St);let Va=Et.filter(ya=>!ya.subtasks?.length||ya.subtasks.length===0).reduce((ya,It)=>ya+(It.weight||0),0),fa=Math.abs(Va-100)<.1;return jsxRuntime.jsxs("span",{className:u("text-[12px] font-bold font-mono",fa?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Va.toFixed(1)),"%"]})})():jsxRuntime.jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Lt.id)),h&&jsxRuntime.jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ma.length===0&&ve&&jsxRuntime.jsx("div",{className:"flex items-center justify-center py-12",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx(lucideReact.List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsxRuntime.jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&he&&jsxRuntime.jsx(Gg,{data:_.data,isDark:H,locale:d,onClose:()=>Je(false),lens:t?.lens})]}),jsxRuntime.jsx(Tg,{state:ct,onClose:oe,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ta,onColumnSort:ta,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),S&&Ge&&$&&reactDom.createPortal(jsxRuntime.jsx("div",{style:{position:"fixed",left:Ge.x+12,top:Ge.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=De.flattenTasks(e).find(xe=>xe.id===$);return se?jsxRuntime.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:H?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${H?"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:"#2E94FF"}}),jsxRuntime.jsx("span",{className:"text-xs font-medium",style:{color:H?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsxRuntime.jsx(Og,{isOpen:ke,onClose:()=>xt(false),onSave:Gt,isDark:H,locale:d})]})}var Jg=[{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}],Qg=[{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"}],Zg=[{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 ic={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},lc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},dc={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"},qi={dark:ic,light:lc,neutral:dc};function e0(e){return qi[e]||qi.dark}var cc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},uc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Yi={en:cc,es:uc};function Ns(e){return Yi[e]||Yi.en}function Xi(e,t){let a=Ns(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function t0(e){let t=Ns(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function a0(e,t=0,a=true){let r=Ns(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ss(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function mc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function n0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsxRuntime.jsx(lucideReact.PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsxRuntime.jsx(lucideReact.Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var l0=26,mw=22,gw=10;function s0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function gc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function d0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function i0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?gc(c.effortMinutes,n,i):null,f=p?d0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*l0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxRuntime.jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsxRuntime.jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxRuntime.jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-white/15",children:"|"}),jsxRuntime.jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxRuntime.jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function c0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:E,onDiscardTimer:I,blurFinancials:D=false,suppressDetailModal:X=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:Y="en",customTranslations:Z,showBacklog:Se=true}=t,R=Xi(Y,Z),_=F==="dark"||F==="neutral",[he,Je]=react.useState(r||new Date),[z,re]=react.useState(null),[J,Pe]=react.useState(null),[ve,We]=react.useState(null),[Re,st]=react.useState({}),ee=3,it=3,le=react.useCallback(W=>{Pe(W.id),X||re(W),h?.(W.id);},[X,h]),[ot,yt]=react.useState(null),Pt=react.useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),ke=react.useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),xt=react.useCallback(()=>{Je(new Date);},[]),ct=react.useMemo(()=>{let W=he.getFullYear(),te=he.getMonth(),Ge=new Date(W,te,1),Te=new Date(W,te+1,0),Ue=Ge.getDay(),Ne=Te.getDate(),Ve=Ss(e),Tt=new Date;Tt.setHours(0,0,0,0);let gt=[],nt=Ue,et=new Date(W,te,0).getDate();for(let At=nt-1;At>=0;At--){let vt=new Date(W,te-1,et-At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}for(let At=1;At<=Ne;At++){let vt=new Date(W,te,At),Dt=vt.getTime()===Tt.getTime();gt.push({date:vt,isCurrentMonth:true,isToday:Dt,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(ft=>mc(vt,ft)).map(ft=>({id:ft.id,title:ft.name,start:ft.startDate,end:ft.endDate,task:ft}))});}let qt=42-gt.length;for(let At=1;At<=qt;At++){let vt=new Date(W,te+1,At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}return gt},[he,e]),rt=react.useMemo(()=>Ss(e).filter(W=>!W.startDate||!W.endDate),[e]),$=react.useMemo(()=>{let W=Ss(e),te=0,Ge=0,Te=0,Ue=0,Ne=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(Ge+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Te+=et.scheduleVariance,Ue++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ve=Ge>0?Math.min(100,Math.round(te/Ge*100)):0,Tt=Ue>0?Math.round(Te/Ue):0,nt=`${Ne<0?"-":"+"}${i0(Ne,O,H)}`;return {budgetUtil:Ve,avgVariance:Tt,costDisplay:nt,hasCostData:Ge>0}},[e,O,H]),de=react.useMemo(()=>{let W=[0,0,0,0,0,0];return ct.forEach((te,Ge)=>{let Te=Math.floor(Ge/7);te.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Ne=new Date(Ue.task.startDate),Ve=te.date;Ne.getFullYear()===Ve.getFullYear()&&Ne.getMonth()===Ve.getMonth()&&Ne.getDate()===Ve.getDate()&&Te<W.length&&(W[Te]-=Ue.task.soldEffortMinutes);}});}),W},[ct]),S=react.useMemo(()=>{let W=Ss(e),te=new Map,Ge=new Set,Te=[0,0,0,0,0,0];if(ct.length===0)return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te};let Ue=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=Ue(ct[0].date),Ve=Ue(ct[ct.length-1].date),Tt=[];for(let nt of W){if(!nt.startDate||!nt.endDate)continue;let et=Ue(nt.startDate),qt=Ue(nt.endDate);if(et.getTime()===qt.getTime()||qt<Ne||et>Ve)continue;let At=et<Ne?Ne:et,vt=qt>Ve?Ve:qt,Dt=s0(At,Ne),ft=s0(vt,Ne);Dt<0||Dt>41||ft<0||ft>41||Dt!==ft&&(Ge.add(nt.id),Tt.push({task:nt,startIdx:Dt,endIdx:ft}));}Tt.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let gt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:qt}of Tt){let At=Math.floor(et/7),vt=Math.floor(qt/7),Dt=Ue(nt.startDate),ft=Ue(nt.endDate),Wt=false;for(let Oe=At;Oe<=vt;Oe++){let Le=Oe===At?et%7:0,ut=Oe===vt?qt%7:6,ne=ut-Le+1,fe=0,L=gt[Oe]??[];for(gt[Oe]||(gt[Oe]=L);fe<L.length&&(L[fe]??-1)>=Le;)fe++;if(fe>=gw){Wt=true;break}fe>=L.length?L.push(ut):L[fe]=ut,Te[Oe]=Math.max(Te[Oe]??0,fe+1);let j=Oe===At&&Dt>=Ne,K=Oe===vt&&ft<=Ve,me=Oe*7+Le,Me={taskId:nt.id,task:nt,rowIndex:Oe,startCol:Le,endCol:ut,spanCols:ne,lane:fe,isStart:j,isEnd:K};te.has(me)||te.set(me,[]),te.get(me).push(Me);}Wt&&(Ge.delete(nt.id),te.forEach((Oe,Le)=>{let ut=Oe.filter(ne=>ne.taskId!==nt.id);ut.length===0?te.delete(Le):te.set(Le,ut);}));}return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te}},[ct,e]),q=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=he.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ce=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsxRuntime.jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxRuntime.jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsxRuntime.jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsxRuntime.jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsxRuntime.jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxRuntime.jsxs("div",{className:"text-center max-w-md",children:[jsxRuntime.jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsxRuntime.jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsxRuntime.jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxRuntime.jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:i,children:[jsxRuntime.jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxRuntime.jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxRuntime.jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsxRuntime.jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsxRuntime.jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Ce}),jsxRuntime.jsx("button",{onClick:ke,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t.toolbarRightContent,jsxRuntime.jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsxRuntime.jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsxRuntime.jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsxRuntime.jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:jsxRuntime.jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Pe(null),children:ct.map((W,te)=>{let Ge=te%7===6,Te=te>=35;return jsxRuntime.jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ge&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsxRuntime.jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(te/7),Ne=(S.maxLanesPerRow[Ue]??0)*l0,Ve=S.segmentsByCell.get(te);return Ne===0&&!Ve?null:jsxRuntime.jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ve?.map(Tt=>jsxRuntime.jsx(fw,{segment:Tt,isDark:_,blurFinancials:D,isSelected:J===Tt.taskId,t:R,lens:O,hourlyRate:H,onClick:()=>{le(Tt.task),a.onEventClick?.({id:Tt.task.id,title:Tt.task.name,start:Tt.task.startDate,end:Tt.task.endDate,task:Tt.task});}},Tt.taskId))})})(),(()=>{let Ue=W.events.filter(Ne=>Ne.task.isMilestone&&!S.multiDayTaskIds.has(Ne.id));return Ue.length===0?null:jsxRuntime.jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Ne=>jsxRuntime.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ve=>{Ve.stopPropagation(),le(Ne.task);}},Ne.id)),Ue.length>4&&jsxRuntime.jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];W.events.forEach(Ve=>{Ve.task.blockers?.forEach(Tt=>{(Tt.severity==="warning"||Tt.severity==="critical")&&Ue.push({taskId:Ve.id,type:Tt.type,severity:Tt.severity,variance:Ve.task.scheduleVariance});});});let Ne=Ue[0];return Ne?jsxRuntime.jsx("div",{className:"mt-0.5 px-0.5",children:jsxRuntime.jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsxRuntime.jsx("span",{children:"\u26A0"}),jsxRuntime.jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=W.events.filter(gt=>!S.multiDayTaskIds.has(gt.id)),Ne=Re[te]||ee,Ve=Ue.slice(0,Ne),Tt=Ue.length-Ne;return jsxRuntime.jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ve.map(gt=>jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>{le(gt.task),a.onEventClick?.(gt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",gt.task.progress===100||gt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?gt.task.progress===100||gt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:gt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsxRuntime.jsx("span",{className:u("flex-shrink-0 text-[9px]",gt.task.isMilestone?_?"text-amber-400":"text-amber-600":gt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:gt.task.isMilestone?"\u25C6":"\u25CF"}),jsxRuntime.jsx("span",{className:"truncate flex-1",children:gt.title})]},gt.id)),Tt>0&&jsxRuntime.jsxs("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:Ne+it}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",Tt," ",Y==="es"?"m\xE1s":"more"]}),Ne>ee&&Ue.length>ee&&jsxRuntime.jsx("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsxRuntime.jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=te>=28,Ne=te%7>=5;return jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("button",{onClick:Ve=>{Ve.stopPropagation(),yt(ot===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ot===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsxRuntime.jsx(lucideReact.Plus,{className:u("w-3.5 h-3.5 transition-transform",ot===te&&"rotate-45")})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ot===te&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(null)}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsxRuntime.jsx(Xo,{onSubmit:Ve=>{a.onTaskCreate?.({name:Ve.name,startDate:Ve.startDate||W.date,endDate:Ve.endDate||W.date,priority:Ve.priority,assignees:Ve.assignee?[Ve.assignee]:void 0}),yt(null);},onCancel:()=>yt(null),availableUsers:t.availableUsers,isDark:_,locale:Y==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let Ue=Math.floor(te/7),Ne=de[Ue];if(!Ne||Ne===0)return null;let Ve=i0(Ne,O,H);return jsxRuntime.jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Ne<0?"-":"+",Ve]})})()]},te)})})})]}),Se&&jsxRuntime.jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:rt.length})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:rt.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsxRuntime.jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsxRuntime.jsx(lucideReact.Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsxRuntime.jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):rt.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{le(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxRuntime.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsxRuntime.jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsxRuntime.jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsxRuntime.jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxRuntime.jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxRuntime.jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",D&&"blur-sm select-none"),children:[gc(W.effortMinutes,O,H)&&jsxRuntime.jsxs("span",{children:[R.labels.estimate,": ",gc(W.effortMinutes,O,H)]}),(()=>{let te=d0(W,O,H);return te?jsxRuntime.jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsxRuntime.jsx(lucideReact.Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsxRuntime.jsx(n0,{task:W,isDark:_})]}),W.assignees&&W.assignees.length>0&&jsxRuntime.jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,Ge)=>jsxRuntime.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Ge))})]})]},W.id))}),a.onTaskCreate&&jsxRuntime.jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsxRuntime.jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),$.hasCostData&&jsxRuntime.jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxRuntime.jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsxRuntime.jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxRuntime.jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",D&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsxRuntime.jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${$.budgetUtil}%`,background:$.budgetUtil>90?"#EF4444":$.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxRuntime.jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",R.labels.days]})]}),jsxRuntime.jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsxRuntime.jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsxRuntime.jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!X&&jsxRuntime.jsx(fo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:F==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ss(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:E,onTimerDiscard:I,blurFinancials:D}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:ve&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>We(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxRuntime.jsxs(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxRuntime.jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsxRuntime.jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsxRuntime.jsx("button",{onClick:()=>We(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsxRuntime.jsx(lucideReact.X,{className:"w-4 h-4"})})]}),jsxRuntime.jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ve.events.map(W=>jsxRuntime.jsxs("button",{onClick:()=>{We(null),le(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsxRuntime.jsx(n0,{task:W.task,isDark:_}),jsxRuntime.jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsxRuntime.jsx(lucideReact.Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var fc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},bc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},hc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Zi={dark:fc,light:bc,neutral:hc};function u0(e){return Zi[e]||Zi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=react.useState(false),m=react.useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=react.useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxRuntime.jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:p,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:u("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:d.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:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.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:[d.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:m.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:m.map(g=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsxRuntime.jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsxRuntime.jsx("h4",{children:g.title}),g.description&&jsxRuntime.jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var m0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ms(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 Fs(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 g0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function f0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=react.useMemo(()=>({...m0,...n}),[n]),[l,m]=react.useState(new Set),d=react.useRef(null),p=react.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=react.useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=react.useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return react.useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxRuntime.jsxs("div",{className:u("history-timeline-empty",i),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:u("history-timeline",c.compact&&"compact",i),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:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxRuntime.jsxs("option",{value:b,children:[Fs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),g.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:b.events.map((w,C)=>{let N=l.has(w.id),T=s===w.id,k=g0(w.type);return jsxRuntime.jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Fs(w.type)})}),C<b.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),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&&w.userAvatar&&jsxRuntime.jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:Ms(w)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},v)),w.metadata&&Object.keys(w.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(w.metadata).map(([v,E])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function h0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=react.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=react.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:u("history-replay-empty",l),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:u("history-replay",l),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Fs(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&Ms(d)}),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:d&&d.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:g=>i(parseInt(g.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsxRuntime.jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:Ms(g)},g.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxRuntime.jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.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(g=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxRuntime.jsxs("div",{className:u("history-replay-start",l),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function yc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function xc(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 y0(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 x0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function v0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=react.useRef(null),[m,d]=react.useState([]),[p,g]=react.useState(null),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(1),[C,N]=react.useState({x:0,y:0});react.useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=react.useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),k=react.useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),Y=(O.clientX-F.left-C.x)/b,Z=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(R=>R.id===p?{...R,x:Y,y:Z,fx:Y,fy:Z}:R));},[p,b,C]),v=react.useCallback(()=>{g(null);},[]),E=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),I=react.useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),D=react.useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),X=react.useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:u("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:u("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:n.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:yc(O)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[y0(O)," ",xc(O)]})]},O))}),jsxRuntime.jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxRuntime.jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=D(typeof O.source=="string"?O.source:O.source.id),F=D(typeof O.target=="string"?O.target:O.target.id),Y=x0(O.type),Z=h===O.id,Se=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsxRuntime.jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:yc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsxRuntime.jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xc(O.type)})]},O.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxRuntime.jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Y=>T(O.id,Y),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Y=>E(O,Y),children:[jsxRuntime.jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?1:.9}),a.showLabels&&jsxRuntime.jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),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 C0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=react.useState(""),[i,c]=react.useState(false),[l,m]=react.useState(null),[d,p]=react.useState(null),g=react.useRef(null),y=i||o;react.useEffect(()=>{e&&g.current&&g.current.focus();},[e]),react.useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxRuntime.jsxs(Xt,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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:b=>b.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?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!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>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:b.title}),b.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.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:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsxRuntime.jsx("button",{onClick:()=>n(b),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:b},w))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:h,disabled:!s.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vc={"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 Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ps(e){return `$${e.toFixed(4)}`}var wc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},sn=new wc;function D0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=react.useState(sn.getStats()),[s,n]=react.useState(sn.checkLimit(a));if(react.useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(sn.getStats()),n(sn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),react.useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=sn.getRecentOperations(5);return jsxRuntime.jsxs(Xt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ps(r.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:[l," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(m)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.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:Ps(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 M0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=react.useState(""),[c,l]=react.useState(""),[m,d]=react.useState(""),[p,g]=react.useState(false),[y,x]=react.useState(null),[h,f]=react.useState(null),[b,w]=react.useState(null),C=react.useRef(null),N=p||o;react.useEffect(()=>{e&&C.current&&C.current.focus();},[e]),react.useEffect(()=>{let I=D=>{D.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(i(""),l(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),w(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),w({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Xt,{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:I=>I.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:T,disabled:N,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:[b?.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"}),b?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% 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:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((I,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:I.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),I.start," \u2192 ",I.end]}),jsxRuntime.jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:C,value:n,onChange:I=>i(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),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:I=>l(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),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:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((I,D)=>jsxRuntime.jsx("button",{onClick:()=>i(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},D))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:N&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsxRuntime.jsx("button",{onClick:v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function al({initialBoard:e,onPersist:t}){let[a,r]=react.useState(e),o=react.useCallback(h=>{t&&Ws(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=react.useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(I=>I.id===h);if(!C)return w;let N=C.columnId,T={...C,columnId:f,position:b},k=w.cards.map(I=>I.id===h?T:I),v=w.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(D=>D!==h)};if(I.id===f){let D=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:D.map(X=>X.id)}}return I}),E={...w,cards:k,columns:v};return o(E),E});},[o]),n=react.useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:w};return o(C),C});},[o]),i=react.useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,w],columns:C};return o(N),N});},[o]),c=react.useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:w,columns:C};return o(N),N});},[o]),l=react.useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),m=react.useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:w};return o(C),C});},[o]),d=react.useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),w=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),p=react.useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=react.useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=react.useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function P0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=al({initialBoard:e,onPersist:a}),n=react.useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:react.useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var As={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},L0={by:"none",order:"asc"};function I0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=react.useState({...As,...e}),[s,n]=react.useState({...L0,...t}),i=react.useCallback(x=>{o(h=>({...h,...x}));},[]),c=react.useCallback(x=>{n(h=>({...h,...x}));},[]),l=react.useCallback(()=>{o(As),n(L0);},[]),m=react.useCallback(()=>{a&&o({...As,assignees:[a]});},[a]),d=react.useCallback(()=>{o({...As,dateFilter:"overdue"});},[]),p=react.useCallback(()=>{o({...As,priorities:["HIGH","URGENT"]});},[]),g=react.useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=react.useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${w}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");v=`${E}-${I}-${D}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(v+"T00:00:00"),D=new Date(E);return D.setDate(D.getDate()+7),I>=E&&I<=D;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;w=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],v=T[b.priority||"LOW"];w=k-v;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let D=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();w=D-X;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var R0,O0;if(typeof window<"u")try{let e=Hs("ai");R0=e.generateObject,O0=e.generateText;}catch{}function $0(e={}){let[t,a]=react.useState(false),[r,o]=react.useState(null),s=!!(R0&&O0&&e.apiKey),n=react.useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{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: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=react.useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Cc(){let[e,t]=react.useState(()=>core.selectionStore.getState());react.useEffect(()=>core.selectionStore.subscribe(o=>{t(o);}),[]);let a=react.useCallback(r=>{core.selectionStore.setState(r);},[]);return [e,a]}function H0(e){let{cards:t}=e,[a,r]=Cc(),o=react.useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=react.useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,E)=>v.position-E.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,N]=b<w?[b,w]:[w,b],T=f.slice(C,N+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=react.useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=react.useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=react.useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=react.useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=react.useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var z0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function U0(e){let{cards:t,config:a,aiService:r}=e,o=react.useMemo(()=>({...z0,...a}),[a]),[s,n]=react.useState([]),i=react.useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=react.useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=react.useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=react.useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=react.useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=react.useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=react.useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(N);});}),w.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(v=>v.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,D)=>I+D.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=react.useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return react.useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var W0=react.createContext(null);function G0({children:e,initialData:t,onStateChange:a}){let r=react.useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Hs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Hs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Hs("@libxai/core");i=new c(t.board);}r.current=new core.BoardStore({board:i,columns:s,cards:n});}let o=r.current;return react.useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsxRuntime.jsx(W0.Provider,{value:{store:o},children:e})}function rl(){let e=react.useContext(W0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Is(){let e=rl(),[t,a]=react.useState(e.getBoard()),[r,o]=react.useState(e.getAllColumns()),[s,n]=react.useState(e.getAllCards());react.useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=react.useCallback(b=>{e.updateBoard(b);},[e]),c=react.useCallback(b=>{e.addColumn(b);},[e]),l=react.useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=react.useCallback(b=>{e.deleteColumn(b);},[e]),d=react.useCallback(b=>e.getColumn(b),[e]),p=react.useCallback(b=>{e.addCard(b);},[e]),g=react.useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=react.useCallback(b=>{e.deleteCard(b);},[e]),x=react.useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=react.useCallback(b=>e.getCard(b),[e]),f=react.useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=Is();return react.useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function _0(e="position",t="asc"){let{cards:a}=Is();return react.useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ol=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Vw=new ol;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=react.useRef(null),m=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:l,style:p,className:o,children:jsxRuntime.jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsxRuntime.jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Y0(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 J0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=react.useRef(null),d=reactVirtual.useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:m,style:g,className:s,children:jsxRuntime.jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Q0(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 Z0(e,t=10){return e>t}var Sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ec={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Pc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ac={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Lc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ic={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)"},Bc={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)"},Rc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Oc={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}},$c={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}},nl={spacing:Sc,borderRadius:Ec,fontSize:Mc,fontWeight:Fc,lineHeight:Pc,zIndex:Ac,duration:Lc,easing:Ic,shadows:Bc,opacity:Rc,kanban:Oc,gantt:$c};function ef(e,t,a){return e[t]??a}function Hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zc(e="asakaa"){let t=Hc(nl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
416
|
}`}function Bs(e,t="asakaa"){let a=[],r=Hc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|