@libxai/board 1.5.32 → 1.5.33
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.d.cts +0 -6742
- package/dist/index.d.ts +0 -6742
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${M?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:rt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",M?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((N,j)=>{let xe=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,Le=typeof j.createdAt=="string"?new Date(j.createdAt):j.createdAt;return xe.getTime()-Le.getTime()}).map(N=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",M?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:Ve(N.createdAt)})]}),jsx("div",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Lu,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(j=>{let xe=j.type.startsWith("image/");return jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsx(Image,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",M?"text-white":"text-gray-900"),children:j.name})]},j.id)})})]})]},N.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",M?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",M?"border-white/10":"border-gray-200"),children:jsx(Au,{value:Me,onChange:Ke,onSubmit:X$1,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:st,onFilesSelect:A,onRemoveFile:K})})]})]})]})})}function Dl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:v,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,timerState:L,onLogTime:$,onUpdateEstimate:E,onUpdateSoldEffort:te,onStartTimer:O,onStopTimer:H,onDiscardTimer:M,blurFinancials:J=false,sidePanel:ee,renderColumnMetrics:Re,suppressDetailModal:B=false}){let[Y,ye]=Dl(),[Ge,U]=useState(null),[oe,Z]=useState(false),Ee=useRef(null),ke=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",He=Ie==="dark"||Ie==="neutral",et=He?"dark":"",ae=useCallback((S,q)=>{t.onCardUpdate?.(S,q);},[t]),Xe=useCallback((S,q)=>{t.onColumnUpdate?.(S,{title:q});},[t]),me=useCallback(S=>{t.onColumnDelete?.(S);},[t]),at=["todo","in-progress","completed"],mt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Pt=useMemo(()=>{let S=new Map;return e.columns.forEach(q=>{let ue=q.cardIds.map(Te=>e.cards.find(W=>W.id===Te)).filter(Te=>Te!==void 0).sort((Te,W)=>Te.position-W.position);S.set(q.id,ue);}),S},[e.cards,e.columns]);useEffect(()=>{let S=Ee.current;if(!S)return;let q=re=>{let Ue=re.target,Ne=re.button===1,ze=Ue===S||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ne||re.button===0&&ze&&!Y.isDragging)&&(re.preventDefault(),Z(true),ke.current={x:re.clientX,y:re.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},ue=re=>{if(!oe)return;let Ue=re.clientX-ke.current.x,Ne=re.clientY-ke.current.y;S.scrollLeft=ke.current.scrollLeft-Ue,S.scrollTop=ke.current.scrollTop-Ne;},Te=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");},W=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",q),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Te),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Te),S.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let Ce=useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),xt=useCallback(S=>{let{active:q}=S,ue=e.cards.find(Te=>Te.id===q.id);ue&&ye({isDragging:true,draggedCardId:ue.id,sourceColumnId:ue.columnId,targetColumnId:ue.columnId});},[e.cards,ye]),nt=useCallback(S=>{let{active:q,over:ue}=S;if(!ue||!e.cards.find(re=>re.id===q.id))return;let W=null;ue.data.current?.type==="column"?W=ue.id:ue.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===ue.id)?.columnId||null),W&&W!==Y.targetColumnId&&ye({...Y,targetColumnId:W});},[e.cards,Y,ye]),Je=useCallback(async S=>{let{active:q,over:ue}=S;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ue)return;let Te=e.cards.find(Ne=>Ne.id===q.id);if(!Te)return;let W,re;if(ue.data.current?.type==="column"){W=ue.id;let Ne=Pt.get(W)||[];re=ll(Ne,0);}else {let Ne=e.cards.find(Ke=>Ke.id===ue.id);if(!Ne)return;W=Ne.columnId;let ze=Pt.get(W)||[],Me=ze.findIndex(Ke=>Ke.id===ue.id);re=ll(ze,Me);}let Ue=e.columns.find(Ne=>Ne.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ne=Pt.get(W)||[];if(Te.columnId!==W&&Ne.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Te);return}}(Te.columnId!==W||Te.position!==re)&&await t.onCardMove?.(Te.id,W,re);},[e.cards,e.columns,Pt,t,ye]),z=useCallback(S=>{B||U(S),a?.(S),v?.(S.id);},[a,v,B]),se=useCallback(S=>{t.onCardUpdate?.(S.id,S),U(S);},[t]);return c?jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsx(vh,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(iu,{themeName:Ie,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxs(DndContext,{sensors:mt,collisionDetection:closestCorners,onDragStart:xt,onDragOver:nt,onDragEnd:Je,children:[jsxs("div",{ref:Ee,className:u("asakaa-board",ee?"flex-1":"",et,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((S,q)=>S.position-q.position).map(S=>{let q=Pt.get(S.id)||[],ue=!at.includes(S.id),Te=r?.renderColumnFooter?.(S);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(nn,{column:S,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Re?(W,re)=>Re(W,re):void 0,onCardClick:z,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?me:void 0,isDeletable:ue,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},S.id)}),m]}),jsx(DragOverlay,{children:Y.draggedCardId?jsx(Jr,{card:e.cards.find(S=>S.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!B&&jsx(Zr,{task:Ge,isOpen:!!Ge,onClose:()=>U(null),onCardUpdate:se,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:E,onSoldEffortUpdate:te,onTimerStart:O,onTimerStop:H,onTimerDiscard:M,blurFinancials:J})]})}function vh({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Nh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Dh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Sh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Eh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Fh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Mh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ph({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function El({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m}){let d=r==="dark"?Nh:Dh,p={...o==="es"?Sh:Eh,...l},g=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(Mh,{theme:d,t:p,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),t&&(s?jsx(Fh,{columns:e,onSelect:t,theme:d,t:p,createTaskLabel:a}):jsx(Ph,{onClick:()=>t(),label:a||p.newTask}))]})})}function Ml({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ro({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,w]=useState(false),[v,C]=useState(false),[T,D]=useState(s||new Date),k=useRef(null),L=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{k.current?.focus();},[]);let E=useCallback(()=>{f(false),w(false),C(false);},[]),te=useCallback(()=>{l(""),d(void 0),g(null),x(null),E(),t();},[t,E]),O=useCallback(()=>{let J=c.trim();if(!J)return;let ee=a.find(B=>B.id===p),Re=y||s;e({name:J,priority:m,assignee:ee||void 0,assigneeId:p,startDate:Re,endDate:Re}),l(""),d(void 0),g(null),x(null),E(),k.current?.focus();},[c,m,p,y,s,a,e,E]),H=useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),O()),J.key==="Escape"&&te();},[O,te,c]),M=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>E(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:k,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),f(!h),w(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxs("button",{onClick:()=>{d(J.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",J.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:J=>{J.stopPropagation(),C(!v),f(false),w(false),D(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),M.toLocaleDateString(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:v&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,ee=new Date(J);ee.setDate(J.getDate()+1);let Re=new Date(J);Re.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let B=new Date(J);B.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let Y=new Date(J);Y.setDate(J.getDate()+14);let ye=new Date(J);ye.setDate(J.getDate()+28);let Ge=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:J,display:J.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:Re,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:B,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((oe,Z)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),C(false);},children:[jsx("span",{children:oe.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},Z))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:L?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J},J))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=T.getFullYear(),ee=T.getMonth(),Re=new Date(J,ee,1).getDay(),B=new Date(J,ee+1,0).getDate(),Y=new Date(J,ee,0).getDate(),ye=new Date().toDateString(),Ge=[];for(let oe=Re-1;oe>=0;oe--)Ge.push({dayNum:Y-oe,isCurrent:false,date:new Date(J,ee-1,Y-oe)});for(let oe=1;oe<=B;oe++)Ge.push({dayNum:oe,isCurrent:true,date:new Date(J,ee,oe)});let U=42-Ge.length;for(let oe=1;oe<=U;oe++)Ge.push({dayNum:oe,isCurrent:false,date:new Date(J,ee+1,oe)});return Ge.map((oe,Z)=>{let Ee=oe.date.toDateString()===ye,ke=(y||s)?.toDateString()===oe.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),C(false);},children:oe.dayNum},Z)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),w(!b),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===p)?.color||"#007FFF"},children:a.find(J=>J.id===p)?.initials||a.find(J=>J.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:L?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxs("button",{type:"button",onClick:()=>{g(J.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:J.color||"#007FFF"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:L?"Guardar":"Save"})]})]})}function Bl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let v=90,C=()=>{let T=m.current.getBoundingClientRect(),k=window.innerHeight-T.bottom<v+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),useEffect(()=>{if(!c)return;let v=C=>{let T=C.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);let w=useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Ro,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var jn=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
18
|
+
`}),jsx("div",{ref:rt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",M?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((N,j)=>{let xe=typeof N.createdAt=="string"?new Date(N.createdAt):N.createdAt,Le=typeof j.createdAt=="string"?new Date(j.createdAt):j.createdAt;return xe.getTime()-Le.getTime()}).map(N=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:N.user?.color||"#8B5CF6"},children:N.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",M?"text-white":"text-gray-900"),children:N.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:Ve(N.createdAt)})]}),jsx("div",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Lu,{content:N.content,theme:s})}),N.attachments&&N.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:N.attachments.map(j=>{let xe=j.type.startsWith("image/");return jsxs("a",{href:j.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[xe?jsx(Image,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",M?"text-white":"text-gray-900"),children:j.name})]},j.id)})})]})]},N.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",M?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",M?"border-white/10":"border-gray-200"),children:jsx(Au,{value:Me,onChange:Ke,onSubmit:X$1,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:lt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:st,onFilesSelect:A,onRemoveFile:K})})]})]})]})})}function Dl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:v,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,timerState:L,onLogTime:$,onUpdateEstimate:E,onUpdateSoldEffort:te,onStartTimer:O,onStopTimer:H,onDiscardTimer:M,blurFinancials:J=false,sidePanel:ee,renderColumnMetrics:Re,suppressDetailModal:B=false}){let[Y,ye]=Dl(),[Ge,U]=useState(null),[oe,Z]=useState(false),Ee=useRef(null),ke=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=o?.theme||"dark",He=Ie==="dark"||Ie==="neutral",et=He?"dark":"",ae=useCallback((S,q)=>{t.onCardUpdate?.(S,q);},[t]),Xe=useCallback((S,q)=>{t.onColumnUpdate?.(S,{title:q});},[t]),me=useCallback(S=>{t.onColumnDelete?.(S);},[t]),at=["todo","in-progress","completed"],mt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Pt=useMemo(()=>{let S=new Map;return e.columns.forEach(q=>{let ue=q.cardIds.map(Te=>e.cards.find(W=>W.id===Te)).filter(Te=>Te!==void 0).sort((Te,W)=>Te.position-W.position);S.set(q.id,ue);}),S},[e.cards,e.columns]);useEffect(()=>{let S=Ee.current;if(!S)return;let q=re=>{let Ue=re.target,Ne=re.button===1,ze=Ue===S||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ne||re.button===0&&ze&&!Y.isDragging)&&(re.preventDefault(),Z(true),ke.current={x:re.clientX,y:re.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},ue=re=>{if(!oe)return;let Ue=re.clientX-ke.current.x,Ne=re.clientY-ke.current.y;S.scrollLeft=ke.current.scrollLeft-Ue,S.scrollTop=ke.current.scrollTop-Ne;},Te=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");},W=()=>{oe&&(Z(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",q),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",Te),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",Te),S.removeEventListener("mouseleave",W);}},[oe,Y.isDragging]);let Ce=useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),xt=useCallback(S=>{let{active:q}=S,ue=e.cards.find(Te=>Te.id===q.id);ue&&ye({isDragging:true,draggedCardId:ue.id,sourceColumnId:ue.columnId,targetColumnId:ue.columnId});},[e.cards,ye]),nt=useCallback(S=>{let{active:q,over:ue}=S;if(!ue||!e.cards.find(re=>re.id===q.id))return;let W=null;ue.data.current?.type==="column"?W=ue.id:ue.data.current?.type==="card"&&(W=e.cards.find(Ue=>Ue.id===ue.id)?.columnId||null),W&&W!==Y.targetColumnId&&ye({...Y,targetColumnId:W});},[e.cards,Y,ye]),Je=useCallback(async S=>{let{active:q,over:ue}=S;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ue)return;let Te=e.cards.find(Ne=>Ne.id===q.id);if(!Te)return;let W,re;if(ue.data.current?.type==="column"){W=ue.id;let Ne=Pt.get(W)||[];re=ll(Ne,0);}else {let Ne=e.cards.find(Ke=>Ke.id===ue.id);if(!Ne)return;W=Ne.columnId;let ze=Pt.get(W)||[],Me=ze.findIndex(Ke=>Ke.id===ue.id);re=ll(ze,Me);}let Ue=e.columns.find(Ne=>Ne.id===W);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ne=Pt.get(W)||[];if(Te.columnId!==W&&Ne.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Te);return}}(Te.columnId!==W||Te.position!==re)&&await t.onCardMove?.(Te.id,W,re);},[e.cards,e.columns,Pt,t,ye]),z=useCallback(S=>{B||U(S),a?.(S),v?.(S.id);},[a,v,B]),se=useCallback(S=>{t.onCardUpdate?.(S.id,S),U(S);},[t]);return c?jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsx(vh,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",et,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(iu,{themeName:Ie,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ee?"flex-row":""),children:[jsxs(DndContext,{sensors:mt,collisionDetection:closestCorners,onDragStart:xt,onDragOver:nt,onDragEnd:Je,children:[jsxs("div",{ref:Ee,className:u("asakaa-board",ee?"flex-1":"",et,n),style:{...i,cursor:oe?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((S,q)=>S.position-q.position).map(S=>{let q=Pt.get(S.id)||[],ue=!at.includes(S.id),Te=r?.renderColumnFooter?.(S);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(nn,{column:S,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Re?(W,re)=>Re(W,re):void 0,onCardClick:z,onCardUpdate:ae,onColumnRename:t.onColumnUpdate?Xe:void 0,onColumnDelete:t.onColumnDelete?me:void 0,isDeletable:ue,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},S.id)}),m]}),jsx(DragOverlay,{children:Y.draggedCardId?jsx(Jr,{card:e.cards.find(S=>S.id===Y.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ee]}),!B&&jsx(Zr,{task:Ge,isOpen:!!Ge,onClose:()=>U(null),onCardUpdate:se,theme:He?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Ge?g?.get(Ge.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:Ce,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:C,enableTimeTracking:T,timeTrackingSummary:D,timeEntries:k,isTimerRunning:L?.isRunning,timerElapsedSeconds:L?.elapsedSeconds,onTimeLog:$,onEstimateUpdate:E,onSoldEffortUpdate:te,onTimerStart:O,onTimerStop:H,onTimerDiscard:M,blurFinancials:J})]})}function vh({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Nh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Dh={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Sh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Eh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Fh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Mh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ph({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function El({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Nh:Dh,g={...o==="es"?Sh:Eh,...l},y=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Mh,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Fh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Ph,{onClick:()=>t(),label:a||g.newTask}))]})})}function Ml({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ro({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,w]=useState(false),[v,C]=useState(false),[T,D]=useState(s||new Date),k=useRef(null),L=o==="es",$=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{k.current?.focus();},[]);let E=useCallback(()=>{f(false),w(false),C(false);},[]),te=useCallback(()=>{l(""),d(void 0),g(null),x(null),E(),t();},[t,E]),O=useCallback(()=>{let J=c.trim();if(!J)return;let ee=a.find(B=>B.id===p),Re=y||s;e({name:J,priority:m,assignee:ee||void 0,assigneeId:p,startDate:Re,endDate:Re}),l(""),d(void 0),g(null),x(null),E(),k.current?.focus();},[c,m,p,y,s,a,e,E]),H=useCallback(J=>{J.key==="Enter"&&c.trim()&&(J.preventDefault(),O()),J.key==="Escape"&&te();},[O,te,c]),M=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>E(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:k,type:"text",value:c,onChange:J=>l(J.target.value),placeholder:L?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:H})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),f(!h),w(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:L?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxs("button",{onClick:()=>{d(J.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",J.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:J=>{J.stopPropagation(),C(!v),f(false),w(false),D(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),M.toLocaleDateString(L?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:v&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,ee=new Date(J);ee.setDate(J.getDate()+1);let Re=new Date(J);Re.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let B=new Date(J);B.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let Y=new Date(J);Y.setDate(J.getDate()+14);let ye=new Date(J);ye.setDate(J.getDate()+28);let Ge=L?"es-ES":"en-US";return [{label:L?"Hoy":"Today",date:J,display:J.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Ma\xF1ana":"Tomorrow",date:ee,display:ee.toLocaleDateString(Ge,{weekday:"short"}).slice(0,3)+"."},{label:L?"Este fin de semana":"This weekend",date:Re,display:L?"s\xE1b.":"sat."},{label:L?"Pr\xF3xima semana":"Next week",date:B,display:L?"lun.":"mon."},{label:L?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(Ge,{day:"numeric",month:"short"})},{label:L?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Ge,{day:"numeric",month:"short"})}].map((oe,Z)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(oe.date),C(false);},children:[jsx("span",{children:oe.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:oe.display})]},Z))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(L?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>D(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:L?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>D(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(L?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:J},J))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=T.getFullYear(),ee=T.getMonth(),Re=new Date(J,ee,1).getDay(),B=new Date(J,ee+1,0).getDate(),Y=new Date(J,ee,0).getDate(),ye=new Date().toDateString(),Ge=[];for(let oe=Re-1;oe>=0;oe--)Ge.push({dayNum:Y-oe,isCurrent:false,date:new Date(J,ee-1,Y-oe)});for(let oe=1;oe<=B;oe++)Ge.push({dayNum:oe,isCurrent:true,date:new Date(J,ee,oe)});let U=42-Ge.length;for(let oe=1;oe<=U;oe++)Ge.push({dayNum:oe,isCurrent:false,date:new Date(J,ee+1,oe)});return Ge.map((oe,Z)=>{let Ee=oe.date.toDateString()===ye,ke=(y||s)?.toDateString()===oe.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!oe.isCurrent&&(r?"text-white/20":"text-gray-300"),oe.isCurrent&&(r?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(oe.date),C(false);},children:oe.dayNum},Z)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),w(!b),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(J=>J.id===p)?.color||"#007FFF"},children:a.find(J=>J.id===p)?.initials||a.find(J=>J.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",$,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:L?"Sin asignar":"Unassigned"})]}),a.map(J=>jsxs("button",{type:"button",onClick:()=>{g(J.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===J.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:J.color||"#007FFF"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:J.name})]},J.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:L?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:L?"Guardar":"Save"})]})]})}function Bl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let v=90,C=()=>{let T=m.current.getBoundingClientRect(),k=window.innerHeight-T.bottom<v+8;x(k),g({position:"fixed",...k?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),useEffect(()=>{if(!c)return;let v=C=>{let T=C.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[c]);let w=useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("rounded-lg shadow-2xl",h?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Ro,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var jn=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
19
|
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function up(e={}){return new jn(e)}var dn=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Rl(e,t){let a=r=>jsx(dn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function $l({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[w,v]=useState("");useEffect(()=>{let k=L=>{(L.metaKey||L.ctrlKey)&&L.key===l&&(L.preventDefault(),p($=>!$)),L.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]),useEffect(()=>{d||(h("home"),y(""),b(""),v(""));},[d]);let C=useCallback(()=>{p(false);},[]),T=useCallback(k=>{let[L,$]=k.split(":");switch(L){case "create-card":h("create-card");break;case "create-card-in":b($||"");break;case "navigate":$?(a?.($),C()):h("navigate");break;case "search":r?.(g),C();break;case "priority":h("priority");break;case "set-priority":w&&$&&(o?.(w,$),C());break;case "assign":h("assign");break;case "assign-user":w&&$&&(s?.(w,$),C());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,i,c,C]),D=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return d?jsx(Wt,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${m}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&f&&D();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:T,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:T,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(L=>jsx("span",{className:"command-palette-item-label",children:L},L))})]},k.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let L=e.columns.find($=>$.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:T,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:L?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map($=>jsx("span",{className:"command-palette-item-label",children:$},$))})]},k.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:T,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function gp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
@@ -410,7 +410,7 @@ If ambiguous, ask for clarification in the message field.`;function Nm(e){return
|
|
|
410
410
|
${Dm(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 Dm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function oo(e,t){let a=Dm(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 Sd(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 Ed(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 Fd(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 Sm(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 Em(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=oo(t,l),p=Sd(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=oo(t,l),p=Ed(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=oo(t,l),p=Fd(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=oo(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=oo(t,l),p=oo(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=oo(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 Fm(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function e2(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 t2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Di(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=>Di(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:e2(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 Mm(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:t2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Pm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Di(r,e,t))}var Md={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"}},Pd={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"}},Si={en:Md,es:Pd};function Ad(e){return Si[e]||Si.en}function Ei(e,t){let a=Ad(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 Ld=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Am(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 Lm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);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=Am(e),l=Ld[0],m=Ld.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Am(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:i,className:"relative",children:[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:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&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:Ld.map(g=>{let y=g.icon;return 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:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Id=[{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 Bm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);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=Id.find(m=>m.value===e)??Id[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[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:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&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:Id.map(m=>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:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function ss(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bd(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 Hm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),d=useRef(null);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]),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:ss(x.name),color:x.color||Bd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>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&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>3&&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]})]}):jsxs("div",{ref:m,className:"relative",children:[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?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>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&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref: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&&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)=>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:[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?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)}),x.name.split(" ")[0],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:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return 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:[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?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ss(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Wm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let D=o==="start"?e:t;if(D){let k=D instanceof Date?D:new Date(D);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=k=>{x.current&&!x.current.contains(k.target)&&m(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),k=g.getMonth(),L=new Date(D,k,1),E=new Date(D,k+1,0).getDate(),te=L.getDay(),O=[],M=new Date(D,k,0).getDate();for(let ee=te-1;ee>=0;ee--)O.push({date:new Date(D,k-1,M-ee),isCurrentMonth:false});for(let ee=1;ee<=E;ee++)O.push({date:new Date(D,k,ee),isCurrentMonth:true});let J=42-O.length;for(let ee=1;ee<=J;ee++)O.push({date:new Date(D,k+1,ee),isCurrentMonth:false});return O},[g]),v=D=>{if(r)o==="start"?a(D,f||void 0):a(h||void 0,D),m(false);else if(d==="start"){let k=f&&D>f?D:f;a(D,k||void 0),p("end");}else {let k=h&&D<h?D:h;a(k||void 0,D),m(false);}},C=()=>{let D=new Date,k=new Date(D);k.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let E=new Date(D);E.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let te=new Date(D);te.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:te,display:te.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 D=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(D)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),m(!l);let k=o==="start"?h:f;k&&y(new Date(k.getFullYear(),k.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:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),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:D=>D.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,k)=>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:()=>v(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(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:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className: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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[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"})}),jsxs("div",{className:"flex items-center gap-1",children:[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"}),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:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),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:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,k)=>{let L=D.date.toDateString()===new Date().toDateString(),$=h?.toDateString()===D.date.toDateString(),E=f?.toDateString()===D.date.toDateString(),te=$||E,O=!r&&h&&f&&D.date>=h&&D.date<=f;return jsx("button",{onClick:()=>v(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",E&&!$&&"bg-[#7C3AED] text-white",O&&!te&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!te&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},k)})})]})]})]})]})}function Pi({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 jsx(Wm,{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 Tn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ai(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),m=useRef([]);return 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 Vm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),m=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=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function _m({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=Tn(),{displayValue:g,isAnimating:y}=Ai(e,{enabled:o,duration:300,steps:6}),x=v=>{if(r||!t)return;v.stopPropagation();let C=v.currentTarget.getBoundingClientRect(),T=v.clientX-C.left,D=Math.round(T/C.width*100),k=Math.max(0,Math.min(100,D));k!==e&&(t(k),s&&p());},h=useCallback(v=>{r||!t||(v.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{i(false);let v=parseInt(c,10);if(!isNaN(v)&&t){let C=Math.max(0,Math.min(100,v));C!==e&&(t(C),s&&p());}},[c,t,e,s,p]),b=useCallback(v=>{v.key==="Enter"&&f(),v.key==="Escape"&&i(false);},[f]),w=g??e;return 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:[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:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:v=>v.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:v=>l(v.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")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):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 Ym({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),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?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?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")}):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 Jm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=Tn(),{displayValue:h,isAnimating:f}=Ai(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let v=parseFloat(d);if(!isNaN(v)){let C=v;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&x());}m(false);},w=v=>{v.key==="Enter"?b():v.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?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?jsx("input",{ref:g,type:"number",value:d,onChange:v=>p(v.target.value),onBlur:b,onKeyDown:w,onClick:v=>v.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")}):jsx("button",{onClick:v=>{v.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 Qm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return 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?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[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:[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}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&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?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>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:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function eg({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}=Vm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[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&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&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:jsx(X,{className:"w-3 h-3"})})]})}function rg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return 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 jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className: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 H2(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 z2(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 ar({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]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=Tn(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:H2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?g(`${T}h ${D}m`):T>0?g(`${T}h`):g(`${D}m`);}else g("");},[e,m]);let w=()=>{let T=z2(p);T!==e&&(t?.(T),n&&h()),d(false);},v=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),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 C=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:v,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")}):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&&jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function ig({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return 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?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):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?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function dg({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=ee=>m?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),w=e.timeLoggedMinutes||0,v=e.effortMinutes||0,C=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,D=Math.round(v/60*10)/10,k=v>0?w/v*100:0,L=k>100?Math.round((w-v)/60*10)/10:0,$=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let ee=Re=>{b.current&&!b.current.contains(Re.target)&&(x(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[y,h]);let E=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Re=>!Re),f(null);return}n&&n(e);},te=ee=>{x(false),f(ee);},O=async(ee,Re)=>{h==="log"&&r&&ee?r(e,ee,Re):h==="estimate"&&o?o(e,ee):h==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,M=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),J=h==="estimate"?v:h==="quoted"?C:void 0;return v===0&&w===0&&C===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsx("button",{onClick:E,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:M.map(ee=>jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),v>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),L>0&&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(L)," Over"]})]}),v>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsx("button",{onClick:E,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:M.map(ee=>jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function K2(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 Y2(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 cg({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?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")}):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 ug({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=K2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(cg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&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 jsxs("div",{className:"flex items-center gap-2",children:[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:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),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?Y2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(cg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&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 mg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className: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 hg({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}){let y=useRef(null),x=r==="es"?fg.es:fg.en;if(useEffect(()=>{let v=T=>{y.current&&!y.current.contains(T.target)&&t();},C=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let h=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:x.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),i&&(v.push({id:"status",label:x.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:x.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:x.inProgress,icon:jsx(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:x.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:x.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:x.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:x.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:x.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:x.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&v.push({id:"assign",label:x.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],k=T.some(L=>L.name===C.name)?T.filter(L=>L.name!==C.name):[...T,{name:C.name,initials:m1(C.name),color:C.color||g1(C.name),avatar:C.avatarUrl}];i({...e.task,assignees:k}),t();}}))})),d&&v.push({id:"log-time",label:x.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&v.push({id:"report-blocker",label:x.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&v.push({id:"copy-link",label:x.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:x.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:x.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},f=()=>{if(!e.columnId)return [];let v=[];return l&&(v.push({id:"sort-asc",label:x.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:x.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:x.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),v},b=e.type==="task"?h():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:y,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:b.map(v=>v.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},v.id):v.submenu?jsx(f1,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.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",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(v.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function f1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className: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:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&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=>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:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var fg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Dg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},P1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Eg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[m,d]=useState(null),p=useRef(null),g=i==="es"?Sg.es:Sg.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let v=()=>{if(!p.current)return;let C=p.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let C=D=>{p.current&&!p.current.contains(D.target)&&t();},T=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",T),p._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(v),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let y=v=>g.columns[v]||v,x=v=>{if(v==="name")return;let C=a.map(T=>T.id===v?{...T,visible:!T.visible}:T);o(C);},h=(v,C)=>{let T=a.find(k=>k.type===v&&(!C||k.customFieldId===C));if(T){x(T.id);return}let D={id:C||v,type:v,label:C?r.find(k=>k.id===C)?.name||v:y(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=P1.filter(v=>y(v).toLowerCase().includes(c.toLowerCase())),b=r.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:p,style:{...m?{maxHeight:`${m}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",w);},onFocus:v=>{v.currentTarget.style.borderColor=w,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(k=>k.type===v&&!k.customFieldId),T=C?.visible??false,D=v==="name";return jsxs("button",{onClick:()=>{D||(C?x(C.id):h(v));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:k=>{D||(k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v]}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(v)})]},v)})})]}),b.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:b.map(v=>{let T=a.find(D=>D.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>h(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:v.name})]},v.id)})})]})]})]})}var Sg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",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",assignees:"Asignados",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 z1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Pg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,m]=useState([""]),d=o==="es"?Mg.es:Mg.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),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?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),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})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:z1.map(h=>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:[jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),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"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[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&&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:jsx(Trash2,{className:"w-4 h-4"})})]},f)),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:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className: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}),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 Mg={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 Ig={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 Bg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),m=s==="es"?Ig.es:Ig.en;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:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[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:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&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:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),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:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),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:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Rg(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 e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Og({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&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:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),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?"#FF2D20":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:cs(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:cs(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:cs(l)})]}),i>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),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-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${cs(m)} ${s?"Disp.":"Avail."}`:`${cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&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?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Rg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Rg(c)})]}),c>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[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 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-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var aw=[{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 Vg(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(...Vg(r.subtasks,t+1));return a}function rw(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 ow(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function En(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=En(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Sn(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]=useState(false),[s,n]=useState(String(e||""));return r?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"}}):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 Gg({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:v,persistFilter:C=false,financialBlur:T,healthSidebar:D,lens:k="hours",hourlyRate:L=0,rateMap:$,aggregateParentHours:E=false,showProjectTotals:te=false}=t,O=Ei(d,p),H=m==="dark",M=P=>{if(!$||!P.assignees||P.assignees.length===0)return L;let de=P.assignees.map(fe=>fe.id?$[fe.id]:void 0).filter(fe=>fe!=null&&fe>0);return de.length===0?L:de.reduce((fe,I)=>fe+I,0)/de.length},J=useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(C);if(P){let de=JSON.parse(P);return {statusFilter:de.statusFilter||"all",hideCompleted:de.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[C]),ee=useMemo(()=>{function P(de){let fe=0,I=0,G=0;for(let ce of de)if(ce.subtasks&&ce.subtasks.length>0){let N=P(ce.subtasks);fe+=N.spent,I+=N.allocated,G+=N.quoted;}else fe+=ce.timeLoggedMinutes??0,I+=ce.effortMinutes??0,G+=ce.soldEffortMinutes??0;return {spent:fe,allocated:I,quoted:G}}return P(e)},[e]),Re=useMemo(()=>{let P=new Map;function de(fe){let I=0;for(let G of fe)if(G.subtasks&&G.subtasks.length>0){let ce=de(G.subtasks);P.set(G.id,ce),I+=ce;}else I+=G.weight||0;return I}return de(e),P},[e]),B=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:ee.spent,totalHoursAllocatedMinutes:ee.allocated}},[D,ee]),[Y,ye]=useState(true),[Ge,U]=useState("position"),[oe,Z]=useState("asc"),[Ee,ke]=useState(""),[Ie,He]=useState(()=>J().statusFilter),[et,ae]=useState(()=>J().hideCompleted),[Xe,me]=useState(x||aw),[at,mt]=useState(false),[Pt,Ce]=useState(false),[xt,nt]=useState({isOpen:false,x:0,y:0,type:"task"}),[Je,z]=useState("all"),[se,S]=useState(false),q=useRef(null),ue=useRef(null),Te=useMemo(()=>{let P=0;function de(fe,I){for(let G of fe)I>P&&(P=I),G.subtasks?.length&&de(G.subtasks,I+1);}return de(e,1),P},[e]);useEffect(()=>{if(!se)return;let P=de=>{q.current?.contains(de.target)||ue.current?.contains(de.target)||S(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[se]),useEffect(()=>{if(Je==="all"){let fe=function(I){for(let G of I)G.subtasks?.length&&(G.isExpanded===false&&a.onTaskToggleExpand?.(G.id),fe(G.subtasks));};fe(e);}else {let fe=function(I,G){for(let ce of I)if(ce.subtasks?.length){let N=G<Je,j=ce.isExpanded!==false;N!==j&&a.onTaskToggleExpand?.(ce.id),fe(ce.subtasks,G+1);}};fe(e,1);}},[Je]);let[W,re]=useState(null),[Ue,Ne]=useState(0),[ze,Me]=useState(0),Ke=useRef(null),[lt,ut]=useState(null),[st,Ze]=useState(null);useEffect(()=>{x&&me(x);},[x]),useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:Ie,hideCompleted:et}));}catch(P){console.error("Error persisting filter state:",P);}},[C,Ie,et]);let zt=useMemo(()=>{let P=new Set;function de(fe){for(let I of fe)I.subtasks?.length&&(I.isExpanded!==false&&P.add(I.id),de(I.subtasks));}return de(e),P},[e]),Ct=useMemo(()=>Xe.filter(P=>P.visible),[Xe]),ht=useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),wt=useCallback(P=>{Ge===P?Z(de=>de==="asc"?"desc":"asc"):(U(P),Z("asc")),a.onSortChange?.({column:P,direction:oe==="asc"?"desc":"asc"});},[Ge,oe,a]),rt=useCallback(P=>{me(P),a.onColumnsChange?.(P);},[a]),Lt=useCallback(P=>{let de=Xe.map(fe=>fe.id===P?{...fe,visible:false}:fe);rt(de);},[Xe,rt]),We=useCallback((P,de)=>{U(P),Z(de);},[]),Be=useCallback((P,de,fe)=>{b&&(P.preventDefault(),nt({isOpen:true,x:P.clientX,y:P.clientY,type:de?"task":"header",task:de,columnId:fe}));},[b]),pt=useCallback(()=>{nt(P=>({...P,isOpen:false}));},[]),le=useCallback((P,de)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let fe=Xe.find(I=>I.id===de);fe&&(re(de),Ne(P.clientX),Me(fe.width));},[Xe,f]);useEffect(()=>{if(!W)return;let P=fe=>{let I=fe.clientX-Ue,G=Math.max(50,ze+I),ce=Xe.map(N=>N.id===W?{...N,width:G}:N);me(ce);},de=()=>{W&&a.onColumnsChange?.(Xe),re(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",de),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",de);}},[W,Ue,ze,Xe,a]);let be=useCallback((P,de)=>{if(de==="name"){P.preventDefault();return}ut(de),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",de),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),A=useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ut(null),Ze(null);},[]),K=useCallback((P,de)=>{P.preventDefault(),de!=="name"&&(P.dataTransfer.dropEffect="move",Ze(de));},[]),X=useCallback(()=>{Ze(null);},[]),ge=useCallback((P,de)=>{if(P.preventDefault(),!lt||lt===de||de==="name")return;let fe=[...Xe],I=fe.findIndex(N=>N.id===lt),G=fe.findIndex(N=>N.id===de);if(I===-1||G===-1)return;let ce=fe.splice(I,1);ce[0]&&(fe.splice(G,0,ce[0]),rt(fe),ut(null),Ze(null));},[lt,Xe,rt]),Fe=useCallback(async P=>{if(a.onCreateCustomField){let de={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(de);}Ce(false);},[a]),Ye=useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ve=useMemo(()=>{let P=Vg(e);if(Ee.trim()){let de=Ee.toLowerCase();P=P.filter(fe=>fe.name.toLowerCase().includes(de));}return Ie!=="all"&&(P=P.filter(de=>Ye(de)===Ie)),et&&(P=P.filter(de=>Ye(de)!=="completed")),P.sort((de,fe)=>{let I,G;switch(Ge){case "name":I=de.name.toLowerCase(),G=fe.name.toLowerCase();break;case "startDate":I=de.startDate?.getTime()||0,G=fe.startDate?.getTime()||0;break;case "endDate":I=de.endDate?.getTime()||0,G=fe.endDate?.getTime()||0;break;case "progress":I=de.progress||0,G=fe.progress||0;break;case "status":I=de.status||"todo",G=fe.status||"todo";break;case "priority":let ce={urgent:0,high:1,medium:2,low:3,none:4};I=ce[de.priority]??4,G=ce[fe.priority]??4;break;case "position":return 0;default:return 0}return I<G?oe==="asc"?-1:1:I>G?oe==="asc"?1:-1:0}),P},[e,Ee,Ie,et,Ge,oe,Ye]),Oe=useCallback((P,de)=>{let fe=ce=>{a.onTaskUpdate?.({...P,...ce});},I=ce=>ce?P.customFields?.find(j=>j.fieldId===ce)?.value:void 0,G=(ce,N)=>{if(!ce)return;let xe=[...P.customFields||[]],Le=xe.findIndex(Qe=>Qe.fieldId===ce);Le>=0?xe[Le]={fieldId:ce,value:N}:xe.push({fieldId:ce,value:N}),fe({customFields:xe});};switch(de.type){case "name":return null;case "status":return jsx(Lm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:N=>{fe({status:N,progress:N==="completed"?100:N==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsx(Bm,{value:P.priority,onChange:N=>fe({priority:N}),isDark:H,locale:d});case "assignees":{let N=P.hasChildren,j=P.assignees||[];if(N&&P.subtasks?.length){let xe=new Map;(P.assignees||[]).forEach(Qe=>xe.set(Qe.name,Qe));let Le=Qe=>{(Qe||[]).forEach(tt=>{(tt.assignees||[]).forEach(vt=>{xe.has(vt.name)||xe.set(vt.name,vt);}),tt.subtasks?.length&&Le(tt.subtasks);});};Le(P.subtasks),j=Array.from(xe.values());}return jsx(Hm,{value:j,availableUsers:i,onChange:xe=>fe({assignees:xe}),isDark:H,locale:d,disabled:N})}case "startDate":return jsx(Pi,{value:P.startDate,onChange:N=>fe({startDate:N}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsx(Pi,{value:P.endDate,onChange:N=>fe({endDate:N}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":return jsx(_m,{value:P.progress||0,onChange:N=>{let j=N===100?"completed":N>0?"in-progress":"todo";fe({progress:N,status:j});},isDark:H});case "tags":return jsx(rg,{value:P.tags||[],isDark:H});case "text":return jsx(Ym,{value:I(de.customFieldId)||"",onChange:N=>G(de.customFieldId,N),isDark:H});case "number":return jsx(Jm,{value:I(de.customFieldId)||0,onChange:N=>G(de.customFieldId,N),isDark:H});case "date":let ce=I(de.customFieldId);return jsx(Pi,{value:ce?new Date(ce):void 0,onChange:N=>G(de.customFieldId,N),isDark:H,locale:d});case "dropdown":return jsx(Qm,{value:I(de.customFieldId)||"",options:de.options||[],onChange:N=>G(de.customFieldId,N),isDark:H});case "checkbox":return jsx(eg,{value:I(de.customFieldId)||false,onChange:N=>G(de.customFieldId,N),isDark:H});case "estimatedTime":{let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.estimatedTime,onChange:j=>fe({estimatedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "quotedTime":{let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(ar,{value:P.quotedTime,onChange:xe=>fe({quotedTime:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "elapsedTime":{let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.elapsedTime,onChange:j=>fe({elapsedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "effortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{allocated:Qe,quoted:tt}=En(P),vt=M(P);if(k==="financial"&&vt&&Qe>0&&tt>0){let Rt=Math.round(Qe/60*vt),Ot=Math.round(tt/60*vt)-Rt;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}),Ot!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Ot>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})}return jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=P.effortMinutes||0,xe=P.soldEffortMinutes||0,Le=M(P);if(k==="financial"&&Le&&j>0&&xe>0){let Qe=Math.round(j/60*Le),vt=Math.round(xe/60*Le)-Qe;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(ar,{value:j,onChange:Rt=>fe({effortMinutes:Rt}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)}),vt!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[vt>0?"+":"",Math.abs(vt)>=1e3?`$${(vt/1e3).toFixed(1)}K`:`$${vt}`]})]})}return jsx(ar,{value:j,onChange:Qe=>fe({effortMinutes:Qe}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "timeLoggedMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{spent:j}=En(P);return jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(P,j);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:N,lens:k,hourlyRate:M(P)})}case "soldEffortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{quoted:xe}=En(P),Le=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,isBlurred:Le,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(ar,{value:P.soldEffortMinutes,onChange:xe=>fe({soldEffortMinutes:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "scheduleVariance":{let N=P.effortMinutes||0,j=P.soldEffortMinutes||0,xe=P.timeLoggedMinutes||0,Le=N>0||j>0||xe>0;return jsx(ig,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Le})}case "hoursBar":{if(E&&P.hasChildren){let{spent:N,allocated:j,quoted:xe}=En(P),Le=N>j&&j>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Le?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Sn(N)}),j>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-white/60":"text-gray-600",children:Sn(j)})]}),xe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Sn(xe)})]})]})}return jsx(dg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:M(P)})}case "teamLoad":return jsx(ug,{task:P,isDark:H,locale:d});case "blockers":return jsx(mg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let N=Re.get(P.id);if(N!==void 0)return jsx("span",{className:u("text-xs font-mono",N>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:N>0?`${Number(N.toFixed(2))}%`:"\u2014"});let j=P.weight||0;return jsx(nw,{value:j,onChange:xe=>fe({weight:xe}),isDark:H})}default:return jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,E,Re]),bt=useCallback(P=>{let fe={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")}[P.type]||P.label;return typeof fe=="string"?fe:String(fe||P.type)},[O,d]),gt=useMemo(()=>{let fe=Ct.reduce((G,ce)=>G+ce.width,0)+(h?48:0),I={};for(let G of Ct)I[G.id]=`${G.width/fe*100}%`;return I},[Ct,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:Ke,className:u(H?"bg-[#0D0D0D]":"bg-white",W&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ve.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ee,onChange:P=>ke(P.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")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),y&&Te>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:q,onClick:()=>S(!se),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?se?"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]":se?"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:[jsx(Layers,{className:"w-3.5 h-3.5"}),Je==="all"?d==="es"?"Todos":"All":`L${Je}`]}),se&&jsx("div",{ref:ue,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(Te,5)},(P,de)=>({value:de+1,label:`L${de+1}`}))].map(P=>jsxs("button",{onClick:()=>{z(P.value),S(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?Je===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Je===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:P.label}),Je===P.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsx(Bg,{value:Ie,hideCompleted:et,onChange:He,onHideCompletedChange:ae,isDark:H,locale:d}),B?.enabled&&B.data&&!Y&&jsx("button",{onClick:()=>ye(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:jsx(PanelRight,{className:"w-4 h-4"})}),w&&v&&jsxs(motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ct.map(P=>{let de=P.id!=="name",fe=st===P.id&<!==P.id;return 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",de&&"cursor-grab",lt===P.id&&"opacity-50",fe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:gt[P.id],minWidth:P.minWidth},draggable:de,onDragStart:de?I=>be(I,P.id):void 0,onDragEnd:de?A:void 0,onDragOver:de?I=>K(I,P.id):void 0,onDragLeave:de?X:void 0,onDrop:de?I=>ge(I,P.id):void 0,onContextMenu:I=>Be(I,void 0,P.id),children:[de&&jsx(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")}),P.sortable?jsxs("button",{draggable:false,onClick:()=>wt(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[bt(P),jsx(ArrowUpDown,{className:u("w-3 h-3",Ge===P.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:bt(P)}),f&&P.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",W===P.id&&"bg-[#007BFF]"),onMouseDown:I=>le(I,P.id)})]},P.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:P=>{P.stopPropagation(),mt(de=>!de);},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",at&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Eg,{isOpen:at,onClose:()=>mt(false),columns:Xe,customFields:c,onColumnsChange:rt,onCreateCustomField:()=>{mt(false),Ce(true);},isDark:H,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ve.map((P,de)=>{let fe=zt.has(P.id),I=Math.min(de*.01,.2),G=P.hasChildren&&P.level===0,ce=P.subtasks?.length||0;if(G){let{spent:N,allocated:j,quoted:xe}=En(P),Le=rw(P),Qe=ow(P);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Ct.map(tt=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:gt[tt.id],minWidth:tt.minWidth},children:tt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:"flex-shrink-0 cursor-pointer",children:fe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ce," ",d==="es"?ce===1?"Tarea":"Tareas":ce===1?"Item":"Items",")"]}),Le!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Le>=1?"text-[#32D74B]":Le>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Le.toFixed(2)]}),Qe>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Qe]})]}):tt.type==="timeLoggedMinutes"?jsx(ar,{value:N>0?N:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="soldEffortMinutes"?jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="effortMinutes"?jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):Oe(P,tt)},tt.id))},P.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-b transition-colors",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:N=>Be(N,P),children:[Ct.map(N=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:gt[N.id],minWidth:N.minWidth},children:N.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsx("button",{onClick:j=>{j.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Oe(P,N)},N.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),te&&Ve.length>0&&(()=>{let{spent:P,allocated:de,quoted:fe}=ee,I=de-P,G=I<0,ce=G?`+${Sn(Math.abs(I))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Sn(I)} ${d==="es"?"AHORRADO":"SAVED"}`,N=k==="financial"&&L>0,j=Qe=>N?`$${(Qe/60*L).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Sn(Qe),xe=N?Math.abs(I/60*L):0,Le=N?`${G?"+":"-"}$${xe.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${G?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:ce;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",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:[Ct.map(Qe=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:gt[Qe.id],minWidth:Qe.minWidth},children:Qe.type==="name"?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"}):Qe.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(P)}),jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),de>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",G?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:N?Le:ce})]}):Qe.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?j(fe):"\u2013"}):Qe.type==="effortMinutes"?(()=>{if(N&&fe>0&&de>0){let tt=Math.round(fe/60*(L||25)),vt=Math.round(de/60*(L||25)),Rt=tt-vt,na=tt>0?Math.round(Rt/tt*100):0;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de>0?j(de):"\u2013"})})():Qe.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?j(P):"\u2013"}):Qe.type==="progress"?(()=>{let tt=e||[],vt=0,Rt=0,na=0,Ot=0;for(let cr of tt){let Ka=cr.weight||Re.get(cr.id)||0,Pn=cr.progress||0;Ka>0&&(vt+=Pn*Ka,Rt+=Ka),na+=Pn,Ot++;}let _a=Rt>0?Math.round(vt/Rt*10)/10:Ot>0?Math.round(na/Ot):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_a,"%"]})})():Qe.type==="weight"?(()=>{let tt=e||[],vt=[],Rt=cr=>{for(let Ka of cr)vt.push(Ka),Ka.subtasks?.length&&Rt(Ka.subtasks);};Rt(tt);let Ot=vt.filter(cr=>!cr.subtasks?.length||cr.subtasks.length===0).reduce((cr,Ka)=>cr+(Ka.weight||0),0),_a=Math.abs(Ot-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",_a?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ot.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Qe.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ve.length===0&&Ee&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),B?.enabled&&B.data&&Y&&jsx(Og,{data:B.data,isDark:H,locale:d,onClose:()=>ye(false),lens:t?.lens})]}),jsx(hg,{state:xt,onClose:pt,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Lt,onColumnSort:We,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(Pg,{isOpen:Pt,onClose:()=>Ce(false),onSave:Fe,isDark:H,locale:d})]})}var _g=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"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}],jg=[{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"}],Kg=[{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 Xd={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"},Jd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Qd={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"},Hi={dark:Xd,light:Jd,neutral:Qd};function Yg(e){return Hi[e]||Hi.dark}var Zd={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"}},ec={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"}},zi={en:Zd,es:ec};function ps(e){return zi[e]||zi.en}function Ui(e,t){let a=ps(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 qg(e){let t=ps(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 Xg(e,t=0,a=true){let r=ps(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 gs(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 ac(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 Zg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var a0=26,mw=22,gw=10;function e0(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 rc(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 r0(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 t0(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?rc(c.effortMinutes,n,i):null,f=p?r0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(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*a0}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&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&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&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function o0({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:v,onLogTime:C,onUpdateEstimate:T,onUpdateSoldEffort:D,onStartTimer:k,onStopTimer:L,onDiscardTimer:$,blurFinancials:E=false,suppressDetailModal:te=false,lens:O="hours",hourlyRate:H=0}){let{theme:M="dark",locale:J="en",customTranslations:ee,showBacklog:Re=true}=t,B=Ui(J,ee),Y=M==="dark"||M==="neutral",[ye,Ge]=useState(r||new Date),[U,oe]=useState(null),[Z,Ee]=useState(null),[ke,Ie]=useState(null),[He,et]=useState({}),ae=3,Xe=3,me=useCallback(W=>{Ee(W.id),te||oe(W),h?.(W.id);},[te,h]),[at,mt]=useState(null),Pt=useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),Ce=useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),xt=useCallback(()=>{Ge(new Date);},[]),nt=useMemo(()=>{let W=ye.getFullYear(),re=ye.getMonth(),Ue=new Date(W,re,1),Ne=new Date(W,re+1,0),ze=Ue.getDay(),Me=Ne.getDate(),Ke=gs(e),lt=new Date;lt.setHours(0,0,0,0);let ut=[],st=ze,Ze=new Date(W,re,0).getDate();for(let Ct=st-1;Ct>=0;Ct--){let ht=new Date(W,re-1,Ze-Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ct=1;Ct<=Me;Ct++){let ht=new Date(W,re,Ct),wt=ht.getTime()===lt.getTime();ut.push({date:ht,isCurrentMonth:true,isToday:wt,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(rt=>ac(ht,rt)).map(rt=>({id:rt.id,title:rt.name,start:rt.startDate,end:rt.endDate,task:rt}))});}let zt=42-ut.length;for(let Ct=1;Ct<=zt;Ct++){let ht=new Date(W,re+1,Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ut},[ye,e]),Je=useMemo(()=>gs(e).filter(W=>!W.startDate||!W.endDate),[e]),z=useMemo(()=>{let W=gs(e),re=0,Ue=0,Ne=0,ze=0,Me=0;W.forEach(Ze=>{Ze.effortMinutes&&(re+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Ue+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Ne+=Ze.scheduleVariance,ze++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Me+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ke=Ue>0?Math.min(100,Math.round(re/Ue*100)):0,lt=ze>0?Math.round(Ne/ze):0,st=`${Me<0?"-":"+"}${t0(Me,O,H)}`;return {budgetUtil:Ke,avgVariance:lt,costDisplay:st,hasCostData:Ue>0}},[e,O,H]),se=useMemo(()=>{let W=[0,0,0,0,0,0];return nt.forEach((re,Ue)=>{let Ne=Math.floor(Ue/7);re.events.forEach(ze=>{if(ze.task.startDate&&ze.task.soldEffortMinutes){let Me=new Date(ze.task.startDate),Ke=re.date;Me.getFullYear()===Ke.getFullYear()&&Me.getMonth()===Ke.getMonth()&&Me.getDate()===Ke.getDate()&&Ne<W.length&&(W[Ne]-=ze.task.soldEffortMinutes);}});}),W},[nt]),S=useMemo(()=>{let W=gs(e),re=new Map,Ue=new Set,Ne=[0,0,0,0,0,0];if(nt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne};let ze=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Me=ze(nt[0].date),Ke=ze(nt[nt.length-1].date),lt=[];for(let st of W){if(!st.startDate||!st.endDate)continue;let Ze=ze(st.startDate),zt=ze(st.endDate);if(Ze.getTime()===zt.getTime()||zt<Me||Ze>Ke)continue;let Ct=Ze<Me?Me:Ze,ht=zt>Ke?Ke:zt,wt=e0(Ct,Me),rt=e0(ht,Me);wt<0||wt>41||rt<0||rt>41||wt!==rt&&(Ue.add(st.id),lt.push({task:st,startIdx:wt,endIdx:rt}));}lt.sort((st,Ze)=>st.startIdx!==Ze.startIdx?st.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(st.endIdx-st.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:st,startIdx:Ze,endIdx:zt}of lt){let Ct=Math.floor(Ze/7),ht=Math.floor(zt/7),wt=ze(st.startDate),rt=ze(st.endDate),Lt=false;for(let We=Ct;We<=ht;We++){let Be=We===Ct?Ze%7:0,pt=We===ht?zt%7:6,le=pt-Be+1,be=0,A=ut[We]??[];for(ut[We]||(ut[We]=A);be<A.length&&(A[be]??-1)>=Be;)be++;if(be>=gw){Lt=true;break}be>=A.length?A.push(pt):A[be]=pt,Ne[We]=Math.max(Ne[We]??0,be+1);let K=We===Ct&&wt>=Me,X=We===ht&&rt<=Ke,ge=We*7+Be,Fe={taskId:st.id,task:st,rowIndex:We,startCol:Be,endCol:pt,spanCols:le,lane:be,isStart:K,isEnd:X};re.has(ge)||re.set(ge,[]),re.get(ge).push(Fe);}Lt&&(Ue.delete(st.id),re.forEach((We,Be)=>{let pt=We.filter(le=>le.taskId!==st.id);pt.length===0?re.delete(Be):re.set(Be,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne}},[nt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ue=ye.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ue.charAt(0).toUpperCase()+ue.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsx("p",{className:u("text-sm",Y?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",Y?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Te}),jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"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:B.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:nt.map((W,re)=>{let Ue=re%7===6,Ne=re>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?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&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let ze=Math.floor(re/7),Me=(S.maxLanesPerRow[ze]??0)*a0,Ke=S.segmentsByCell.get(re);return Me===0&&!Ke?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:Ke?.map(lt=>jsx(fw,{segment:lt,isDark:Y,blurFinancials:E,isSelected:Z===lt.taskId,t:B,lens:O,hourlyRate:H,onClick:()=>{me(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let ze=W.events.filter(Me=>Me.task.isMilestone&&!S.multiDayTaskIds.has(Me.id));return ze.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[ze.slice(0,4).map(Me=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:Ke=>{Ke.stopPropagation(),me(Me.task);}},Me.id)),ze.length>4&&jsxs("span",{className:u("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",ze.length-4]})]})})(),(()=>{let ze=[];W.events.forEach(Ke=>{Ke.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&ze.push({taskId:Ke.id,type:lt.type,severity:lt.severity,variance:Ke.task.scheduleVariance});});});let Me=ze[0];return Me?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let ze=W.events.filter(ut=>!S.multiDayTaskIds.has(ut.id)),Me=He[re]||ae,Ke=ze.slice(0,Me),lt=ze.length-Me;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ut=>jsxs(motion.button,{onClick:()=>{me(ut.task),a.onEventClick?.(ut);},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",ut.task.progress===100||ut.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?ut.task.progress===100||ut.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)"}:ut.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",ut.task.isMilestone?Y?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),lt>0&&jsxs("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:Me+Xe}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",J==="es"?"m\xE1s":"more"]}),Me>ae&&ze.length>ae&&jsx("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let ze=re>=28,Me=re%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsx(AnimatePresence,{children:at===re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsx(motion.div,{initial:{opacity:0,y:ze?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ze?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",ze?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Ro,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||W.date,endDate:Ke.endDate||W.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:Y,locale:J==="es"?"es":"en",defaultDate:W.date,dropdownDirection:ze?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let ze=Math.floor(re/7),Me=se[ze];if(!Me||Me===0)return null;let Ke=t0(Me,O,H);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Me<0?"-":"+",Ke]})})()]},re)})})})]}),Re&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxs("button",{onClick:()=>{me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(re=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",E&&"blur-sm select-none"),children:[rc(W.effortMinutes,O,H)&&jsxs("span",{children:[B.labels.estimate,": ",rc(W.effortMinutes,O,H)]}),(()=>{let re=r0(W,O,H);return re?jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(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")}),jsx(Zg,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((re,Ue)=>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:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",Y?"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="");}})}),z.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",E&&"blur-sm select-none"),children:[z.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.budgetUtil}%`,background:z.budgetUtil>90?"#EF4444":z.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.avgVariance>0?"text-emerald-400":z.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[z.avgVariance>0?"+":"",z.avgVariance," ",B.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:z.costDisplay})]})]})]})]})]}),!te&&jsx(Zr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:M==="dark"?"dark":"light",locale:J,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:U?m?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:gs(e).filter(W=>W.id!==U?.id),comments:d?.filter(W=>W.taskId===U?.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:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:T,onSoldEffortUpdate:D,onTimerStart:k,onTimerStop:L,onTimerDiscard:$,blurFinancials:E}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className: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",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:ke.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",Y?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ke.events.map(W=>jsxs("button",{onClick:()=>{Ie(null),me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Zg,{task:W.task,isDark:Y}),jsx("span",{className:u("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var oc={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)"},nc={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)"},sc={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)"},Gi={dark:oc,light:nc,neutral:sc};function n0(e){return Gi[e]||Gi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=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 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:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var i0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function bs(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 hs(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 l0(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 d0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...i0,...n}),[n]),[l,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let v=w.timestamp.toISOString().split("T")[0],C=b.get(v);C?C.push(w):b.set(v,[w]);}),Array.from(b.entries()).sort((w,v)=>v[0].localeCompare(w[0])).map(([w,v])=>({date:new Date(w),events:v.sort((C,T)=>T.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,w=new Set;return e.forEach(v=>{b.add(v.userId),w.add(v.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let v=new Set(w);return v.has(b)?v.delete(b):v.add(b),v});},h=b=>{let v=new Date().getTime()-b.getTime(),C=Math.floor(v/6e4),T=Math.floor(v/36e5),D=Math.floor(v/864e5);return C<1?"just now":C<60?`${C}m ago`:T<24?`${T}h ago`:D<7?`${D}d ago`:b.toLocaleDateString()},f=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 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?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[hs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&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:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),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&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((w,v)=>{let C=l.has(w.id),T=s===w.id,D=l0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",C&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:hs(w.type)})}),v<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:bs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([k,L])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},k)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([k,L])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function u0({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=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&hs(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&bs(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:bs(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ic(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 lc(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 p0(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 m0(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 g0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(1),[v,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),D=useCallback(O=>{if(!p||!l.current)return;let M=l.current.getBoundingClientRect(),J=(O.clientX-M.left-v.x)/b,ee=(O.clientY-M.top-v.y)/b;d(Re=>Re.map(B=>B.id===p?{...B,x:J,y:ee,fx:J,fy:ee}:B));},[p,b,v]),k=useCallback(()=>{g(null);},[]),L=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),$=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),E=useCallback(O=>{let H=m.find(M=>M.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),te=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?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ic(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[p0(O)," ",lc(O)]})]},O))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=E(typeof O.source=="string"?O.source:O.source.id),M=E(typeof O.target=="string"?O.target:O.target.id),J=m0(O.type),ee=h===O.id,Re=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Re&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>$(O,B),children:[jsx("line",{x1:H.x,y1:H.y,x2:M.x,y2:M.y,stroke:ic(O.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsx("text",{x:(H.x+M.x)/2,y:(H.y+M.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:lc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,M=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",H&&"hovered",M&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:J=>T(O.id,J),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:J=>L(O,J),children:[jsx("circle",{r:M?a.nodeSize*1.2:a.nodeSize,fill:te(O),stroke:M?"#fbbf24":"#ffffff",strokeWidth:M?3:2,opacity:H?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function h0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),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?jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>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))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&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&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange: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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>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))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick: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?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick: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 dc={"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=dc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ys(e){return `$${e.toFixed(4)}`}var cc=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)}},jo=new cc;function v0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(jo.getStats()),[s,n]=useState(jo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(jo.getStats()),n(jo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),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=jo.getRecentOperations(5);return jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ys(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function C0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(null),v=useRef(null),C=p||o;useEffect(()=>{e&&v.current&&v.current.focus();},[e]),useEffect(()=>{let $=E=>{E.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let T=()=>{C||(i(""),l(""),d(""),x(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),x(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){x($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{h&&(a(h),T());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map(($,E)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:$.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),$.start," \u2192 ",$.end]}),jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:v,value:n,onChange:$=>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:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:$=>l($.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:C})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:$=>d($.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:C})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map(($,E)=>jsx("button",{onClick:()=>i($),disabled:C,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:$},E))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:D,disabled:!n.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Ki({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&As(()=>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=useCallback(async(h,f,b)=>{r(w=>{let v=w.cards.find($=>$.id===h);if(!v)return w;let C=v.columnId,T={...v,columnId:f,position:b},D=w.cards.map($=>$.id===h?T:$),k=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(E=>E!==h)};if($.id===f){let E=D.filter(te=>te.columnId===f).sort((te,O)=>te.position-O.position);return {...$,cardIds:E.map(te=>te.id)}}return $}),L={...w,cards:D,columns:k};return o(L),L});},[o]),n=useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(C=>C.id===h?{...C,...f}:C),v={...b,cards:w};return o(v),v});},[o]),i=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},v=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),C={...b,cards:[...b.cards,w],columns:v};return o(C),C});},[o]),c=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),v=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(D=>D!==h)}:T),C={...f,cards:w,columns:v};return o(C),C});},[o]),l=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},v={...b,columns:[...b.columns,w]};return o(v),v});},[o]),m=useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(C=>C.id===h?{...C,...f}:C),v={...b,columns:w};return o(v),v});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(C=>C.columnId!==h),w=f.columns.filter(C=>C.id!==h),v={...f,cards:b,columns:w};return o(v),v});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=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 N0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ki({initialBoard:e,onPersist:a}),n=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:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var xs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},S0={by:"none",order:"asc"};function E0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...xs,...e}),[s,n]=useState({...S0,...t}),i=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(()=>{o(xs),n(S0);},[]),m=useCallback(()=>{a&&o({...xs,assignees:[a]});},[a]),d=useCallback(()=>{o({...xs,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...xs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(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"),v=String(f.getDate()).padStart(2,"0"),C=`${b}-${w}-${v}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let D=T.endDate||T.dueDate;if(!D)return false;let k;if(typeof D=="string")k=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),E=String(D.getUTCDate()).padStart(2,"0");k=`${L}-${$}-${E}`;}switch(r.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let L=new Date(C+"T00:00:00"),$=new Date(k+"T00:00:00"),E=new Date(L);return E.setDate(E.getDate()+7),$>=L&&$<=E;case "custom":if(r.dateRange){let te=typeof D=="string"?new Date(D):D;return te>=r.dateRange.start&&te<=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 v=f.createdAt?new Date(f.createdAt).getTime():0,C=b.createdAt?new Date(b.createdAt).getTime():0;w=v-C;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=T[f.priority||"LOW"],k=T[b.priority||"LOW"];w=D-k;break;case "dueDate":let L=f.endDate||f.dueDate,$=b.endDate||b.dueDate;if(!L)return 1;if(!$)return -1;let E=typeof L=="string"?new Date(L).getTime():L.getTime(),te=typeof $=="string"?new Date($).getTime():$.getTime();w=E-te;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 M0,P0;if(typeof window<"u")try{let e=Fs("ai");M0=e.generateObject,P0=e.generateText;}catch{}function A0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(M0&&P0&&e.apiKey),n=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=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=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=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=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 pc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function L0(e){let{cards:t}=e,[a,r]=pc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=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(k=>k.columnId===x.columnId).sort((k,L)=>k.position-L.position),b=f.findIndex(k=>k.id===a.lastSelectedCardId),w=f.findIndex(k=>k.id===d),[v,C]=b<w?[b,w]:[w,b],T=f.slice(v,C+1).map(k=>k.id),D=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=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 I0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function B0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...I0,...a}),[a]),[s,n]=useState([]),i=useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={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(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,v]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(v=>v!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(C);});}),b.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(C);});}),w.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(h.forEach(C=>{C.priority&&(v.has(C.priority)||v.set(C.priority,[]),v.get(C.priority).push(C));}),v.forEach((C,T)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${T} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of h){let D=(await r.findSimilar(C,h)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let k=[C.id,...D.map($=>$.card.id)],L=D.reduce(($,E)=>$+E.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:L});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,T)=>T.confidence-C.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return 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 R0=createContext(null);function O0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Fs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Fs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Fs("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(R0.Provider,{value:{store:o},children:e})}function Yi(){let e=useContext(R0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ws(){let e=Yi(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),l=useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,w,v)=>{e.moveCard(b,w,v);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=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 H0(e){let{cards:t}=ws();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function z0(e="position",t="asc"){let{cards:a}=ws();return 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 qi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Qc.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);}},Gw=new qi;function W0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),m=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 jsx("div",{ref:l,style:p,className:o,children: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 jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function V0(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _0({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=useRef(null),d=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 jsx("div",{ref:m,style:g,className:s,children: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 jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function j0(e){let t=useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function K0(e,t=10){return e>t}var bc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},hc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},yc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},xc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},wc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},kc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Cc={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)"},Tc={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)"},Nc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Dc={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}},Sc={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}},Xi={spacing:bc,borderRadius:hc,fontSize:yc,fontWeight:xc,lineHeight:vc,zIndex:wc,duration:kc,easing:Cc,shadows:Tc,opacity:Nc,kanban:Dc,gantt:Sc};function Y0(e,t,a){return e[t]??a}function Ec(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)?Ec(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 Fc(e="asakaa"){let t=Ec(Xi),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 Dm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function oo(e,t){let a=Dm(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 Sd(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 Ed(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 Fd(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 Sm(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 Em(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=oo(t,l),p=Sd(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=oo(t,l),p=Ed(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=oo(t,l),p=Fd(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=oo(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=oo(t,l),p=oo(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=oo(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 Fm(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function e2(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 t2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Di(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=>Di(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:e2(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 Mm(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:t2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Pm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Di(r,e,t))}var Md={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"}},Pd={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"}},Si={en:Md,es:Pd};function Ad(e){return Si[e]||Si.en}function Ei(e,t){let a=Ad(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 Ld=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Am(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 Lm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);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=Am(e),l=Ld[0],m=Ld.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch(Am(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:i,className:"relative",children:[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:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&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:Ld.map(g=>{let y=g.icon;return 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:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Id=[{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 Bm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);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=Id.find(m=>m.value===e)??Id[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[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:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&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:Id.map(m=>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:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function ss(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bd(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 Hm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),d=useRef(null);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]),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:ss(x.name),color:x.color||Bd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>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&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>3&&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]})]}):jsxs("div",{ref:m,className:"relative",children:[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?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>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&&Bd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref: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&&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)=>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:[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?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ss(x.name)}),x.name.split(" ")[0],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:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return 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:[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?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ss(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Wm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let D=o==="start"?e:t;if(D){let k=D instanceof Date?D:new Date(D);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let D=k=>{x.current&&!x.current.contains(k.target)&&m(false);};return l&&document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[l]),useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=D=>D?D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let D=g.getFullYear(),k=g.getMonth(),L=new Date(D,k,1),E=new Date(D,k+1,0).getDate(),te=L.getDay(),O=[],M=new Date(D,k,0).getDate();for(let ee=te-1;ee>=0;ee--)O.push({date:new Date(D,k-1,M-ee),isCurrentMonth:false});for(let ee=1;ee<=E;ee++)O.push({date:new Date(D,k,ee),isCurrentMonth:true});let J=42-O.length;for(let ee=1;ee<=J;ee++)O.push({date:new Date(D,k+1,ee),isCurrentMonth:false});return O},[g]),v=D=>{if(r)o==="start"?a(D,f||void 0):a(h||void 0,D),m(false);else if(d==="start"){let k=f&&D>f?D:f;a(D,k||void 0),p("end");}else {let k=h&&D<h?D:h;a(k||void 0,D),m(false);}},C=()=>{let D=new Date,k=new Date(D);k.setDate(D.getDate()+1);let L=new Date(D);L.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let $=new Date(D);$.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let E=new Date(D);E.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let te=new Date(D);te.setDate(D.getDate()+14);let O=new Date(D);return O.setDate(D.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:L,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:$,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:te,display:te.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 D=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(D)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:D=>{D.stopPropagation(),m(!l);let k=o==="start"?h:f;k&&y(new Date(k.getFullYear(),k.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:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),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:D=>D.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((D,k)=>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:()=>v(D.date),children:[jsx("span",{children:D.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:D.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(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:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className: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"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[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"})}),jsxs("div",{className:"flex items-center gap-1",children:[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"}),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:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),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:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((D,k)=>{let L=D.date.toDateString()===new Date().toDateString(),$=h?.toDateString()===D.date.toDateString(),E=f?.toDateString()===D.date.toDateString(),te=$||E,O=!r&&h&&f&&D.date>=h&&D.date<=f;return jsx("button",{onClick:()=>v(new Date(D.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),D.isCurrentMonth&&(s?"text-white":"text-gray-900"),L&&"ring-2 ring-[#007BFF]",$&&"bg-[#007BFF] text-white",E&&!$&&"bg-[#7C3AED] text-white",O&&!te&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!te&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:D.date.getDate()},k)})})]})]})]})]})}function Pi({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 jsx(Wm,{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 Tn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ai(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),m=useRef([]);return 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 Vm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),m=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=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function _m({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=Tn(),{displayValue:g,isAnimating:y}=Ai(e,{enabled:o,duration:300,steps:6}),x=v=>{if(r||!t)return;v.stopPropagation();let C=v.currentTarget.getBoundingClientRect(),T=v.clientX-C.left,D=Math.round(T/C.width*100),k=Math.max(0,Math.min(100,D));k!==e&&(t(k),s&&p());},h=useCallback(v=>{r||!t||(v.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{i(false);let v=parseInt(c,10);if(!isNaN(v)&&t){let C=Math.max(0,Math.min(100,v));C!==e&&(t(C),s&&p());}},[c,t,e,s,p]),b=useCallback(v=>{v.key==="Enter"&&f(),v.key==="Escape"&&i(false);},[f]),w=g??e;return 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:[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:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:v=>v.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:v=>l(v.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")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):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 Ym({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),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?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?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")}):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 Jm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=Tn(),{displayValue:h,isAnimating:f}=Ai(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let v=parseFloat(d);if(!isNaN(v)){let C=v;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),c&&x());}m(false);},w=v=>{v.key==="Enter"?b():v.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?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?jsx("input",{ref:g,type:"number",value:d,onChange:v=>p(v.target.value),onBlur:b,onKeyDown:w,onClick:v=>v.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")}):jsx("button",{onClick:v=>{v.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 Qm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return 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?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[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:[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}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&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?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>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:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function eg({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}=Vm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[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&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&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:jsx(X,{className:"w-3 h-3"})})]})}function rg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return 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 jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className: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 H2(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 z2(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 ar({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]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=Tn(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:H2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?g(`${T}h ${D}m`):T>0?g(`${T}h`):g(`${D}m`);}else g("");},[e,m]);let w=()=>{let T=z2(p);T!==e&&(t?.(T),n&&h()),d(false);},v=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),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 C=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:v,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")}):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&&jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function ig({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return 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?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:c?"En Tiempo":"On Track"}):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?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function dg({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=ee=>m?`$${Math.round(ee*c).toLocaleString("en-US")}`:`${ee}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),w=e.timeLoggedMinutes||0,v=e.effortMinutes||0,C=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,D=Math.round(v/60*10)/10,k=v>0?w/v*100:0,L=k>100?Math.round((w-v)/60*10)/10:0,$=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let ee=Re=>{b.current&&!b.current.contains(Re.target)&&(x(false),f(null));};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[y,h]);let E=ee=>{if(ee.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Re=>!Re),f(null);return}n&&n(e);},te=ee=>{x(false),f(ee);},O=async(ee,Re)=>{h==="log"&&r&&ee?r(e,ee,Re):h==="estimate"&&o?o(e,ee):h==="quoted"&&s&&s(e,ee),f(null);},H=r||o||s||n,M=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(ee=>ee.show),J=h==="estimate"?v:h==="quoted"?C:void 0;return v===0&&w===0&&C===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsx("button",{onClick:E,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:M.map(ee=>jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:ee=>ee.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),v>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(D)]}),L>0&&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(L)," Over"]})]}),v>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:$,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsx("button",{onClick:E,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:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",ee.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ee=>{ee.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",ee.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:M.map(ee=>jsxs("button",{onClick:Re=>{Re.stopPropagation(),te(ee.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:Re=>{Re.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Re=>{Re.target.style.background="transparent";},children:[jsx(ee.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),ee.label]},ee.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Wr,{mode:h,locale:a,isDark:t,currentValue:J||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function K2(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 Y2(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 cg({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?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")}):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 ug({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=K2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(cg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&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 jsxs("div",{className:"flex items-center gap-2",children:[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:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),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?Y2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(cg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&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 mg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className: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 hg({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}){let y=useRef(null),x=r==="es"?fg.es:fg.en;if(useEffect(()=>{let v=T=>{y.current&&!y.current.contains(T.target)&&t();},C=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let h=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:x.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),i&&(v.push({id:"status",label:x.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:x.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:x.inProgress,icon:jsx(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:x.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:x.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:x.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:x.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:x.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:x.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&v.push({id:"assign",label:x.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],k=T.some(L=>L.name===C.name)?T.filter(L=>L.name!==C.name):[...T,{name:C.name,initials:m1(C.name),color:C.color||g1(C.name),avatar:C.avatarUrl}];i({...e.task,assignees:k}),t();}}))})),d&&v.push({id:"log-time",label:x.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&v.push({id:"report-blocker",label:x.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&v.push({id:"copy-link",label:x.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:x.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:x.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},f=()=>{if(!e.columnId)return [];let v=[];return l&&(v.push({id:"sort-asc",label:x.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:x.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:x.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),v},b=e.type==="task"?h():f(),w={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:y,style:w,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:b.map(v=>v.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},v.id):v.submenu?jsx(f1,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.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",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(v.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function f1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className: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:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&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=>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:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var fg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Dg={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},P1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Eg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[m,d]=useState(null),p=useRef(null),g=i==="es"?Sg.es:Sg.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let v=()=>{if(!p.current)return;let C=p.current.getBoundingClientRect(),D=window.innerHeight-C.top-20;d(Math.max(300,D));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let C=D=>{p.current&&!p.current.contains(D.target)&&t();},T=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",T),p._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(v),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let y=v=>g.columns[v]||v,x=v=>{if(v==="name")return;let C=a.map(T=>T.id===v?{...T,visible:!T.visible}:T);o(C);},h=(v,C)=>{let T=a.find(k=>k.type===v&&(!C||k.customFieldId===C));if(T){x(T.id);return}let D={id:C||v,type:v,label:C?r.find(k=>k.id===C)?.name||v:y(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,D]);},f=P1.filter(v=>y(v).toLowerCase().includes(c.toLowerCase())),b=r.filter(v=>v.name.toLowerCase().includes(c.toLowerCase())),w=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:p,style:{...m?{maxHeight:`${m}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",w);},onFocus:v=>{v.currentTarget.style.borderColor=w,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(k=>k.type===v&&!k.customFieldId),T=C?.visible??false,D=v==="name";return jsxs("button",{onClick:()=>{D||(C?x(C.id):h(v));},disabled:D,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:D?.4:1,cursor:D?"not-allowed":"pointer"},onMouseEnter:k=>{D||(k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v]}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:y(v)})]},v)})})]}),b.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:b.map(v=>{let T=a.find(D=>D.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>h(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:D=>{D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?w:"transparent",border:T?`1.5px solid ${w}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${w}40`:"none"},children:T&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:T?w:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Dg[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?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:v.name})]},v.id)})})]})]})]})}var Sg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",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",assignees:"Asignados",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 z1=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function Pg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,m]=useState([""]),d=o==="es"?Mg.es:Mg.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),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?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),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})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:z1.map(h=>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:[jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),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"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[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&&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:jsx(Trash2,{className:"w-4 h-4"})})]},f)),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:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className: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}),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 Mg={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 Ig={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 Bg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),m=s==="es"?Ig.es:Ig.en;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:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[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:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&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:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),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:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),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:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Rg(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 e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${Math.round(e).toLocaleString("en-US")}`}function Og({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&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:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),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?"#FF2D20":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:cs(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:cs(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:cs(l)})]}),i>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(p,100)}%`,backgroundColor:y}})}),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-[#FF2D20]/10 text-[#FF2D20]":"bg-red-50 text-red-600"),children:[m>=0?`+${cs(m)} ${s?"Disp.":"Avail."}`:`${cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&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?"#FF2D20":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Rg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Rg(c)})]}),c>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[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 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-[#FF2D20]/15 text-[#FF2D20]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#FF2D20":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var aw=[{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 Vg(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(...Vg(r.subtasks,t+1));return a}function rw(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 ow(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function En(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=En(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Sn(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]=useState(false),[s,n]=useState(String(e||""));return r?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"}}):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 Gg({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:v,persistFilter:C=false,financialBlur:T,healthSidebar:D,lens:k="hours",hourlyRate:L=0,rateMap:$,aggregateParentHours:E=false,showProjectTotals:te=false}=t,O=Ei(d,p),H=m==="dark",M=P=>{if(!$||!P.assignees||P.assignees.length===0)return L;let de=P.assignees.map(fe=>fe.id?$[fe.id]:void 0).filter(fe=>fe!=null&&fe>0);return de.length===0?L:de.reduce((fe,I)=>fe+I,0)/de.length},J=useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let P=localStorage.getItem(C);if(P){let de=JSON.parse(P);return {statusFilter:de.statusFilter||"all",hideCompleted:de.hideCompleted||!1}}}catch(P){console.error("Error loading persisted filter:",P);}return {statusFilter:"all",hideCompleted:false}},[C]),ee=useMemo(()=>{function P(de){let fe=0,I=0,G=0;for(let ce of de)if(ce.subtasks&&ce.subtasks.length>0){let N=P(ce.subtasks);fe+=N.spent,I+=N.allocated,G+=N.quoted;}else fe+=ce.timeLoggedMinutes??0,I+=ce.effortMinutes??0,G+=ce.soldEffortMinutes??0;return {spent:fe,allocated:I,quoted:G}}return P(e)},[e]),Re=useMemo(()=>{let P=new Map;function de(fe){let I=0;for(let G of fe)if(G.subtasks&&G.subtasks.length>0){let ce=de(G.subtasks);P.set(G.id,ce),I+=ce;}else I+=G.weight||0;return I}return de(e),P},[e]),B=useMemo(()=>!D?.enabled||!D.data?D:{...D,data:{...D.data,totalHoursSpentMinutes:ee.spent,totalHoursAllocatedMinutes:ee.allocated}},[D,ee]),[Y,ye]=useState(true),[Ge,U]=useState("position"),[oe,Z]=useState("asc"),[Ee,ke]=useState(""),[Ie,He]=useState(()=>J().statusFilter),[et,ae]=useState(()=>J().hideCompleted),[Xe,me]=useState(x||aw),[at,mt]=useState(false),[Pt,Ce]=useState(false),[xt,nt]=useState({isOpen:false,x:0,y:0,type:"task"}),[Je,z]=useState("all"),[se,S]=useState(false),q=useRef(null),ue=useRef(null),Te=useMemo(()=>{let P=0;function de(fe,I){for(let G of fe)I>P&&(P=I),G.subtasks?.length&&de(G.subtasks,I+1);}return de(e,1),P},[e]);useEffect(()=>{if(!se)return;let P=de=>{q.current?.contains(de.target)||ue.current?.contains(de.target)||S(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[se]),useEffect(()=>{if(Je==="all"){let fe=function(I){for(let G of I)G.subtasks?.length&&(G.isExpanded===false&&a.onTaskToggleExpand?.(G.id),fe(G.subtasks));};fe(e);}else {let fe=function(I,G){for(let ce of I)if(ce.subtasks?.length){let N=G<Je,j=ce.isExpanded!==false;N!==j&&a.onTaskToggleExpand?.(ce.id),fe(ce.subtasks,G+1);}};fe(e,1);}},[Je]);let[W,re]=useState(null),[Ue,Ne]=useState(0),[ze,Me]=useState(0),Ke=useRef(null),[lt,ut]=useState(null),[st,Ze]=useState(null);useEffect(()=>{x&&me(x);},[x]),useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:Ie,hideCompleted:et}));}catch(P){console.error("Error persisting filter state:",P);}},[C,Ie,et]);let zt=useMemo(()=>{let P=new Set;function de(fe){for(let I of fe)I.subtasks?.length&&(I.isExpanded!==false&&P.add(I.id),de(I.subtasks));}return de(e),P},[e]),Ct=useMemo(()=>Xe.filter(P=>P.visible),[Xe]),ht=useCallback(P=>{a.onTaskToggleExpand?.(P);},[a]),wt=useCallback(P=>{Ge===P?Z(de=>de==="asc"?"desc":"asc"):(U(P),Z("asc")),a.onSortChange?.({column:P,direction:oe==="asc"?"desc":"asc"});},[Ge,oe,a]),rt=useCallback(P=>{me(P),a.onColumnsChange?.(P);},[a]),Lt=useCallback(P=>{let de=Xe.map(fe=>fe.id===P?{...fe,visible:false}:fe);rt(de);},[Xe,rt]),We=useCallback((P,de)=>{U(P),Z(de);},[]),Be=useCallback((P,de,fe)=>{b&&(P.preventDefault(),nt({isOpen:true,x:P.clientX,y:P.clientY,type:de?"task":"header",task:de,columnId:fe}));},[b]),pt=useCallback(()=>{nt(P=>({...P,isOpen:false}));},[]),le=useCallback((P,de)=>{if(!f)return;P.preventDefault(),P.stopPropagation();let fe=Xe.find(I=>I.id===de);fe&&(re(de),Ne(P.clientX),Me(fe.width));},[Xe,f]);useEffect(()=>{if(!W)return;let P=fe=>{let I=fe.clientX-Ue,G=Math.max(50,ze+I),ce=Xe.map(N=>N.id===W?{...N,width:G}:N);me(ce);},de=()=>{W&&a.onColumnsChange?.(Xe),re(null);};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",de),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",de);}},[W,Ue,ze,Xe,a]);let be=useCallback((P,de)=>{if(de==="name"){P.preventDefault();return}ut(de),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",de),P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="0.5");},[]),A=useCallback(P=>{P.currentTarget instanceof HTMLElement&&(P.currentTarget.style.opacity="1"),ut(null),Ze(null);},[]),K=useCallback((P,de)=>{P.preventDefault(),de!=="name"&&(P.dataTransfer.dropEffect="move",Ze(de));},[]),X=useCallback(()=>{Ze(null);},[]),ge=useCallback((P,de)=>{if(P.preventDefault(),!lt||lt===de||de==="name")return;let fe=[...Xe],I=fe.findIndex(N=>N.id===lt),G=fe.findIndex(N=>N.id===de);if(I===-1||G===-1)return;let ce=fe.splice(I,1);ce[0]&&(fe.splice(G,0,ce[0]),rt(fe),ut(null),Ze(null));},[lt,Xe,rt]),Fe=useCallback(async P=>{if(a.onCreateCustomField){let de={...P,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(de);}Ce(false);},[a]),Ye=useCallback(P=>P.progress===100||P.status==="completed"?"completed":P.progress&&P.progress>0||P.status==="in-progress"?"in-progress":"todo",[]),Ve=useMemo(()=>{let P=Vg(e);if(Ee.trim()){let de=Ee.toLowerCase();P=P.filter(fe=>fe.name.toLowerCase().includes(de));}return Ie!=="all"&&(P=P.filter(de=>Ye(de)===Ie)),et&&(P=P.filter(de=>Ye(de)!=="completed")),P.sort((de,fe)=>{let I,G;switch(Ge){case "name":I=de.name.toLowerCase(),G=fe.name.toLowerCase();break;case "startDate":I=de.startDate?.getTime()||0,G=fe.startDate?.getTime()||0;break;case "endDate":I=de.endDate?.getTime()||0,G=fe.endDate?.getTime()||0;break;case "progress":I=de.progress||0,G=fe.progress||0;break;case "status":I=de.status||"todo",G=fe.status||"todo";break;case "priority":let ce={urgent:0,high:1,medium:2,low:3,none:4};I=ce[de.priority]??4,G=ce[fe.priority]??4;break;case "position":return 0;default:return 0}return I<G?oe==="asc"?-1:1:I>G?oe==="asc"?1:-1:0}),P},[e,Ee,Ie,et,Ge,oe,Ye]),Oe=useCallback((P,de)=>{let fe=ce=>{a.onTaskUpdate?.({...P,...ce});},I=ce=>ce?P.customFields?.find(j=>j.fieldId===ce)?.value:void 0,G=(ce,N)=>{if(!ce)return;let xe=[...P.customFields||[]],Le=xe.findIndex(Qe=>Qe.fieldId===ce);Le>=0?xe[Le]={fieldId:ce,value:N}:xe.push({fieldId:ce,value:N}),fe({customFields:xe});};switch(de.type){case "name":return null;case "status":return jsx(Lm,{value:P.status||(P.progress===100?"completed":P.progress&&P.progress>0?"in-progress":"todo"),onChange:N=>{fe({status:N,progress:N==="completed"?100:N==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsx(Bm,{value:P.priority,onChange:N=>fe({priority:N}),isDark:H,locale:d});case "assignees":{let N=P.hasChildren,j=P.assignees||[];if(N&&P.subtasks?.length){let xe=new Map;(P.assignees||[]).forEach(Qe=>xe.set(Qe.name,Qe));let Le=Qe=>{(Qe||[]).forEach(tt=>{(tt.assignees||[]).forEach(vt=>{xe.has(vt.name)||xe.set(vt.name,vt);}),tt.subtasks?.length&&Le(tt.subtasks);});};Le(P.subtasks),j=Array.from(xe.values());}return jsx(Hm,{value:j,availableUsers:i,onChange:xe=>fe({assignees:xe}),isDark:H,locale:d,disabled:N})}case "startDate":return jsx(Pi,{value:P.startDate,onChange:N=>fe({startDate:N}),isDark:H,locale:d,dateField:"start",startDate:P.startDate,endDate:P.endDate});case "endDate":return jsx(Pi,{value:P.endDate,onChange:N=>fe({endDate:N}),isDark:H,locale:d,dateField:"end",startDate:P.startDate,endDate:P.endDate});case "progress":return jsx(_m,{value:P.progress||0,onChange:N=>{let j=N===100?"completed":N>0?"in-progress":"todo";fe({progress:N,status:j});},isDark:H});case "tags":return jsx(rg,{value:P.tags||[],isDark:H});case "text":return jsx(Ym,{value:I(de.customFieldId)||"",onChange:N=>G(de.customFieldId,N),isDark:H});case "number":return jsx(Jm,{value:I(de.customFieldId)||0,onChange:N=>G(de.customFieldId,N),isDark:H});case "date":let ce=I(de.customFieldId);return jsx(Pi,{value:ce?new Date(ce):void 0,onChange:N=>G(de.customFieldId,N),isDark:H,locale:d});case "dropdown":return jsx(Qm,{value:I(de.customFieldId)||"",options:de.options||[],onChange:N=>G(de.customFieldId,N),isDark:H});case "checkbox":return jsx(eg,{value:I(de.customFieldId)||false,onChange:N=>G(de.customFieldId,N),isDark:H});case "estimatedTime":{let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.estimatedTime,onChange:j=>fe({estimatedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "quotedTime":{let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(ar,{value:P.quotedTime,onChange:xe=>fe({quotedTime:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "elapsedTime":{let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.elapsedTime,onChange:j=>fe({elapsedTime:j}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "effortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{allocated:Qe,quoted:tt}=En(P),vt=M(P);if(k==="financial"&&vt&&Qe>0&&tt>0){let Rt=Math.round(Qe/60*vt),Ot=Math.round(tt/60*vt)-Rt;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}),Ot!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Ot>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ot>0?"+":"",Ot>=1e3?`$${(Ot/1e3).toFixed(1)}K`:`$${Ot}`]})]})}return jsx(ar,{value:Qe>0?Qe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=P.effortMinutes||0,xe=P.soldEffortMinutes||0,Le=M(P);if(k==="financial"&&Le&&j>0&&xe>0){let Qe=Math.round(j/60*Le),vt=Math.round(xe/60*Le)-Qe;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(ar,{value:j,onChange:Rt=>fe({effortMinutes:Rt}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)}),vt!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",vt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[vt>0?"+":"",Math.abs(vt)>=1e3?`$${(vt/1e3).toFixed(1)}K`:`$${vt}`]})]})}return jsx(ar,{value:j,onChange:Qe=>fe({effortMinutes:Qe}),isDark:H,locale:d,disabled:N,lens:k,hourlyRate:M(P)})}case "timeLoggedMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{spent:j}=En(P);return jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100;return jsx(ar,{value:P.timeLoggedMinutes,onChange:a.onLogTime?j=>{a.onLogTime?.(P,j);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:N,lens:k,hourlyRate:M(P)})}case "soldEffortMinutes":{if(E&&P.subtasks&&P.subtasks.length>0){let{quoted:xe}=En(P),Le=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,isBlurred:Le,lens:k,hourlyRate:M(P)})}let N=P.status==="completed"||P.progress===100,j=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(ar,{value:P.soldEffortMinutes,onChange:xe=>fe({soldEffortMinutes:xe}),isDark:H,locale:d,disabled:N,isBlurred:j,lens:k,hourlyRate:M(P)})}case "scheduleVariance":{let N=P.effortMinutes||0,j=P.soldEffortMinutes||0,xe=P.timeLoggedMinutes||0,Le=N>0||j>0||xe>0;return jsx(ig,{startDate:P.startDate,endDate:P.endDate,scheduleVariance:P.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:Le})}case "hoursBar":{if(E&&P.hasChildren){let{spent:N,allocated:j,quoted:xe}=En(P),Le=N>j&&j>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",Le?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Sn(N)}),j>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-white/60":"text-gray-600",children:Sn(j)})]}),xe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Sn(xe)})]})]})}return jsx(dg,{task:P,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:M(P)})}case "teamLoad":return jsx(ug,{task:P,isDark:H,locale:d});case "blockers":return jsx(mg,{blockers:P.blockers,isDark:H,locale:d});case "weight":{let N=Re.get(P.id);if(N!==void 0)return jsx("span",{className:u("text-xs font-mono",N>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:N>0?`${Number(N.toFixed(2))}%`:"\u2014"});let j=P.weight||0;return jsx(nw,{value:j,onChange:xe=>fe({weight:xe}),isDark:H})}default:return jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,E,Re]),bt=useCallback(P=>{let fe={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")}[P.type]||P.label;return typeof fe=="string"?fe:String(fe||P.type)},[O,d]),gt=useMemo(()=>{let fe=Ct.reduce((G,ce)=>G+ce.width,0)+(h?48:0),I={};for(let G of Ct)I[G.id]=`${G.width/fe*100}%`;return I},[Ct,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:Ke,className:u(H?"bg-[#0D0D0D]":"bg-white",W&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ve.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ee,onChange:P=>ke(P.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")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),y&&Te>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:q,onClick:()=>S(!se),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?se?"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]":se?"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:[jsx(Layers,{className:"w-3.5 h-3.5"}),Je==="all"?d==="es"?"Todos":"All":`L${Je}`]}),se&&jsx("div",{ref:ue,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(Te,5)},(P,de)=>({value:de+1,label:`L${de+1}`}))].map(P=>jsxs("button",{onClick:()=>{z(P.value),S(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?Je===P.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Je===P.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:P.label}),Je===P.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(P.value)))})]}),jsx(Bg,{value:Ie,hideCompleted:et,onChange:He,onHideCompletedChange:ae,isDark:H,locale:d}),B?.enabled&&B.data&&!Y&&jsx("button",{onClick:()=>ye(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:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&v&&jsxs(motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Ct.map(P=>{let de=P.id!=="name",fe=st===P.id&<!==P.id;return 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",de&&"cursor-grab",lt===P.id&&"opacity-50",fe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:gt[P.id],minWidth:P.minWidth},draggable:de,onDragStart:de?I=>be(I,P.id):void 0,onDragEnd:de?A:void 0,onDragOver:de?I=>K(I,P.id):void 0,onDragLeave:de?X:void 0,onDrop:de?I=>ge(I,P.id):void 0,onContextMenu:I=>Be(I,void 0,P.id),children:[de&&jsx(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")}),P.sortable?jsxs("button",{draggable:false,onClick:()=>wt(P.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[bt(P),jsx(ArrowUpDown,{className:u("w-3 h-3",Ge===P.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:bt(P)}),f&&P.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",W===P.id&&"bg-[#007BFF]"),onMouseDown:I=>le(I,P.id)})]},P.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:P=>{P.stopPropagation(),mt(de=>!de);},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",at&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Eg,{isOpen:at,onClose:()=>mt(false),columns:Xe,customFields:c,onColumnsChange:rt,onCreateCustomField:()=>{mt(false),Ce(true);},isDark:H,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ve.map((P,de)=>{let fe=zt.has(P.id),I=Math.min(de*.01,.2),G=P.hasChildren&&P.level===0,ce=P.subtasks?.length||0;if(G){let{spent:N,allocated:j,quoted:xe}=En(P),Le=rw(P),Qe=ow(P);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(P),children:Ct.map(tt=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:gt[tt.id],minWidth:tt.minWidth},children:tt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:vt=>{vt.stopPropagation(),ht(P.id);},className:"flex-shrink-0 cursor-pointer",children:fe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),P.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:H?"#FFD60A":"#B45309"},children:P.wbsCode}),jsx("span",{title:P.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",H?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:P.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",H?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ce," ",d==="es"?ce===1?"Tarea":"Tareas":ce===1?"Item":"Items",")"]}),Le!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",Le>=1?"text-[#32D74B]":Le>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",Le.toFixed(2)]}),Qe>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[d==="es"?"Conflicto":"Conflict",": ",Qe]})]}):tt.type==="timeLoggedMinutes"?jsx(ar,{value:N>0?N:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="soldEffortMinutes"?jsx(ar,{value:xe>0?xe:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):tt.type==="effortMinutes"?jsx(ar,{value:j>0?j:void 0,isDark:H,locale:d,disabled:true,lens:k,hourlyRate:M(P)}):Oe(P,tt)},tt.id))},P.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:I},className:u("flex items-center border-b transition-colors",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(P),onDoubleClick:()=>a.onTaskDoubleClick?.(P),onContextMenu:N=>Be(N,P),children:[Ct.map(N=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:gt[N.id],minWidth:N.minWidth},children:N.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&P.level>0&&jsx("div",{style:{width:`${P.level*24}px`},className:"flex-shrink-0"}),y&&P.hasChildren&&jsx("button",{onClick:j=>{j.stopPropagation(),ht(P.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:fe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!P.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(P.wbsCode||P.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[P.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:P.wbsCode}),P.taskCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:P.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",P.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:P.name}),P.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${P.tags[0].color}20`,color:P.tags[0].color},children:P.tags[0].name})]})]}):Oe(P,N)},N.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},P.id)})}),te&&Ve.length>0&&(()=>{let{spent:P,allocated:de,quoted:fe}=ee,I=de-P,G=I<0,ce=G?`+${Sn(Math.abs(I))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Sn(I)} ${d==="es"?"AHORRADO":"SAVED"}`,N=k==="financial"&&L>0,j=Qe=>N?`$${(Qe/60*L).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Sn(Qe),xe=N?Math.abs(I/60*L):0,Le=N?`${G?"+":"-"}$${xe.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${G?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:ce;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",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:[Ct.map(Qe=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:gt[Qe.id],minWidth:Qe.minWidth},children:Qe.type==="name"?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"}):Qe.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(P)}),jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),de>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",G?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:N?Le:ce})]}):Qe.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:fe>0?j(fe):"\u2013"}):Qe.type==="effortMinutes"?(()=>{if(N&&fe>0&&de>0){let tt=Math.round(fe/60*(L||25)),vt=Math.round(de/60*(L||25)),Rt=tt-vt,na=tt>0?Math.round(Rt/tt*100):0;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:j(de)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap",Rt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Rt>=0?"+":"",Math.abs(Rt)>=1e3?`$${(Rt/1e3).toFixed(1)}K`:`$${Rt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:de>0?j(de):"\u2013"})})():Qe.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:P>0?j(P):"\u2013"}):Qe.type==="progress"?(()=>{let tt=e||[],vt=0,Rt=0,na=0,Ot=0;for(let cr of tt){let Ka=cr.weight||Re.get(cr.id)||0,Pn=cr.progress||0;Ka>0&&(vt+=Pn*Ka,Rt+=Ka),na+=Pn,Ot++;}let _a=Rt>0?Math.round(vt/Rt*10)/10:Ot>0?Math.round(na/Ot):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[_a,"%"]})})():Qe.type==="weight"?(()=>{let tt=e||[],vt=[],Rt=cr=>{for(let Ka of cr)vt.push(Ka),Ka.subtasks?.length&&Rt(Ka.subtasks);};Rt(tt);let Ot=vt.filter(cr=>!cr.subtasks?.length||cr.subtasks.length===0).reduce((cr,Ka)=>cr+(Ka.weight||0),0),_a=Math.abs(Ot-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",_a?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ot.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Qe.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ve.length===0&&Ee&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),B?.enabled&&B.data&&Y&&jsx(Og,{data:B.data,isDark:H,locale:d,onClose:()=>ye(false),lens:t?.lens})]}),jsx(hg,{state:xt,onClose:pt,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Lt,onColumnSort:We,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(Pg,{isOpen:Pt,onClose:()=>Ce(false),onSave:Fe,isDark:H,locale:d})]})}var _g=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"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}],jg=[{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"}],Kg=[{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 Xd={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"},Jd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Qd={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"},Hi={dark:Xd,light:Jd,neutral:Qd};function Yg(e){return Hi[e]||Hi.dark}var Zd={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"}},ec={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"}},zi={en:Zd,es:ec};function ps(e){return zi[e]||zi.en}function Ui(e,t){let a=ps(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 qg(e){let t=ps(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 Xg(e,t=0,a=true){let r=ps(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 gs(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 ac(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 Zg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var a0=26,mw=22,gw=10;function e0(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 rc(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 r0(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 t0(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?rc(c.effortMinutes,n,i):null,f=p?r0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(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*a0}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&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&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&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function o0({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:v,onLogTime:C,onUpdateEstimate:T,onUpdateSoldEffort:D,onStartTimer:k,onStopTimer:L,onDiscardTimer:$,blurFinancials:E=false,suppressDetailModal:te=false,lens:O="hours",hourlyRate:H=0}){let{theme:M="dark",locale:J="en",customTranslations:ee,showBacklog:Re=true}=t,B=Ui(J,ee),Y=M==="dark"||M==="neutral",[ye,Ge]=useState(r||new Date),[U,oe]=useState(null),[Z,Ee]=useState(null),[ke,Ie]=useState(null),[He,et]=useState({}),ae=3,Xe=3,me=useCallback(W=>{Ee(W.id),te||oe(W),h?.(W.id);},[te,h]),[at,mt]=useState(null),Pt=useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),Ce=useCallback(()=>{Ge(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),xt=useCallback(()=>{Ge(new Date);},[]),nt=useMemo(()=>{let W=ye.getFullYear(),re=ye.getMonth(),Ue=new Date(W,re,1),Ne=new Date(W,re+1,0),ze=Ue.getDay(),Me=Ne.getDate(),Ke=gs(e),lt=new Date;lt.setHours(0,0,0,0);let ut=[],st=ze,Ze=new Date(W,re,0).getDate();for(let Ct=st-1;Ct>=0;Ct--){let ht=new Date(W,re-1,Ze-Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Ct=1;Ct<=Me;Ct++){let ht=new Date(W,re,Ct),wt=ht.getTime()===lt.getTime();ut.push({date:ht,isCurrentMonth:true,isToday:wt,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(rt=>ac(ht,rt)).map(rt=>({id:rt.id,title:rt.name,start:rt.startDate,end:rt.endDate,task:rt}))});}let zt=42-ut.length;for(let Ct=1;Ct<=zt;Ct++){let ht=new Date(W,re+1,Ct);ut.push({date:ht,isCurrentMonth:false,isToday:false,isWeekend:ht.getDay()===0||ht.getDay()===6,events:Ke.filter(wt=>ac(ht,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return ut},[ye,e]),Je=useMemo(()=>gs(e).filter(W=>!W.startDate||!W.endDate),[e]),z=useMemo(()=>{let W=gs(e),re=0,Ue=0,Ne=0,ze=0,Me=0;W.forEach(Ze=>{Ze.effortMinutes&&(re+=Ze.effortMinutes),Ze.soldEffortMinutes&&(Ue+=Ze.soldEffortMinutes),Ze.scheduleVariance!=null&&(Ne+=Ze.scheduleVariance,ze++),Ze.soldEffortMinutes&&Ze.effortMinutes&&(Me+=Ze.soldEffortMinutes-Ze.effortMinutes);});let Ke=Ue>0?Math.min(100,Math.round(re/Ue*100)):0,lt=ze>0?Math.round(Ne/ze):0,st=`${Me<0?"-":"+"}${t0(Me,O,H)}`;return {budgetUtil:Ke,avgVariance:lt,costDisplay:st,hasCostData:Ue>0}},[e,O,H]),se=useMemo(()=>{let W=[0,0,0,0,0,0];return nt.forEach((re,Ue)=>{let Ne=Math.floor(Ue/7);re.events.forEach(ze=>{if(ze.task.startDate&&ze.task.soldEffortMinutes){let Me=new Date(ze.task.startDate),Ke=re.date;Me.getFullYear()===Ke.getFullYear()&&Me.getMonth()===Ke.getMonth()&&Me.getDate()===Ke.getDate()&&Ne<W.length&&(W[Ne]-=ze.task.soldEffortMinutes);}});}),W},[nt]),S=useMemo(()=>{let W=gs(e),re=new Map,Ue=new Set,Ne=[0,0,0,0,0,0];if(nt.length===0)return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne};let ze=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Me=ze(nt[0].date),Ke=ze(nt[nt.length-1].date),lt=[];for(let st of W){if(!st.startDate||!st.endDate)continue;let Ze=ze(st.startDate),zt=ze(st.endDate);if(Ze.getTime()===zt.getTime()||zt<Me||Ze>Ke)continue;let Ct=Ze<Me?Me:Ze,ht=zt>Ke?Ke:zt,wt=e0(Ct,Me),rt=e0(ht,Me);wt<0||wt>41||rt<0||rt>41||wt!==rt&&(Ue.add(st.id),lt.push({task:st,startIdx:wt,endIdx:rt}));}lt.sort((st,Ze)=>st.startIdx!==Ze.startIdx?st.startIdx-Ze.startIdx:Ze.endIdx-Ze.startIdx-(st.endIdx-st.startIdx));let ut=[[],[],[],[],[],[]];for(let{task:st,startIdx:Ze,endIdx:zt}of lt){let Ct=Math.floor(Ze/7),ht=Math.floor(zt/7),wt=ze(st.startDate),rt=ze(st.endDate),Lt=false;for(let We=Ct;We<=ht;We++){let Be=We===Ct?Ze%7:0,pt=We===ht?zt%7:6,le=pt-Be+1,be=0,A=ut[We]??[];for(ut[We]||(ut[We]=A);be<A.length&&(A[be]??-1)>=Be;)be++;if(be>=gw){Lt=true;break}be>=A.length?A.push(pt):A[be]=pt,Ne[We]=Math.max(Ne[We]??0,be+1);let K=We===Ct&&wt>=Me,X=We===ht&&rt<=Ke,ge=We*7+Be,Fe={taskId:st.id,task:st,rowIndex:We,startCol:Be,endCol:pt,spanCols:le,lane:be,isStart:K,isEnd:X};re.has(ge)||re.set(ge,[]),re.get(ge).push(Fe);}Lt&&(Ue.delete(st.id),re.forEach((We,Be)=>{let pt=We.filter(le=>le.taskId!==st.id);pt.length===0?re.delete(Be):re.set(Be,pt);}));}return {segmentsByCell:re,multiDayTaskIds:Ue,maxLanesPerRow:Ne}},[nt,e]),q=J==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ue=ye.toLocaleDateString(J==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=ue.charAt(0).toUpperCase()+ue.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",Y?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",Y?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",Y?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",Y?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",Y?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",Y?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",Y?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsx("p",{className:u("text-sm",Y?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",Y?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",Y?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",Y?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",Y?"text-white":"text-gray-900"),children:J==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",Y?"text-white":"text-gray-900"),children:Te}),jsx("button",{onClick:Ce,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",Y?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",Y?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",Y?"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:B.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",Y?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",Y?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",Y?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ee(null),children:nt.map((W,re)=>{let Ue=re%7===6,Ne=re>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(Y?"border-r border-[#222]":"border-r border-gray-200"),!Ne&&(Y?"border-b border-[#222]":"border-b border-gray-200"),Y?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&&Y&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!Y&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?Y?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?Y?"text-white/60":"text-gray-900":Y?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let ze=Math.floor(re/7),Me=(S.maxLanesPerRow[ze]??0)*a0,Ke=S.segmentsByCell.get(re);return Me===0&&!Ke?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:Ke?.map(lt=>jsx(fw,{segment:lt,isDark:Y,blurFinancials:E,isSelected:Z===lt.taskId,t:B,lens:O,hourlyRate:H,onClick:()=>{me(lt.task),a.onEventClick?.({id:lt.task.id,title:lt.task.name,start:lt.task.startDate,end:lt.task.endDate,task:lt.task});}},lt.taskId))})})(),(()=>{let ze=W.events.filter(Me=>Me.task.isMilestone&&!S.multiDayTaskIds.has(Me.id));return ze.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[ze.slice(0,4).map(Me=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:Ke=>{Ke.stopPropagation(),me(Me.task);}},Me.id)),ze.length>4&&jsxs("span",{className:u("text-[8px] font-mono",Y?"text-white/30":"text-gray-400"),children:["+",ze.length-4]})]})})(),(()=>{let ze=[];W.events.forEach(Ke=>{Ke.task.blockers?.forEach(lt=>{(lt.severity==="warning"||lt.severity==="critical")&&ze.push({taskId:Ke.id,type:lt.type,severity:lt.severity,variance:Ke.task.scheduleVariance});});});let Me=ze[0];return Me?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let ze=W.events.filter(ut=>!S.multiDayTaskIds.has(ut.id)),Me=He[re]||ae,Ke=ze.slice(0,Me),lt=ze.length-Me;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ke.map(ut=>jsxs(motion.button,{onClick:()=>{me(ut.task),a.onEventClick?.(ut);},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",ut.task.progress===100||ut.task.status==="completed"?Y?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":Y?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:Y?ut.task.progress===100||ut.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)"}:ut.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",ut.task.isMilestone?Y?"text-amber-400":"text-amber-600":ut.task.isCriticalPath?"text-red-400":Y?"text-[#1264FF]":"text-gray-400"),children:ut.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:ut.title})]},ut.id)),lt>0&&jsxs("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:Me+Xe}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",lt," ",J==="es"?"m\xE1s":"more"]}),Me>ae&&ze.length>ae&&jsx("button",{onClick:ut=>{ut.stopPropagation(),et(st=>({...st,[re]:ae}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",Y?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:J==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let ze=re>=28,Me=re%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ke=>{Ke.stopPropagation(),mt(at===re?null:re);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",at===re?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",Y?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",at===re&&"rotate-45")})}),jsx(AnimatePresence,{children:at===re&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>mt(null)}),jsx(motion.div,{initial:{opacity:0,y:ze?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:ze?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",ze?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Ro,{onSubmit:Ke=>{a.onTaskCreate?.({name:Ke.name,startDate:Ke.startDate||W.date,endDate:Ke.endDate||W.date,priority:Ke.priority,assignees:Ke.assignee?[Ke.assignee]:void 0}),mt(null);},onCancel:()=>mt(null),availableUsers:t.availableUsers,isDark:Y,locale:J==="es"?"es":"en",defaultDate:W.date,dropdownDirection:ze?"up":"down"})})]})})]})})()}),re%7===6&&(()=>{let ze=Math.floor(re/7),Me=se[ze];if(!Me||Me===0)return null;let Ke=t0(Me,O,H);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Me<0?"-":"+",Ke]})})()]},re)})})})]}),Re&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",Y?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",Y?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",Y?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",Y?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",Y?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",Y?"text-white/20":"text-gray-400"),children:J==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxs("button",{onClick:()=>{me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",Y?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",Y?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",Y?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(re=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${re.color}15`,color:re.color,border:`1px solid ${re.color}30`},children:re.name},re.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",Y?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",Y?"text-white/25":"text-gray-400",E&&"blur-sm select-none"),children:[rc(W.effortMinutes,O,H)&&jsxs("span",{children:[B.labels.estimate,": ",rc(W.effortMinutes,O,H)]}),(()=>{let re=r0(W,O,H);return re?jsx("span",{className:re.isNegative?"text-red-400":"text-emerald-400",children:re.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(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")}),jsx(Zg,{task:W,isDark:Y})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((re,Ue)=>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:re.color||"#007FFF"},title:re.name,children:re.initials||re.name?.slice(0,2).toUpperCase()},Ue))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",Y?"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="");}})}),z.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",Y?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",Y?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",Y?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",Y?"text-white/60":"text-gray-700",E&&"blur-sm select-none"),children:[z.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",Y?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.budgetUtil}%`,background:z.budgetUtil>90?"#EF4444":z.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.avgVariance>0?"text-emerald-400":z.avgVariance<0?"text-red-400":Y?"text-white/50":"text-gray-600"),children:[z.avgVariance>0?"+":"",z.avgVariance," ",B.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",Y?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",Y?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",z.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",E&&"blur-sm select-none"),children:z.costDisplay})]})]})]})]})]}),!te&&jsx(Zr,{task:U,isOpen:!!U,onClose:()=>oe(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),oe(W);},theme:M==="dark"?"dark":"light",locale:J,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:U?m?.get(U.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:gs(e).filter(W=>W.id!==U?.id),comments:d?.filter(W=>W.taskId===U?.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:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:T,onSoldEffortUpdate:D,onTimerStart:k,onTimerStop:L,onTimerDiscard:$,blurFinancials:E}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ie(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className: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",Y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",Y?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",Y?"text-white/90":"text-gray-900"),children:ke.date.toLocaleDateString(J==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ie(null),className:u("p-1 rounded",Y?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ke.events.map(W=>jsxs("button",{onClick:()=>{Ie(null),me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",Y?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Zg,{task:W.task,isDark:Y}),jsx("span",{className:u("text-sm truncate flex-1",Y?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var oc={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)"},nc={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)"},sc={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)"},Gi={dark:oc,light:nc,neutral:sc};function n0(e){return Gi[e]||Gi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=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 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:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var i0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function bs(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 hs(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 l0(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 d0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...i0,...n}),[n]),[l,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let v=w.timestamp.toISOString().split("T")[0],C=b.get(v);C?C.push(w):b.set(v,[w]);}),Array.from(b.entries()).sort((w,v)=>v[0].localeCompare(w[0])).map(([w,v])=>({date:new Date(w),events:v.sort((C,T)=>T.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,w=new Set;return e.forEach(v=>{b.add(v.userId),w.add(v.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let v=new Set(w);return v.has(b)?v.delete(b):v.add(b),v});},h=b=>{let v=new Date().getTime()-b.getTime(),C=Math.floor(v/6e4),T=Math.floor(v/36e5),D=Math.floor(v/864e5);return C<1?"just now":C<60?`${C}m ago`:T<24?`${T}h ago`:D<7?`${D}d ago`:b.toLocaleDateString()},f=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 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?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[hs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&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:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),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&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((w,v)=>{let C=l.has(w.id),T=s===w.id,D=l0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",C&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:D},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:hs(w.type)})}),v<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:D}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:bs(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(w.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([k,L])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(L.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(L.to)})]})]},k)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([k,L])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(L)})]},k))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function u0({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=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&hs(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&bs(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:bs(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ic(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 lc(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 p0(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 m0(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 g0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(1),[v,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),D=useCallback(O=>{if(!p||!l.current)return;let M=l.current.getBoundingClientRect(),J=(O.clientX-M.left-v.x)/b,ee=(O.clientY-M.top-v.y)/b;d(Re=>Re.map(B=>B.id===p?{...B,x:J,y:ee,fx:J,fy:ee}:B));},[p,b,v]),k=useCallback(()=>{g(null);},[]),L=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),$=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),E=useCallback(O=>{let H=m.find(M=>M.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),te=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?jsxs("div",{className:u("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ic(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[p0(O)," ",lc(O)]})]},O))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:D,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=E(typeof O.source=="string"?O.source:O.source.id),M=E(typeof O.target=="string"?O.target:O.target.id),J=m0(O.type),ee=h===O.id,Re=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ee&&"hovered",Re&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:B=>$(O,B),children:[jsx("line",{x1:H.x,y1:H.y,x2:M.x,y2:M.y,stroke:ic(O.type),strokeWidth:Re?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ee?1:.6,markerEnd:J?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ee&&jsx("text",{x:(H.x+M.x)/2,y:(H.y+M.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:lc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,M=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",H&&"hovered",M&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:J=>T(O.id,J),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:J=>L(O,J),children:[jsx("circle",{r:M?a.nodeSize*1.2:a.nodeSize,fill:te(O),stroke:M?"#fbbf24":"#ffffff",strokeWidth:M?3:2,opacity:H?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function h0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),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?jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>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))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&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&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange: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}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>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))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick: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?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick: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 dc={"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=dc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ys(e){return `$${e.toFixed(4)}`}var cc=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)}},jo=new cc;function v0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(jo.getStats()),[s,n]=useState(jo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(jo.getStats()),n(jo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),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=jo.getRecentOperations(5);return jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ys(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ys(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function C0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(null),v=useRef(null),C=p||o;useEffect(()=>{e&&v.current&&v.current.focus();},[e]),useEffect(()=>{let $=E=>{E.key==="Escape"&&!C&&T();};if(e)return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[e,C]);let T=()=>{C||(i(""),l(""),d(""),x(null),f(null),w(null),t());},D=async()=>{if(!(!n.trim()||C)){g(true),x(null),f(null),w(null);try{let $=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f($.tasks.tasks),w({from_cache:$.from_cache,tokens_used:$.tokens_used,mock_mode:$.mock_mode,similarity:$.similarity,tokens_saved:$.tokens_saved});}catch($){x($ instanceof Error?$.message:"Failed to generate tasks");}finally{g(false);}}},k=()=>{h&&(a(h),T());};if(!e)return null;let L=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:T}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",L,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[b.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map(($,E)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:$.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),$.start," \u2192 ",$.end]}),jsxs("span",{children:[$.duration," days"]}),$.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",$.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${$.priority==="high"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:$.priority})]})},$.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:v,value:n,onChange:$=>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:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:$=>l($.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:C})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:$=>d($.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:C})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map(($,E)=>jsx("button",{onClick:()=>i($),disabled:C,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:$},E))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:D,disabled:!n.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Ki({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&As(()=>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=useCallback(async(h,f,b)=>{r(w=>{let v=w.cards.find($=>$.id===h);if(!v)return w;let C=v.columnId,T={...v,columnId:f,position:b},D=w.cards.map($=>$.id===h?T:$),k=w.columns.map($=>{if($.id===C)return {...$,cardIds:$.cardIds.filter(E=>E!==h)};if($.id===f){let E=D.filter(te=>te.columnId===f).sort((te,O)=>te.position-O.position);return {...$,cardIds:E.map(te=>te.id)}}return $}),L={...w,cards:D,columns:k};return o(L),L});},[o]),n=useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(C=>C.id===h?{...C,...f}:C),v={...b,cards:w};return o(v),v});},[o]),i=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},v=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),C={...b,cards:[...b.cards,w],columns:v};return o(C),C});},[o]),c=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),v=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(D=>D!==h)}:T),C={...f,cards:w,columns:v};return o(C),C});},[o]),l=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},v={...b,columns:[...b.columns,w]};return o(v),v});},[o]),m=useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(C=>C.id===h?{...C,...f}:C),v={...b,columns:w};return o(v),v});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(C=>C.columnId!==h),w=f.columns.filter(C=>C.id!==h),v={...f,cards:b,columns:w};return o(v),v});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=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 N0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Ki({initialBoard:e,onPersist:a}),n=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:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var xs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},S0={by:"none",order:"asc"};function E0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...xs,...e}),[s,n]=useState({...S0,...t}),i=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(()=>{o(xs),n(S0);},[]),m=useCallback(()=>{a&&o({...xs,assignees:[a]});},[a]),d=useCallback(()=>{o({...xs,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...xs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(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"),v=String(f.getDate()).padStart(2,"0"),C=`${b}-${w}-${v}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let D=T.endDate||T.dueDate;if(!D)return false;let k;if(typeof D=="string")k=D.split("T")[0]||D;else {let L=D.getUTCFullYear(),$=String(D.getUTCMonth()+1).padStart(2,"0"),E=String(D.getUTCDate()).padStart(2,"0");k=`${L}-${$}-${E}`;}switch(r.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let L=new Date(C+"T00:00:00"),$=new Date(k+"T00:00:00"),E=new Date(L);return E.setDate(E.getDate()+7),$>=L&&$<=E;case "custom":if(r.dateRange){let te=typeof D=="string"?new Date(D):D;return te>=r.dateRange.start&&te<=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 v=f.createdAt?new Date(f.createdAt).getTime():0,C=b.createdAt?new Date(b.createdAt).getTime():0;w=v-C;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},D=T[f.priority||"LOW"],k=T[b.priority||"LOW"];w=D-k;break;case "dueDate":let L=f.endDate||f.dueDate,$=b.endDate||b.dueDate;if(!L)return 1;if(!$)return -1;let E=typeof L=="string"?new Date(L).getTime():L.getTime(),te=typeof $=="string"?new Date($).getTime():$.getTime();w=E-te;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 M0,P0;if(typeof window<"u")try{let e=Fs("ai");M0=e.generateObject,P0=e.generateText;}catch{}function A0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(M0&&P0&&e.apiKey),n=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=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=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=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=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 pc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function L0(e){let{cards:t}=e,[a,r]=pc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=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(k=>k.columnId===x.columnId).sort((k,L)=>k.position-L.position),b=f.findIndex(k=>k.id===a.lastSelectedCardId),w=f.findIndex(k=>k.id===d),[v,C]=b<w?[b,w]:[w,b],T=f.slice(v,C+1).map(k=>k.id),D=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:D,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=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 I0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function B0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...I0,...a}),[a]),[s,n]=useState([]),i=useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={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(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,v]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(v=>v!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(C);});}),b.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(C);});}),w.forEach((C,T)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:C.map(D=>D.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(h.forEach(C=>{C.priority&&(v.has(C.priority)||v.set(C.priority,[]),v.get(C.priority).push(C));}),v.forEach((C,T)=>{if(C.length>=o.minCardsPerStack){let D={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${D} ${T} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of h){let D=(await r.findSimilar(C,h)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(D.length>=o.minCardsPerStack-1){let k=[C.id,...D.map($=>$.card.id)],L=D.reduce(($,E)=>$+E.similarity,0)/D.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${D.length+1} similar tasks`,confidence:L});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,T)=>T.confidence-C.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return 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 R0=createContext(null);function O0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Fs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Fs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Fs("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(R0.Provider,{value:{store:o},children:e})}function Yi(){let e=useContext(R0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ws(){let e=Yi(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),l=useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,w,v)=>{e.moveCard(b,w,v);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=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 H0(e){let{cards:t}=ws();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function z0(e="position",t="asc"){let{cards:a}=ws();return 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 qi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Qc.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);}},Gw=new qi;function W0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),m=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 jsx("div",{ref:l,style:p,className:o,children: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 jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function V0(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function _0({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=useRef(null),d=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 jsx("div",{ref:m,style:g,className:s,children: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 jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function j0(e){let t=useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function K0(e,t=10){return e>t}var bc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},hc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},yc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},xc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},wc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},kc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Cc={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)"},Tc={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)"},Nc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Dc={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}},Sc={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}},Xi={spacing:bc,borderRadius:hc,fontSize:yc,fontWeight:xc,lineHeight:vc,zIndex:wc,duration:kc,easing:Cc,shadows:Tc,opacity:Nc,kanban:Dc,gantt:Sc};function Y0(e,t,a){return e[t]??a}function Ec(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)?Ec(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 Fc(e="asakaa"){let t=Ec(Xi),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 ks(e,t="asakaa"){let a=[],r=Ec(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|