@libxai/board 1.9.40 → 1.9.41
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 +25 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/dist/styles.css +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import zb from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Paperclip,Users,Tag,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,CalendarClock,FileText,Timer,Clock,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Check,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Filter,Zap,Layers,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var
|
|
2
|
-
`)}async function jb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await zb(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),c=297,i=210,u=o.width/o.height,p=c-20,d=p/u;d>i-20&&(d=i-20,p=d*u);let m=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(l,"PNG",f,20,p,d),m}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(c=>c.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,s),s+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(c.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=np(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=np(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(d),p.cardIds.push(d.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function np(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function op(e,t){switch(t){case "json":return _b(e);case "csv":return Kb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function sp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var fc=createContext(null);function ip(){return useContext(fc)}var lp=createContext(null);function cp({children:e,themeName:t}){return jsx(lp.Provider,{value:{themeName:t},children:e})}function Ri(){return useContext(lp)}function ca({children:e,container:t}){let[a,r]=useState(false),n=ip(),s=Ri();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var gp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},th="#BDC3C7",ah=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Do({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let u=m=>{t(m),n(false);},p=e?gp[e]:null,d=p?.color||th;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ca,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(gp).map(([m,f])=>jsxs("button",{onClick:()=>u(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(ah,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var rh=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function $s({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),d=(Ri()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,I=380,C=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let P=w-x.bottom,T=x.top,V;P>=I+C?V=x.bottom+C:T>=I+C?V=x.top-I-C:V=P>=T?x.bottom+C:Math.max(10,x.top-I-C),l({top:V,left:N}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,k=N=>{let P=N.getFullYear(),T=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${P}-${T}-${V}`},M=k(w),I=new Date(w);I.setDate(I.getDate()+x);let C=k(I);a(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=I.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let N=C[0],P=C[1],T=C[2];return N===void 0||P===void 0||T===void 0?null:new Date(N,P-1,T)},w=x(e),k=x(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=e&&t,y=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${v()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsx(ca,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:rh.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Eo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,c]=useState(""),[i,u]=useState({top:0,left:0}),p=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,I=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let N=x-y.bottom,P=y.top,T;N>=M+I?T=y.bottom+I:P>=M+I?T=y.top-M-I:T=N>=P?y.bottom+I:Math.max(10,y.top-M-I),u({top:T,left:C}),o(true);};useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:d,onClick:()=>s?o(false):m(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ca,{children:jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:v.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(y=>{let x=e.some(w=>w.id===y.id);return jsxs("button",{onClick:()=>f(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#00E5CC":"transparent"},children:x?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Bi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(c.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(c),false};return l(a)}function Hs({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,h]=useState(null),b=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,Q=C.right-T;Q<10&&(Q=C.left),Q+T>P-10&&(Q=P-T-10);let L=N-C.bottom,Le=C.top,G;L>=V+O?G=C.bottom+O:Le>=V+O?G=C.top-V-O:G=L>=Le?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:Q}),c(true);};useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,Q=C.right-T;Q<10&&(Q=C.left),Q+T>P-10&&(Q=P-T-10);let L=N-C.bottom,Le=C.top,G;L>=V+O?G=C.bottom+O:Le>=V+O?G=C.top-V-O:G=L>=Le?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:Q});},[p,l]),useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!y.current?.contains(N.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=N=>{N.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let N=t.includes(C),P=a.find(T=>T.id===C);if(h(null),N){let T=t.filter(V=>V!==C);r(T),T.length===0&&d(false);}else {if(s&&Bi(a,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}r([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||r([]);},M=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>l?c(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),l&&jsx(ca,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[v&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),p&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:C=>u(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):M.map(C=>{let N=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:N?"#00E5CC":"transparent",borderColor:N?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:N&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var On=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:Fi.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...i,...u,onClick:()=>a?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Do,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx($s,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Eo,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Hs,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));On.displayName="Card";var $i={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Tp=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Np({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries($i).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys($i).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=$i[e];if(h)return {...h,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...$i.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let I=b-h.bottom,C=h.top,N;I>=w+k?N=h.bottom+k:C>=w+k?N=h.top-w-k:N=I>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:N,left:M}),s(true);};useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>n?s(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsx(Tp,{icon:f.icon,color:v})}),n&&jsx(ca,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(h=>jsxs("button",{onClick:()=>m(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Tp,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Dp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Sp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Dp[s]||Dp.en,[l,c]=useState(false),[i,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),b=useRef(null);useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(ca,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,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)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:p,onChange:k=>d(k.target.value),onKeyDown:w,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var ts=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),I=u??Qu(t.length),C=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:I}),N=t.filter(Q=>!Q.metadata?.isContainer).length;if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let Q=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:Q}:Q>=80?{state:"warning",percentage:Q}:Q>=60?{state:"approaching",percentage:Q}:{state:"ok",percentage:Q}})(),V=T.state==="exceeded",O=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,N):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g(O()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),T.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),T.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),T.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsx(Sp,{columnTitle:e.title,onRename:Q=>f?.(e.id,Q),onDelete:v?()=>v(e.id):void 0,isDeletable:h,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:I?"600px":void 0},children:jsx(SortableContext,{items:t.map(Q=>Q.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):I?jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(Q=>{let L=t[Q.index];return L?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Q.start}px)`},children:jsx(On,{card:L,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},L.id):null})}):t.map(Q=>jsx(On,{card:Q,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i},Q.id))})})]})});ts.displayName="Column";function vc({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Ch(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Ap(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Th(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Dh=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Ip({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=useState(false),[x,w]=useState([]),[k,M]=useState(0),[I,C]=useState(null),[N,P]=useState(false),T=useRef(null),V=useRef(null),O=useRef(null),Q=useRef(null),L=useCallback((oe,Re)=>{let Z=Ch(oe,Re);if(C(Z),Z){let Pe=r.filter(Ue=>Ue.name.toLowerCase().includes(Z.query)||Ue.email&&Ue.email.toLowerCase().includes(Z.query)).slice(0,5);w(Pe),y(Pe.length>0),M(0);}else y(false),w([]);},[r]),Le=oe=>{let Re=oe.target.value;if(t(Re),L(Re,oe.target.selectionStart||0),T.current){T.current.style.height="24px";let Z=T.current.scrollHeight,Pe=280,Ue=Math.min(Z,Pe);T.current.style.height=`${Ue}px`,T.current.style.overflowY=Z>Pe?"auto":"hidden";}},G=()=>{T.current&&L(e,T.current.selectionStart||0);},Ne=useCallback(oe=>{if(!I||!T.current)return;let Re=e.slice(0,I.start),Z=e.slice(I.end),Pe=`@${oe.name.replace(/\s+/g,"")} `,Ue=Re+Pe+Z;t(Ue),y(false),C(null),setTimeout(()=>{if(T.current){let Fe=I.start+Pe.length;T.current.selectionStart=Fe,T.current.selectionEnd=Fe,T.current.focus();}},0);},[I,e,t]),$=oe=>{if(b&&x.length>0)switch(oe.key){case "ArrowDown":oe.preventDefault(),M(Re=>Re<x.length-1?Re+1:0);break;case "ArrowUp":oe.preventDefault(),M(Re=>Re>0?Re-1:x.length-1);break;case "Enter":{oe.preventDefault();let Re=x[k];Re&&Ne(Re);break}case "Tab":{oe.preventDefault();let Re=x[k];Re&&Ne(Re);break}case "Escape":oe.preventDefault(),y(false);break}else oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),a());};useEffect(()=>{let oe=Re=>{V.current&&!V.current.contains(Re.target)&&T.current&&!T.current.contains(Re.target)&&y(false),Q.current&&!Q.current.contains(Re.target)&&P(false);};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]);let ve=useCallback(oe=>{if(!T.current)return;let Re=T.current.selectionStart||e.length,Z=e.slice(0,Re)+oe+e.slice(Re);t(Z),P(false),setTimeout(()=>{if(T.current){let Pe=Re+oe.length;T.current.selectionStart=Pe,T.current.selectionEnd=Pe,T.current.focus();}},0);},[e,t]),U=useCallback(oe=>{if(!m||!oe.target.files)return;let Re=Array.from(oe.target.files),Z=v*1024*1024,Pe=Re.filter(Ue=>Ue.size>Z?(console.warn(`File ${Ue.name} exceeds max size of ${v}MB`),false):true);Pe.length>0&&m(Pe),oe.target.value="";},[m,v]),We=useCallback(oe=>oe.type.startsWith("image/")?Image:oe.type.includes("pdf")||oe.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&V.current){let oe=V.current.children[k];oe&&oe.scrollIntoView({block:"nearest"});}},[k,b]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(oe=>{let Re=We(oe.file),Z=oe.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[Z&&oe.preview?jsx("img",{src:oe.preview,alt:oe.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Re,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:oe.file.name}),jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Nh(oe.file.size)})]}),f&&jsx("button",{onClick:()=>f(oe.id),className:g("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},oe.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{ref:Q,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Dh.map(oe=>jsx("button",{type:"button",onClick:()=>ve(oe),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:oe},oe))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:O,type:"file",multiple:true,onChange:U,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:T,value:e,onChange:Le,onSelect:G,onKeyDown:$,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&x.length>0&&jsx(motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((oe,Re)=>jsxs("button",{type:"button",onClick:()=>Ne(oe),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Re===k?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:oe.color||"#8B5CF6"},children:Th(oe.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:oe.name}),oe.email&&jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:oe.email})]})]},oe.id))})})]})]})]})}function Rp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},c):jsx("span",{children:l.value},c))})}var zi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function as({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(false),[m,f]=useState(zi[10]||"#00E5CC"),[v,h]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),k=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),M=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&y.current){let T=y.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[l]),useEffect(()=>{let T=V=>{let O=V.target,Q=b.current?.contains(O),L=x.current?.contains(O);!Q&&!L&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let I=T=>{let V=e.some(O=>O.id===T.id);a(V?e.filter(O=>O.id!==T.id):[...e,T]);},C=async()=>{if(!(!r||!i.trim())){d(true);try{let T=await r(i.trim(),m);T&&(a([...e,T]),u(""),f(zi[Math.floor(Math.random()*zi.length)]||"#00E5CC"));}finally{d(false);}}},N=(T,V)=>{V.stopPropagation(),a(e.filter(O=>O.id!==T));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:T=>u(T.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:T=>{T.key==="Enter"&&i.trim()&&!M&&r&&C();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(T=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:V=>N(T.id,V),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(T=>{let V=e.some(O=>O.id===T.id);return jsxs("button",{type:"button",onClick:()=>I(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:zi.map(T=>jsx("button",{type:"button",onClick:()=>f(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:m===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxs("button",{type:"button",onClick:C,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function kc({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function $p({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(kc,{tag:s,size:a},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var Po=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Op(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Rh(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Bh({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Cc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=Rh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Op(e.loggedMinutes),i=e.estimateMinutes?Op(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(Bh,{className:l[t]}),jsx("span",{children:u})]})}function $h(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Vi(e){let t=$h(e);return t!==null?String(t):e}function Up(e){let a=Vi(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Uh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Wh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function zh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Wp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Gh({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Tc({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?ji(t.estimateMinutes):""),[h,b]=useState(""),[y,x]=useState(false),[w,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let I=async()=>{let P=Up(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?Up(f):null;await o(P),k(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),I()),P.key==="Escape"&&u?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Wp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Uh(n)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(zh,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Wp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Wh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Gh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:M,type:"text",value:d,onChange:P=>m(P.target.value),onKeyDown:N,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:I,disabled:y||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:P=>b(P.target.value),onKeyDown:N,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ji(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?ji(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:ji(P.durationMinutes)})]},P.id))})]})]})}function qh(e){let a=Vi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Yh(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Dn({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,c]=useState(Yh(r)),[i,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=qh(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:l,onChange:x=>c(x.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:p||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Xh(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Jh(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Dc({summary:e,showLabel:t=false,size:a="md",className:r}){let n=Xh(e.health),s=Jh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",r),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function rs(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Zh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function ey(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function ty(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function ay({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",rs(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:rs(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:rs(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function ry({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?rs(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:rs(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[n,rs(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ey(e.status,a),Zh(e.status,a)),children:ty(e.status,t)})})]})}function Sc({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ay,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsx(ry,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",p),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function ns(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function hy(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Jp(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function yy(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Fo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:I=0,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:T,onTimerStop:V,onTimerDiscard:O,blurFinancials:Q=false}){let L=s==="dark",Le={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},G=e&&"title"in e&&!("name"in e),Ne=e,[$,ve]=useState(e?Jp(e,l):null),[U,We]=useState(false),[oe,Re]=useState(false),[Z,Pe]=useState(false),[Ue,Fe]=useState(null),[Be,rt]=useState(new Date),[le,Ve]=useState(false),[Qe,Ie]=useState(false),[ht,vt]=useState(""),[ot,Te]=useState(false),[mt,wt]=useState(false),[je,ut]=useState(false),[A,J]=useState(false),[ke,R]=useState(""),q=useRef(null),we=useRef(null),[Oe,me]=useState(""),et=useRef(null),[ce,ue]=useState(""),[$e,ct]=useState(false),[st,Ye]=useState([]),[kt,qt]=useState(""),[za,pa]=useState(false),Lt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let S=Jp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),ve(S),R(S.description||""),me(S.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!ke)return;let S=setTimeout(()=>{let W=we.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,ke]),useEffect(()=>()=>{q.current&&clearTimeout(q.current),et.current&&clearTimeout(et.current);},[]),useEffect(()=>{t&&Lt.current&&f.length>0&&setTimeout(()=>{Lt.current&&(Lt.current.scrollTop=Lt.current.scrollHeight);},100);},[t,f.length]);let Ht=useCallback(S=>{ve(S),G&&n&&Ne?n(yy(S,Ne)):r&&r(S);},[G,Ne,n,r]),ja=useCallback(()=>{We(false),Re(false),Pe(false),Fe(null),Ie(false),vt(""),Te(false);},[]),Bt=useCallback((S,W)=>{if(!$)return;let pe={...$,[S]:W};Ht(pe);},[$,Ht]),pr=useCallback(()=>{let S=we.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),ma=useCallback(S=>{R(S),setTimeout(pr,0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{if($){let W={...$,description:S};Ht(W);}},800);},[$,Ht,pr]),hr=useCallback(S=>{me(S),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{if($&&S.trim()){let W={...$,name:S.trim()};Ht(W);}},800);},[$,Ht]),Xe=useCallback(S=>{let W=S.map(pe=>{let Ce={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(Ce.preview=URL.createObjectURL(pe)),Ce});Ye(pe=>[...pe,...W]);},[]),Ze=useCallback(S=>{Ye(W=>{let pe=W.find(Ce=>Ce.id===S);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(Ce=>Ce.id!==S)});},[]),Fa=useCallback(async()=>{if(!(!$||!ce.trim()&&st.length===0||!v)){ct(true);try{let S=Ap(ce,b),W=[];if(st.length>0&&y){let pe=st.map(Ce=>Ce.file);W=await y(pe);}await v($.id,ce.trim(),S.length>0?S:void 0,W.length>0?W:void 0),ue(""),st.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),Ye([]);}finally{ct(false);}}},[$,ce,st,v,b,y]),La=useCallback(()=>{if(!$||!kt.trim())return;let S=$.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:kt.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},pe=[...S,W],Ce={...$,subtasks:pe};Ht(Ce),qt(""),pa(false);},[$,kt,Ht]),rr=useCallback(S=>{if(!$?.subtasks)return;let W=$.subtasks.map(Ce=>Ce.id===S?{...Ce,progress:Ce.progress===100?0:100}:Ce),pe={...$,subtasks:W};Ht(pe);},[$,Ht]),ka=useCallback(S=>{if(!$?.subtasks)return;let W=$.subtasks.filter(Ce=>Ce.id!==S),pe={...$,subtasks:W};Ht(pe);},[$,Ht]),Lr=useCallback(S=>{let W=typeof S=="string"?new Date(S):S,Ce=new Date().getTime()-W.getTime(),nt=Math.floor(Ce/6e4),be=Math.floor(Ce/36e5),_=Math.floor(Ce/864e5);return nt<1?o==="es"?"Ahora":"Just now":nt<60?o==="es"?`Hace ${nt} min`:`${nt}m ago`:be<24?o==="es"?`Hace ${be}h`:`${be}h ago`:_<7?o==="es"?`Hace ${_}d`:`${_}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),se=useCallback(S=>{if(!$)return;let W=$.progress||0;S==="completed"?W=100:S==="in-progress"&&W===0?W=10:S==="todo"&&(W=0);let pe={...$,status:S,progress:W};Ht(pe),We(false);},[$,Ht]),fe=useCallback((S,W)=>{if(!$)return;let pe={...$,startDate:S,endDate:W};Ht(pe);},[$,Ht]),pt=useCallback(()=>{let S=Be.getFullYear(),W=Be.getMonth(),pe=new Date(S,W,1),nt=new Date(S,W+1,0).getDate(),be=pe.getDay(),_=[],gt=new Date(S,W,0).getDate();for(let Ut=be-1;Ut>=0;Ut--)_.push({date:new Date(S,W-1,gt-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=nt;Ut++)_.push({date:new Date(S,W,Ut),isCurrentMonth:true});let bt=42-_.length;for(let Ut=1;Ut<=bt;Ut++)_.push({date:new Date(S,W+1,Ut),isCurrentMonth:false});return _},[Be]),j=useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),ut(false),!$||!p)return;let W=Array.from(S.dataTransfer.files);if(W.length!==0){J(true);try{await p($.id,W);}finally{J(false);}}},[$,p]),he=useCallback(async S=>{if(!$||!p||!S.target.files)return;let W=Array.from(S.target.files);if(W.length!==0){J(true);try{await p($.id,W);}finally{J(false);}S.target.value="";}},[$,p]),ae=useCallback(S=>{S.preventDefault(),S.stopPropagation(),ut(true);},[]),B=useCallback(S=>{S.preventDefault(),S.stopPropagation(),ut(false);},[]),ee=useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),De=useCallback(S=>S.startsWith("image/")?Image:S.includes("pdf")||S.includes("document")?FileText:File,[]);return !t||!$?null:jsx(AnimatePresence,{children:t&&$&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:$.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let S=$.progress===100?0:100,pe={...$,progress:S,status:S===100?"completed":"todo"};Ht(pe);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",$.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:$.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Oe,onChange:S=>hr(S.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",$.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{ja(),We(!U);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",$.progress===100||$.status==="completed"?"bg-green-500/20 text-green-400":$.progress&&$.progress>0||$.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:$.progress===100||$.status==="completed"?o==="es"?"COMPLETADO":"DONE":$.progress&&$.progress>0||$.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxs("button",{onClick:()=>se(S.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$.status===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{ja(),Pe(!Z);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$.assignees&&$.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[$.assignees.slice(0,3).map((S,W)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},W)),$.assignees.length>3&&jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",$.assignees.length-3]})]}):jsx("span",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Z&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(S=>{let W=$.assignees?.some(pe=>pe.name===S.name);return jsxs("button",{onClick:()=>{let pe=$.assignees||[],Ce;W?Ce=pe.filter(nt=>nt.name!==S.name):Ce=[...pe,S],Bt("assignees",Ce);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:S.name}),W&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Fe(Ue?null:"start"),rt($.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[$.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),$.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,W=new Date(S);W.setDate(S.getDate()+1);let pe=new Date(S);pe.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Ce=new Date(S);Ce.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let nt=new Date(S);nt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let be=new Date(S);be.setDate(S.getDate()+14);let _=new Date(S);return _.setDate(S.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:nt,display:nt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:be,display:be.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:_,display:_.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Ut)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ue==="start"){let Vt=$.endDate&&bt.date>$.endDate?bt.date:$.endDate;fe(bt.date,Vt),Fe("end");}else {let Vt=$.startDate&&bt.date<$.startDate?bt.date:$.startDate;fe(Vt,bt.date),Fe(null);}},children:[jsx("span",{children:bt.label}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Ut))})(),jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{fe(void 0,void 0),Fe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ue==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",L?"text-white":"text-gray-900"),children:Be.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>rt(new Date),className:g("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>rt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>rt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((S,W)=>{let pe=S.date.toDateString()===new Date().toDateString(),Ce=$.startDate?.toDateString()===S.date.toDateString(),nt=$.endDate?.toDateString()===S.date.toDateString(),be=Ce||nt,_=$.startDate&&$.endDate&&S.date>=$.startDate&&S.date<=$.endDate;return jsx("button",{onClick:()=>{let gt=new Date(S.date);if(Ue==="start"){let bt=$.endDate&>>$.endDate?gt:$.endDate;fe(gt,bt),Fe("end");}else {let bt=$.startDate&><$.startDate?gt:$.startDate;fe(bt,gt),Fe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(L?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",Ce&&"bg-[#00E5CC] text-white",nt&&!Ce&&"bg-[#7C3AED] text-white",_&&!be&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!be&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},W)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{ja(),Re(!oe);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",$.priority==="high"||$.priority==="urgent"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":$.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:$.priority?$.priority==="high"||$.priority==="urgent"?o==="es"?"Alta":"High":$.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxs("button",{onClick:()=>{Bt("priority",S.id),Re(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$.priority===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:$.startDate&&$.endDate?`${Math.ceil(($.endDate.getTime()-$.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[le?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:$.progress||0,onChange:S=>{let W=parseInt(S.target.value),pe=$.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let Ce={...$,progress:W,status:pe};Ht(Ce);},onBlur:()=>Ve(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ve(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",$.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${$.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[$.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:$.status==="completed"||$.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ns(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>wt("estimate"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ns(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>wt("estimate"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:mt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Dn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async S=>{await N?.($.id,S),wt(false);},onClose:()=>wt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Q?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):$.status==="completed"||$.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:$.quotedMinutes?ns($.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):$.quotedMinutes?jsx("button",{type:"button",onClick:()=>wt("quoted"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ns($.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>wt("quoted"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:mt==="quoted"&&!Q&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Dn,{mode:"quoted",locale:o,isDark:L,currentValue:$.quotedMinutes||null,onSave:async S=>{P?(await P($.id,S),ve(W=>W?{...W,quotedMinutes:S}:null)):Bt("quotedMinutes",S),wt(false);},onClose:()=>wt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[$.status==="completed"||$.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxs("button",{type:"button",onClick:()=>V?.($.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),hy(I||0)]}):jsx("button",{type:"button",onClick:()=>T?.($.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),$.status==="completed"||$.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>wt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[ns(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",ns(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:mt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Dn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(S,W)=>{S&&await C?.($.id,{durationMinutes:S,note:W,source:"manual"}),wt(false);},onClose:()=>wt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(as,{selectedTags:$.tags||[],availableTags:c,onChange:S=>{Bt("tags",S);},onCreateTag:i,theme:Le})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[$.dependencies&&$.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:$.dependencies.map(S=>{let W=m.find(pe=>pe.id===S);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||S.slice(0,8),jsx("button",{onClick:()=>{let pe=($.dependencies||[]).filter(Ce=>Ce!==S);Bt("dependencies",pe);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{onClick:()=>{ja(),Ie(!Qe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(false),vt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ht,onChange:S=>vt(S.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(S=>S.id!==$.id).filter(S=>ht===""||S.name.toLowerCase().includes(ht.toLowerCase())).map(S=>{let W=$.dependencies?.includes(S.id);return jsxs("button",{onClick:()=>{let pe=$.dependencies||[],Ce;W?Ce=pe.filter(nt=>nt!==S.id):Ce=[...pe,S.id],Bt("dependencies",Ce);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",W?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:W&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",L?"text-white":"text-gray-900"),children:S.name}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{ja(),Te(!ot);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:$.color||"#6366F1"}}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:Po.find(S=>S.value===$.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ot&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Po.map(S=>{let W=$.color===S.value;return jsx("button",{onClick:()=>{Bt("color",S.value),Te(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:W?S.value:void 0},title:S.name,children:W&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:$.isMilestone||false,onChange:S=>Bt("isMilestone",S.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",$.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:we,value:ke,onChange:S=>ma(S.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",$.subtasks&&$.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",$.subtasks.filter(S=>S.progress===100).length,"/",$.subtasks.length,")"]})]})}),$.subtasks&&$.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...$.subtasks].sort((S,W)=>(S.position??0)-(W.position??0)).map(S=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>rr(S.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:S.name}),jsx("button",{onClick:()=>ka(S.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),za?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:kt,onChange:S=>qt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&kt.trim()?La():S.key==="Escape"&&(pa(false),qt(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:La,disabled:!kt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",kt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{pa(false),qt("");},className:g("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>pa(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(S=>{let W=De(S.type),pe=S.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&S.thumbnailUrl?jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(W,{className:g("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:S.name}),jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ee(S.size)})]}),d&&jsx("button",{onClick:()=>d(S.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxs("div",{onDragOver:ae,onDragLeave:B,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",je?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:he,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||A}),A?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",je?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:je?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!p&&jsx("p",{className:g("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import zb from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Paperclip,Users,Tag,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,CalendarClock,FileText,Timer,Clock,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Check,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Filter,Zap,Layers,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var Bi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var $i=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [$i.Translate.toString(e),$i.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function g(...e){return twMerge(clsx(e))}function Oi(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function $b(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function hc(e,t){return e.length===0?1e3:t===0?Oi(null,e[0].position):t>=e.length?Oi(e[e.length-1].position,null):Oi(e[t-1].position,e[t].position)}function ep(e,t=100){return e>t}var Ob=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function Hb(e,t,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function Hi(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Ob,onRetry:l}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(p){if(c=p,u===a||!o(c,u))return {error:c,attempts:i,success:false};let m=Hb(u,r,n,s);if(l)try{l(c,u,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Ub(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Wb(e,t={}){return async(...a)=>Hi(()=>e(...a),t)}var yc=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var tp=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(tp||{}),Mo=class Mo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(l,n,c?o:"");break;case "INFO":console.info(l,n,c?o:"");break;case "WARN":console.warn(l,n,c?o:"");break;case "ERROR":console.error(l,n,c?o:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...Mo.globalOptions};}static configure(t){Mo.globalOptions={...Mo.globalOptions,...t};}child(t){return new Mo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Ui((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ui(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:tp[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};Mo.globalOptions={};var xc=Mo,Ui=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},ap=new xc;function Gb(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function Vb(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(l=>l.id===s.columnId);return [s.id,vc(s.title),vc(s.description||""),vc(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function jb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await zb(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),c=297,i=210,u=o.width/o.height,p=c-20,d=p/u;d>i-20&&(d=i-20,p=d*u);let m=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(l,"PNG",f,20,p,d),m}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(c=>c.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,s),s+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(c.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function vc(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function np(e,t,a,r){switch(t){case "json":return Gb(e,r);case "csv":return Vb(e);case "pdf":return await jb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function op(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function _b(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Kb(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=sp(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=sp(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(d),p.cardIds.push(d.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function sp(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function ip(e,t){switch(t){case "json":return _b(e);case "csv":return Kb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function lp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var wc=createContext(null);function cp(){return useContext(wc)}var dp=createContext(null);function up({children:e,themeName:t}){return jsx(dp.Provider,{value:{themeName:t},children:e})}function Wi(){return useContext(dp)}function ua({children:e,container:t}){let[a,r]=useState(false),n=cp(),s=Wi();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var bp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},th="#BDC3C7",ah=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Po({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let u=m=>{t(m),n(false);},p=e?bp[e]:null,d=p?.color||th;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ua,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(bp).map(([m,f])=>jsxs("button",{onClick:()=>u(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(ah,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var rh=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Vs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),d=(Wi()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,I=380,C=4,D=x.left;D+M>k-10&&(D=k-M-10),D<10&&(D=10);let P=w-x.bottom,N=x.top,V;P>=I+C?V=x.bottom+C:N>=I+C?V=x.top-I-C:V=P>=N?x.bottom+C:Math.max(10,x.top-I-C),l({top:V,left:D}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,k=D=>{let P=D.getFullYear(),N=String(D.getMonth()+1).padStart(2,"0"),V=String(D.getDate()).padStart(2,"0");return `${P}-${N}-${V}`},M=k(w),I=new Date(w);I.setDate(I.getDate()+x);let C=k(I);a(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=I.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let D=C[0],P=C[1],N=C[2];return D===void 0||P===void 0||N===void 0?null:new Date(D,P-1,N)},w=x(e),k=x(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=e&&t,y=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${v()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsx(ua,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:rh.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Lo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,c]=useState(""),[i,u]=useState({top:0,left:0}),p=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,I=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let D=x-y.bottom,P=y.top,N;D>=M+I?N=y.bottom+I:P>=M+I?N=y.top-M-I:N=D>=P?y.bottom+I:Math.max(10,y.top-M-I),u({top:N,left:C}),o(true);};useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:d,onClick:()=>s?o(false):m(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ua,{children:jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:v.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(y=>{let x=e.some(w=>w.id===y.id);return jsxs("button",{onClick:()=>f(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#00E5CC":"transparent"},children:x?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function zi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(c.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(c),false};return l(a)}function _s({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,h]=useState(null),b=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),D=window.innerHeight,P=window.innerWidth,N=300,V=p?380:120,O=4,J=C.right-N;J<10&&(J=C.left),J+N>P-10&&(J=P-N-10);let L=D-C.bottom,Le=C.top,G;L>=V+O?G=C.bottom+O:Le>=V+O?G=C.top-V-O:G=L>=Le?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:J}),c(true);};useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),D=window.innerHeight,P=window.innerWidth,N=300,V=p?380:120,O=4,J=C.right-N;J<10&&(J=C.left),J+N>P-10&&(J=P-N-10);let L=D-C.bottom,Le=C.top,G;L>=V+O?G=C.bottom+O:Le>=V+O?G=C.top-V-O:G=L>=Le?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:J});},[p,l]),useEffect(()=>{let C=D=>{b.current&&!b.current.contains(D.target)&&!y.current?.contains(D.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=D=>{D.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let D=t.includes(C),P=a.find(N=>N.id===C);if(h(null),D){let N=t.filter(V=>V!==C);r(N),N.length===0&&d(false);}else {if(s&&zi(a,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}r([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||r([]);},M=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>l?c(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),l&&jsx(ua,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[v&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),p&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:C=>u(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):M.map(C=>{let D=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:D?"#00E5CC":"transparent",borderColor:D?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:D&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Wn=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:$i.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...i,...u,onClick:()=>a?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Po,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Vs,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Lo,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(_s,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Wn.displayName="Card";var Gi={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Dp=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Sp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries(Gi).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(Gi).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=Gi[e];if(h)return {...h,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Gi.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let I=b-h.bottom,C=h.top,D;I>=w+k?D=h.bottom+k:C>=w+k?D=h.top-w-k:D=I>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:D,left:M}),s(true);};useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>n?s(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsx(Dp,{icon:f.icon,color:v})}),n&&jsx(ua,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(h=>jsxs("button",{onClick:()=>m(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Dp,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Ep={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Mp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Ep[s]||Ep.en,[l,c]=useState(false),[i,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),b=useRef(null);useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(ua,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,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)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:p,onChange:k=>d(k.target.value),onKeyDown:w,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var ls=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),I=u??ep(t.length),C=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:I}),D=t.filter(J=>!J.metadata?.isContainer).length;if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let N=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let J=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:J}:J>=80?{state:"warning",percentage:J}:J>=60?{state:"approaching",percentage:J}:{state:"ok",percentage:J}})(),V=N.state==="exceeded",O=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,D):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g(O()),children:[D,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&N.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${N.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[N.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),N.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),N.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),N.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsx(Mp,{columnTitle:e.title,onRename:J=>f?.(e.id,J),onDelete:v?()=>v(e.id):void 0,isDeletable:h,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:I?"600px":void 0},children:jsx(SortableContext,{items:t.map(J=>J.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):I?jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(J=>{let L=t[J.index];return L?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${J.start}px)`},children:jsx(Wn,{card:L,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},L.id):null})}):t.map(J=>jsx(Wn,{card:J,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i},J.id))})})]})});ls.displayName="Column";function Dc({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Ch(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Rp(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Th(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Dh=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Bp({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=useState(false),[x,w]=useState([]),[k,M]=useState(0),[I,C]=useState(null),[D,P]=useState(false),N=useRef(null),V=useRef(null),O=useRef(null),J=useRef(null),L=useCallback((oe,Re)=>{let Q=Ch(oe,Re);if(C(Q),Q){let Pe=r.filter(We=>We.name.toLowerCase().includes(Q.query)||We.email&&We.email.toLowerCase().includes(Q.query)).slice(0,5);w(Pe),y(Pe.length>0),M(0);}else y(false),w([]);},[r]),Le=oe=>{let Re=oe.target.value;if(t(Re),L(Re,oe.target.selectionStart||0),N.current){N.current.style.height="24px";let Q=N.current.scrollHeight,Pe=280,We=Math.min(Q,Pe);N.current.style.height=`${We}px`,N.current.style.overflowY=Q>Pe?"auto":"hidden";}},G=()=>{N.current&&L(e,N.current.selectionStart||0);},Ne=useCallback(oe=>{if(!I||!N.current)return;let Re=e.slice(0,I.start),Q=e.slice(I.end),Pe=`@${oe.name.replace(/\s+/g,"")} `,We=Re+Pe+Q;t(We),y(false),C(null),setTimeout(()=>{if(N.current){let Fe=I.start+Pe.length;N.current.selectionStart=Fe,N.current.selectionEnd=Fe,N.current.focus();}},0);},[I,e,t]),$=oe=>{if(b&&x.length>0)switch(oe.key){case "ArrowDown":oe.preventDefault(),M(Re=>Re<x.length-1?Re+1:0);break;case "ArrowUp":oe.preventDefault(),M(Re=>Re>0?Re-1:x.length-1);break;case "Enter":{oe.preventDefault();let Re=x[k];Re&&Ne(Re);break}case "Tab":{oe.preventDefault();let Re=x[k];Re&&Ne(Re);break}case "Escape":oe.preventDefault(),y(false);break}else oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),a());};useEffect(()=>{let oe=Re=>{V.current&&!V.current.contains(Re.target)&&N.current&&!N.current.contains(Re.target)&&y(false),J.current&&!J.current.contains(Re.target)&&P(false);};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]);let ve=useCallback(oe=>{if(!N.current)return;let Re=N.current.selectionStart||e.length,Q=e.slice(0,Re)+oe+e.slice(Re);t(Q),P(false),setTimeout(()=>{if(N.current){let Pe=Re+oe.length;N.current.selectionStart=Pe,N.current.selectionEnd=Pe,N.current.focus();}},0);},[e,t]),U=useCallback(oe=>{if(!m||!oe.target.files)return;let Re=Array.from(oe.target.files),Q=v*1024*1024,Pe=Re.filter(We=>We.size>Q?(console.warn(`File ${We.name} exceeds max size of ${v}MB`),false):true);Pe.length>0&&m(Pe),oe.target.value="";},[m,v]),ze=useCallback(oe=>oe.type.startsWith("image/")?Image:oe.type.includes("pdf")||oe.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&V.current){let oe=V.current.children[k];oe&&oe.scrollIntoView({block:"nearest"});}},[k,b]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(oe=>{let Re=ze(oe.file),Q=oe.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[Q&&oe.preview?jsx("img",{src:oe.preview,alt:oe.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Re,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:oe.file.name}),jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Nh(oe.file.size)})]}),f&&jsx("button",{onClick:()=>f(oe.id),className:g("p-0.5 rounded-full transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},oe.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&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:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!D),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:D&&jsx(motion.div,{ref:J,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Dh.map(oe=>jsx("button",{type:"button",onClick:()=>ve(oe),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:oe},oe))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:O,type:"file",multiple:true,onChange:U,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:Le,onSelect:G,onKeyDown:$,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",h?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&x.length>0&&jsx(motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((oe,Re)=>jsxs("button",{type:"button",onClick:()=>Ne(oe),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Re===k?h?"bg-white/10":"bg-gray-100":h?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:oe.color||"#8B5CF6"},children:Th(oe.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:oe.name}),oe.email&&jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:oe.email})]})]},oe.id))})})]})]})]})}function $p({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},c):jsx("span",{children:l.value},c))})}var qi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function cs({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(false),[m,f]=useState(qi[10]||"#00E5CC"),[v,h]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),k=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),M=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();h({top:N.bottom+6,left:N.left});}},[l]),useEffect(()=>{let N=V=>{let O=V.target,J=b.current?.contains(O),L=x.current?.contains(O);!J&&!L&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let I=N=>{let V=e.some(O=>O.id===N.id);a(V?e.filter(O=>O.id!==N.id):[...e,N]);},C=async()=>{if(!(!r||!i.trim())){d(true);try{let N=await r(i.trim(),m);N&&(a([...e,N]),u(""),f(qi[Math.floor(Math.random()*qi.length)]||"#00E5CC"));}finally{d(false);}}},D=(N,V)=>{V.stopPropagation(),a(e.filter(O=>O.id!==N));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>u(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!M&&r&&C();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:V=>D(N.id,V),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(N=>{let V=e.some(O=>O.id===N.id);return jsxs("button",{type:"button",onClick:()=>I(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:qi.map(N=>jsx("button",{type:"button",onClick:()=>f(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:C,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function Ec({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Hp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Ec,{tag:s,size:a},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var Io=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Up(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function Rh(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Bh({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Mc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=Rh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Up(e.loggedMinutes),i=e.estimateMinutes?Up(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(Bh,{className:l[t]}),jsx("span",{children:u})]})}function $h(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Xi(e){let t=$h(e);return t!==null?String(t):e}function zp(e){let a=Xi(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Uh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Wh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function zh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Gp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Gh({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Pc({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Ji(t.estimateMinutes):""),[h,b]=useState(""),[y,x]=useState(false),[w,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let I=async()=>{let P=zp(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?zp(f):null;await o(P),k(false);},D=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),I()),P.key==="Escape"&&u?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Gp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Uh(n)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(zh,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Gp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Wh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Gh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:M,type:"text",value:d,onChange:P=>m(P.target.value),onKeyDown:D,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:I,disabled:y||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:P=>b(P.target.value),onKeyDown:D,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ji(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ji(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ji(P.durationMinutes)})]},P.id))})]})]})}function qh(e){let a=Xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Yh(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Sn({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,c]=useState(Yh(r)),[i,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=qh(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:l,onChange:x=>c(x.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:p||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function Xh(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Jh(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Lc({summary:e,showLabel:t=false,size:a="md",className:r}){let n=Xh(e.health),s=Jh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",r),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function ds(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Zh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function ey(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function ty(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function ay({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",ds(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:ds(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:ds(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function ry({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?ds(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:ds(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[n,ds(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ey(e.status,a),Zh(e.status,a)),children:ty(e.status,t)})})]})}function Ac({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ay,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsx(ry,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",p),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function us(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function hy(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Zp(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function yy(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Ro({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:I=0,onTimeLog:C,onEstimateUpdate:D,onSoldEffortUpdate:P,onTimerStart:N,onTimerStop:V,onTimerDiscard:O,blurFinancials:J=false}){let L=s==="dark",Le={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},G=e&&"title"in e&&!("name"in e),Ne=e,[$,ve]=useState(e?Zp(e,l):null),[U,ze]=useState(false),[oe,Re]=useState(false),[Q,Pe]=useState(false),[We,Fe]=useState(null),[Be,rt]=useState(new Date),[ce,Ve]=useState(false),[Qe,Ie]=useState(false),[ht,vt]=useState(""),[ot,Te]=useState(false),[mt,wt]=useState(false),[je,dt]=useState(false),[A,X$1]=useState(false),[ke,R]=useState(""),q=useRef(null),we=useRef(null),[Ue,me]=useState(""),et=useRef(null),[de,ue]=useState(""),[Oe,lt]=useState(false),[st,qe]=useState([]),[kt,Yt]=useState(""),[za,ma]=useState(false),Lt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let S=Zp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),ve(S),R(S.description||""),me(S.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!ke)return;let S=setTimeout(()=>{let W=we.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,ke]),useEffect(()=>()=>{q.current&&clearTimeout(q.current),et.current&&clearTimeout(et.current);},[]),useEffect(()=>{t&&Lt.current&&f.length>0&&setTimeout(()=>{Lt.current&&(Lt.current.scrollTop=Lt.current.scrollHeight);},100);},[t,f.length]);let Ht=useCallback(S=>{ve(S),G&&n&&Ne?n(yy(S,Ne)):r&&r(S);},[G,Ne,n,r]),_a=useCallback(()=>{ze(false),Re(false),Pe(false),Fe(null),Ie(false),vt(""),Te(false);},[]),Bt=useCallback((S,W)=>{if(!$)return;let pe={...$,[S]:W};Ht(pe);},[$,Ht]),pr=useCallback(()=>{let S=we.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),ga=useCallback(S=>{R(S),setTimeout(pr,0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{if($){let W={...$,description:S};Ht(W);}},800);},[$,Ht,pr]),br=useCallback(S=>{me(S),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{if($&&S.trim()){let W={...$,name:S.trim()};Ht(W);}},800);},[$,Ht]),Ye=useCallback(S=>{let W=S.map(pe=>{let Ce={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(Ce.preview=URL.createObjectURL(pe)),Ce});qe(pe=>[...pe,...W]);},[]),Ze=useCallback(S=>{qe(W=>{let pe=W.find(Ce=>Ce.id===S);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(Ce=>Ce.id!==S)});},[]),Fa=useCallback(async()=>{if(!(!$||!de.trim()&&st.length===0||!v)){lt(true);try{let S=Rp(de,b),W=[];if(st.length>0&&y){let pe=st.map(Ce=>Ce.file);W=await y(pe);}await v($.id,de.trim(),S.length>0?S:void 0,W.length>0?W:void 0),ue(""),st.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),qe([]);}finally{lt(false);}}},[$,de,st,v,b,y]),La=useCallback(()=>{if(!$||!kt.trim())return;let S=$.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:kt.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},pe=[...S,W],Ce={...$,subtasks:pe};Ht(Ce),Yt(""),ma(false);},[$,kt,Ht]),nr=useCallback(S=>{if(!$?.subtasks)return;let W=$.subtasks.map(Ce=>Ce.id===S?{...Ce,progress:Ce.progress===100?0:100}:Ce),pe={...$,subtasks:W};Ht(pe);},[$,Ht]),ka=useCallback(S=>{if(!$?.subtasks)return;let W=$.subtasks.filter(Ce=>Ce.id!==S),pe={...$,subtasks:W};Ht(pe);},[$,Ht]),Ar=useCallback(S=>{let W=typeof S=="string"?new Date(S):S,Ce=new Date().getTime()-W.getTime(),nt=Math.floor(Ce/6e4),be=Math.floor(Ce/36e5),_=Math.floor(Ce/864e5);return nt<1?o==="es"?"Ahora":"Just now":nt<60?o==="es"?`Hace ${nt} min`:`${nt}m ago`:be<24?o==="es"?`Hace ${be}h`:`${be}h ago`:_<7?o==="es"?`Hace ${_}d`:`${_}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),se=useCallback(S=>{if(!$)return;let W=$.progress||0;S==="completed"?W=100:S==="in-progress"&&W===0?W=10:S==="todo"&&(W=0);let pe={...$,status:S,progress:W};Ht(pe),ze(false);},[$,Ht]),fe=useCallback((S,W)=>{if(!$)return;let pe={...$,startDate:S,endDate:W};Ht(pe);},[$,Ht]),ut=useCallback(()=>{let S=Be.getFullYear(),W=Be.getMonth(),pe=new Date(S,W,1),nt=new Date(S,W+1,0).getDate(),be=pe.getDay(),_=[],gt=new Date(S,W,0).getDate();for(let Ut=be-1;Ut>=0;Ut--)_.push({date:new Date(S,W-1,gt-Ut),isCurrentMonth:false});for(let Ut=1;Ut<=nt;Ut++)_.push({date:new Date(S,W,Ut),isCurrentMonth:true});let bt=42-_.length;for(let Ut=1;Ut<=bt;Ut++)_.push({date:new Date(S,W+1,Ut),isCurrentMonth:false});return _},[Be]),j=useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),dt(false),!$||!p)return;let W=Array.from(S.dataTransfer.files);if(W.length!==0){X$1(true);try{await p($.id,W);}finally{X$1(false);}}},[$,p]),ye=useCallback(async S=>{if(!$||!p||!S.target.files)return;let W=Array.from(S.target.files);if(W.length!==0){X$1(true);try{await p($.id,W);}finally{X$1(false);}S.target.value="";}},[$,p]),ne=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(true);},[]),B=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(false);},[]),ee=useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),De=useCallback(S=>S.startsWith("image/")?Image:S.includes("pdf")||S.includes("document")?FileText:File,[]);return !t||!$?null:jsx(AnimatePresence,{children:t&&$&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:$.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let S=$.progress===100?0:100,pe={...$,progress:S,status:S===100?"completed":"todo"};Ht(pe);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",$.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:$.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ue,onChange:S=>br(S.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",$.progress===100?"line-through text-[#6B7280]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{_a(),ze(!U);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",$.progress===100||$.status==="completed"?"bg-green-500/20 text-green-400":$.progress&&$.progress>0||$.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:$.progress===100||$.status==="completed"?o==="es"?"COMPLETADO":"DONE":$.progress&&$.progress>0||$.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:U&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxs("button",{onClick:()=>se(S.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$.status===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{_a(),Pe(!Q);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$.assignees&&$.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[$.assignees.slice(0,3).map((S,W)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},W)),$.assignees.length>3&&jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",$.assignees.length-3]})]}):jsx("span",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Q&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(S=>{let W=$.assignees?.some(pe=>pe.name===S.name);return jsxs("button",{onClick:()=>{let pe=$.assignees||[],Ce;W?Ce=pe.filter(nt=>nt.name!==S.name):Ce=[...pe,S],Bt("assignees",Ce);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:S.name}),W&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Fe(We?null:"start"),rt($.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[$.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),$.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:We&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Fe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,W=new Date(S);W.setDate(S.getDate()+1);let pe=new Date(S);pe.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Ce=new Date(S);Ce.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let nt=new Date(S);nt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let be=new Date(S);be.setDate(S.getDate()+14);let _=new Date(S);return _.setDate(S.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Ce,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:nt,display:nt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:be,display:be.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:_,display:_.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Ut)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(We==="start"){let Vt=$.endDate&&bt.date>$.endDate?bt.date:$.endDate;fe(bt.date,Vt),Fe("end");}else {let Vt=$.startDate&&bt.date<$.startDate?bt.date:$.startDate;fe(Vt,bt.date),Fe(null);}},children:[jsx("span",{children:bt.label}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Ut))})(),jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{fe(void 0,void 0),Fe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:We==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",L?"text-white":"text-gray-900"),children:Be.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>rt(new Date),className:g("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>rt(new Date(Be.getFullYear(),Be.getMonth()-1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>rt(new Date(Be.getFullYear(),Be.getMonth()+1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:ut().map((S,W)=>{let pe=S.date.toDateString()===new Date().toDateString(),Ce=$.startDate?.toDateString()===S.date.toDateString(),nt=$.endDate?.toDateString()===S.date.toDateString(),be=Ce||nt,_=$.startDate&&$.endDate&&S.date>=$.startDate&&S.date<=$.endDate;return jsx("button",{onClick:()=>{let gt=new Date(S.date);if(We==="start"){let bt=$.endDate&>>$.endDate?gt:$.endDate;fe(gt,bt),Fe("end");}else {let bt=$.startDate&><$.startDate?gt:$.startDate;fe(bt,gt),Fe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(L?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",Ce&&"bg-[#00E5CC] text-white",nt&&!Ce&&"bg-[#7C3AED] text-white",_&&!be&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!be&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},W)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{_a(),Re(!oe);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",$.priority==="high"||$.priority==="urgent"?"bg-red-500/20 text-red-400":$.priority==="medium"?"bg-yellow-500/20 text-yellow-400":$.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:$.priority?$.priority==="high"||$.priority==="urgent"?o==="es"?"Alta":"High":$.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxs("button",{onClick:()=>{Bt("priority",S.id),Re(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$.priority===S.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:$.startDate&&$.endDate?`${Math.ceil(($.endDate.getTime()-$.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ce?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:$.progress||0,onChange:S=>{let W=parseInt(S.target.value),pe=$.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let Ce={...$,progress:W,status:pe};Ht(Ce);},onBlur:()=>Ve(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ve(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",$.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${$.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[$.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:$.status==="completed"||$.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?us(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>wt("estimate"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:us(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>wt("estimate"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:mt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Sn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async S=>{await D?.($.id,S),wt(false);},onClose:()=>wt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:J?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):$.status==="completed"||$.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:$.quotedMinutes?us($.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):$.quotedMinutes?jsx("button",{type:"button",onClick:()=>wt("quoted"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:us($.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>wt("quoted"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:mt==="quoted"&&!J&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Sn,{mode:"quoted",locale:o,isDark:L,currentValue:$.quotedMinutes||null,onSave:async S=>{P?(await P($.id,S),ve(W=>W?{...W,quotedMinutes:S}:null)):Bt("quotedMinutes",S),wt(false);},onClose:()=>wt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[$.status==="completed"||$.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxs("button",{type:"button",onClick:()=>V?.($.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),hy(I||0)]}):jsx("button",{type:"button",onClick:()=>N?.($.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),$.status==="completed"||$.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>wt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[us(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",us(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:mt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Sn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(S,W)=>{S&&await C?.($.id,{durationMinutes:S,note:W,source:"manual"}),wt(false);},onClose:()=>wt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(cs,{selectedTags:$.tags||[],availableTags:c,onChange:S=>{Bt("tags",S);},onCreateTag:i,theme:Le})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[$.dependencies&&$.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:$.dependencies.map(S=>{let W=m.find(pe=>pe.id===S);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||S.slice(0,8),jsx("button",{onClick:()=>{let pe=($.dependencies||[]).filter(Ce=>Ce!==S);Bt("dependencies",pe);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{onClick:()=>{_a(),Ie(!Qe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(false),vt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ht,onChange:S=>vt(S.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(S=>S.id!==$.id).filter(S=>ht===""||S.name.toLowerCase().includes(ht.toLowerCase())).map(S=>{let W=$.dependencies?.includes(S.id);return jsxs("button",{onClick:()=>{let pe=$.dependencies||[],Ce;W?Ce=pe.filter(nt=>nt!==S.id):Ce=[...pe,S.id],Bt("dependencies",Ce);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",W?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:W&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",L?"text-white":"text-gray-900"),children:S.name}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{_a(),Te(!ot);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:$.color||"#6366F1"}}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:Io.find(S=>S.value===$.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ot&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Io.map(S=>{let W=$.color===S.value;return jsx("button",{onClick:()=>{Bt("color",S.value),Te(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:W?S.value:void 0},title:S.name,children:W&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:$.isMilestone||false,onChange:S=>Bt("isMilestone",S.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",$.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:we,value:ke,onChange:S=>ga(S.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",$.subtasks&&$.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",$.subtasks.filter(S=>S.progress===100).length,"/",$.subtasks.length,")"]})]})}),$.subtasks&&$.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...$.subtasks].sort((S,W)=>(S.position??0)-(W.position??0)).map(S=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>nr(S.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:S.name}),jsx("button",{onClick:()=>ka(S.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),za?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:kt,onChange:S=>Yt(S.target.value),onKeyDown:S=>{S.key==="Enter"&&kt.trim()?La():S.key==="Escape"&&(ma(false),Yt(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:La,disabled:!kt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",kt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{ma(false),Yt("");},className:g("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>ma(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(S=>{let W=De(S.type),pe=S.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&S.thumbnailUrl?jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(W,{className:g("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:S.name}),jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ee(S.size)})]}),d&&jsx("button",{onClick:()=>d(S.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxs("div",{onDragOver:ne,onDragLeave:B,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",je?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ye,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||A}),A?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",je?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:je?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!p&&jsx("p",{className:g("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:Lt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((S,W)=>{let pe=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,Ce=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-Ce.getTime()}).map(S=>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:S.user?.color||"#8B5CF6"},children:S.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:g("text-sm font-medium",L?"text-white":"text-gray-900"),children:S.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Lr(S.createdAt)})]}),jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Rp,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsx(Image,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},S.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Ip,{value:ce,onChange:ue,onSubmit:Fa,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:$e,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:st,onFilesSelect:Xe,onRemoveFile:Ze})})]})]})]})})}function Mc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function oo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,timerState:N,onLogTime:P,onUpdateEstimate:T,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:Q,onDiscardTimer:L,blurFinancials:Le=false,sidePanel:G,renderColumnMetrics:Ne,suppressDetailModal:$=false}){let[ve,U]=Mc(),[We,oe]=useState(null),[Re,Z]=useState(false),Pe=useRef(null),Ue=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Fe=n?.theme||"dark",Be=Fe==="dark"||Fe==="neutral",rt=Be?"dark":"",le=useCallback((A,J)=>{t.onCardUpdate?.(A,J);},[t]),Ve=useCallback((A,J)=>{t.onColumnUpdate?.(A,{title:J});},[t]),Qe=useCallback(A=>{t.onColumnDelete?.(A);},[t]),Ie=["todo","in-progress","completed"],ht=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),vt=useMemo(()=>{let A=new Map;return e.columns.forEach(J=>{let ke=J.cardIds.map(R=>e.cards.find(q=>q.id===R)).filter(R=>R!==void 0).sort((R,q)=>R.position-q.position);A.set(J.id,ke);}),A},[e.cards,e.columns]);useEffect(()=>{let A=Pe.current;if(!A)return;let J=we=>{let Oe=we.target,me=we.button===1,et=Oe===A||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(me||we.button===0&&et&&!ve.isDragging)&&(we.preventDefault(),Z(true),Ue.current={x:we.clientX,y:we.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},ke=we=>{if(!Re)return;let Oe=we.clientX-Ue.current.x,me=we.clientY-Ue.current.y;A.scrollLeft=Ue.current.scrollLeft-Oe,A.scrollTop=Ue.current.scrollTop-me;},R=()=>{Re&&(Z(false),A.style.cursor="",A.style.userSelect="");},q=()=>{Re&&(Z(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",J),document.addEventListener("mousemove",ke),document.addEventListener("mouseup",R),A.addEventListener("mouseleave",q),()=>{A.removeEventListener("mousedown",J),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",R),A.removeEventListener("mouseleave",q);}},[Re,ve.isDragging]);let ot=useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),Te=useCallback(A=>{let{active:J}=A,ke=e.cards.find(R=>R.id===J.id);ke&&U({isDragging:true,draggedCardId:ke.id,sourceColumnId:ke.columnId,targetColumnId:ke.columnId});},[e.cards,U]),mt=useCallback(A=>{let{active:J,over:ke}=A;if(!ke||!e.cards.find(we=>we.id===J.id))return;let q=null;ke.data.current?.type==="column"?q=ke.id:ke.data.current?.type==="card"&&(q=e.cards.find(Oe=>Oe.id===ke.id)?.columnId||null),q&&q!==ve.targetColumnId&&U({...ve,targetColumnId:q});},[e.cards,ve,U]),wt=useCallback(async A=>{let{active:J,over:ke}=A;if(U({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ke)return;let R=e.cards.find(me=>me.id===J.id);if(!R)return;let q,we;if(ke.data.current?.type==="column"){q=ke.id;let me=vt.get(q)||[];we=uc(me,0);}else {let me=e.cards.find(ue=>ue.id===ke.id);if(!me)return;q=me.columnId;let et=vt.get(q)||[],ce=et.findIndex(ue=>ue.id===ke.id);we=uc(et,ce);}let Oe=e.columns.find(me=>me.id===q);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let me=vt.get(q)||[];if(R.columnId!==q&&me.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,R);return}}(R.columnId!==q||R.position!==we)&&await t.onCardMove?.(R.id,q,we);},[e.cards,e.columns,vt,t,U]),je=useCallback(A=>{$||oe(A),a?.(A),w?.(A.id);},[a,w,$]),ut=useCallback(A=>{t.onCardUpdate?.(A.id,A),oe(A);},[t]);return c?jsx("div",{className:g("asakaa-board",rt,o),style:l,children:jsx(Py,{columnCount:3})}):i?jsx("div",{className:g("asakaa-board",rt,o),style:l,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 i=="string"?i:i.message})]})})}):jsxs(cp,{themeName:Fe,children:[jsxs("div",{className:g("flex h-full overflow-hidden",G?"flex-row":""),children:[jsxs(DndContext,{sensors:ht,collisionDetection:closestCorners,onDragStart:Te,onDragOver:mt,onDragEnd:wt,children:[jsxs("div",{ref:Pe,className:g("asakaa-board",G?"flex-1":"",rt,o),style:{...l,cursor:Re?"grabbing":void 0},"data-theme":Fe,children:[e.columns.sort((A,J)=>A.position-J.position).map(A=>{let J=vt.get(A.id)||[],ke=!Ie.includes(A.id),R=r?.renderColumnFooter?.(A);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(ts,{column:A,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ne?(q,we)=>Ne(q,we):void 0,onCardClick:je,onCardUpdate:le,onColumnRename:t.onColumnUpdate?Ve:void 0,onColumnDelete:t.onColumnDelete?Qe:void 0,isDeletable:ke,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(A.id)}),R]},A.id)}),u]}),jsx(DragOverlay,{children:ve.draggedCardId?jsx(On,{card:e.cards.find(A=>A.id===ve.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),G]}),!$&&jsx(Fo,{task:We,isOpen:!!We,onClose:()=>oe(null),onCardUpdate:ut,theme:Be?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:We?m?.get(We.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:ot,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:T,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:Q,onTimerDiscard:L,blurFinancials:Le})]})}function Py({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 Ry={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, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},By={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},$y={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Oy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hy({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||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((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Uy({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||r||n))return null;let p=[{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:n}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Wy({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, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Fc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=r==="dark"?Ry:By,m={...n==="es"?$y:Oy,...i},f=o||l||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:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Uy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsx(Hy,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(Wy,{onClick:()=>t(),label:a||m.newTask}))]})})}function Ac({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.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(""),o(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:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,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 Ks({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(false),[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(s||new Date),C=useRef(null),N=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{C.current?.focus();},[]);let T=useCallback(()=>{b(false),x(false),k(false);},[]),V=useCallback(()=>{i(""),p(void 0),m(null),v(null),T(),t();},[t,T]),O=f||s||new Date,Q=useCallback(()=>{let G=c.trim();if(!G)return;let Ne=a.find(ve=>ve.id===d),$=O;e({name:G,priority:u,assignee:Ne||void 0,assigneeId:d,startDate:$,endDate:$}),i(""),p(void 0),m(null),v(null),T(),C.current?.focus();},[c,u,d,O,a,e,T]),L=useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),Q()),G.key==="Escape"&&V();},[Q,V,c]),Le=O;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>T(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:C,type:"text",value:c,onChange:G=>i(G.target.value),placeholder:N?"Nombre de la tarea...":"Task name...",className:g("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:L})}),jsxs("div",{className:g("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:G=>{G.stopPropagation(),b(!h),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:N?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:N?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:N?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:N?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:N?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxs("button",{onClick:()=>{p(G.id),b(false);},type:"button",className:g("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",u===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",G.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:G=>{G.stopPropagation(),k(!w),b(false),x(false),I(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":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"}),Le.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,Ne=new Date(G);Ne.setDate(G.getDate()+1);let $=new Date(G);$.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let ve=new Date(G);ve.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let U=new Date(G);U.setDate(G.getDate()+14);let We=new Date(G);We.setDate(G.getDate()+28);let oe=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:G,display:G.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:Ne,display:Ne.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:$,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:ve,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:U,display:U.toLocaleDateString(oe,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(oe,{day:"numeric",month:"short"})}].map((Z,Pe)=>jsxs("button",{type:"button",className:g("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:()=>{v(Z.date),k(false);},children:[jsx("span",{children:Z.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Z.display})]},Pe))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:M.toLocaleDateString(N?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>I(new Date),className:g("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:N?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>I(new Date(M.getFullYear(),M.getMonth()-1)),className:g("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:()=>I(new Date(M.getFullYear(),M.getMonth()+1)),className:g("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:(N?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:G},G))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=M.getFullYear(),Ne=M.getMonth(),$=new Date(G,Ne,1).getDay(),ve=new Date(G,Ne+1,0).getDate(),U=new Date(G,Ne,0).getDate(),We=new Date().toDateString(),oe=[];for(let Z=$-1;Z>=0;Z--)oe.push({dayNum:U-Z,isCurrent:false,date:new Date(G,Ne-1,U-Z)});for(let Z=1;Z<=ve;Z++)oe.push({dayNum:Z,isCurrent:true,date:new Date(G,Ne,Z)});let Re=42-oe.length;for(let Z=1;Z<=Re;Z++)oe.push({dayNum:Z,isCurrent:false,date:new Date(G,Ne+1,Z)});return oe.map((Z,Pe)=>{let Ue=Z.date.toDateString()===We,Fe=(f||s)?.toDateString()===Z.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!Z.isCurrent&&(r?"text-white/20":"text-gray-300"),Z.isCurrent&&(r?"text-white":"text-gray-900"),Ue&&"ring-1 ring-[#007FFF]",Fe&&"bg-[#007FFF] text-white",!Fe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(Z.date),k(false);},children:Z.dayNum},Pe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:G=>{G.stopPropagation(),x(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?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(G=>G.id===d)?.color||"#007FFF"},children:a.find(G=>G.id===d)?.initials||a.find(G=>G.id===d)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("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",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("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:N?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxs("button",{type:"button",onClick:()=>{m(G.id),x(false);},className:g("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",d===G.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:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:Q,disabled:!c.trim(),type:"button",className:g("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:N?"Guardar":"Save"})]})]})}function Oc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let w=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:u,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!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"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("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(Ks,{onSubmit:x,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Ys=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(oo,{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 n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
|
|
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((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function mm(e={}){return new Ys(e)}var os=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:n,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}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=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:o?`Error in ${o}`:"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"})]})]})}):n}};function Hc(e,t){let a=r=>jsx(os,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Wc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,h]=useState("home"),[b,y]=useState(""),[x,w]=useState("");useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(P=>!P)),N.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(C=>{let[N,P]=C.split(":");switch(N){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(a?.(P),k()):h("navigate");break;case "search":r?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[m,x,t,a,r,n,s,o,l,c,k]),I=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsx(ca,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,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:v==="create-card"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&I();}}),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."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:M,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:M,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:M,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:M,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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(C=>jsxs(Command.Item,{value:`create-card-in:${C.id}`,onSelect:M,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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(C=>{let N=e.columns.find(P=>P.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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:M,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:M,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:M,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 bm(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:Lt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((S,W)=>{let pe=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,Ce=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-Ce.getTime()}).map(S=>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:S.user?.color||"#8B5CF6"},children:S.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:g("text-sm font-medium",L?"text-white":"text-gray-900"),children:S.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Ar(S.createdAt)})]}),jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx($p,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsx(Image,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},S.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(Bp,{value:de,onChange:ue,onSubmit:Fa,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:Oe,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:st,onFilesSelect:Ye,onRemoveFile:Ze})})]})]})]})})}function Rc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function co({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,timerState:D,onLogTime:P,onUpdateEstimate:N,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:J,onDiscardTimer:L,blurFinancials:Le=false,sidePanel:G,renderColumnMetrics:Ne,suppressDetailModal:$=false}){let[ve,U]=Rc(),[ze,oe]=useState(null),[Re,Q]=useState(false),Pe=useRef(null),We=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Fe=n?.theme||"dark",Be=Fe==="dark"||Fe==="neutral",rt=Be?"dark":"",ce=useCallback((A,X)=>{t.onCardUpdate?.(A,X);},[t]),Ve=useCallback((A,X)=>{t.onColumnUpdate?.(A,{title:X});},[t]),Qe=useCallback(A=>{t.onColumnDelete?.(A);},[t]),Ie=["todo","in-progress","completed"],ht=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),vt=useMemo(()=>{let A=new Map;return e.columns.forEach(X=>{let ke=X.cardIds.map(R=>e.cards.find(q=>q.id===R)).filter(R=>R!==void 0).sort((R,q)=>R.position-q.position);A.set(X.id,ke);}),A},[e.cards,e.columns]);useEffect(()=>{let A=Pe.current;if(!A)return;let X=we=>{let Ue=we.target,me=we.button===1,et=Ue===A||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(me||we.button===0&&et&&!ve.isDragging)&&(we.preventDefault(),Q(true),We.current={x:we.clientX,y:we.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},ke=we=>{if(!Re)return;let Ue=we.clientX-We.current.x,me=we.clientY-We.current.y;A.scrollLeft=We.current.scrollLeft-Ue,A.scrollTop=We.current.scrollTop-me;},R=()=>{Re&&(Q(false),A.style.cursor="",A.style.userSelect="");},q=()=>{Re&&(Q(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",X),document.addEventListener("mousemove",ke),document.addEventListener("mouseup",R),A.addEventListener("mouseleave",q),()=>{A.removeEventListener("mousedown",X),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",R),A.removeEventListener("mouseleave",q);}},[Re,ve.isDragging]);let ot=useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Te=useCallback(A=>{let{active:X}=A,ke=e.cards.find(R=>R.id===X.id);ke&&U({isDragging:true,draggedCardId:ke.id,sourceColumnId:ke.columnId,targetColumnId:ke.columnId});},[e.cards,U]),mt=useCallback(A=>{let{active:X,over:ke}=A;if(!ke||!e.cards.find(we=>we.id===X.id))return;let q=null;ke.data.current?.type==="column"?q=ke.id:ke.data.current?.type==="card"&&(q=e.cards.find(Ue=>Ue.id===ke.id)?.columnId||null),q&&q!==ve.targetColumnId&&U({...ve,targetColumnId:q});},[e.cards,ve,U]),wt=useCallback(async A=>{let{active:X,over:ke}=A;if(U({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ke)return;let R=e.cards.find(me=>me.id===X.id);if(!R)return;let q,we;if(ke.data.current?.type==="column"){q=ke.id;let me=vt.get(q)||[];we=hc(me,0);}else {let me=e.cards.find(ue=>ue.id===ke.id);if(!me)return;q=me.columnId;let et=vt.get(q)||[],de=et.findIndex(ue=>ue.id===ke.id);we=hc(et,de);}let Ue=e.columns.find(me=>me.id===q);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let me=vt.get(q)||[];if(R.columnId!==q&&me.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,R);return}}(R.columnId!==q||R.position!==we)&&await t.onCardMove?.(R.id,q,we);},[e.cards,e.columns,vt,t,U]),je=useCallback(A=>{$||oe(A),a?.(A),w?.(A.id);},[a,w,$]),dt=useCallback(A=>{t.onCardUpdate?.(A.id,A),oe(A);},[t]);return c?jsx("div",{className:g("asakaa-board",rt,o),style:l,children:jsx(Py,{columnCount:3})}):i?jsx("div",{className:g("asakaa-board",rt,o),style:l,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 i=="string"?i:i.message})]})})}):jsxs(up,{themeName:Fe,children:[jsxs("div",{className:g("flex h-full overflow-hidden",G?"flex-row":""),children:[jsxs(DndContext,{sensors:ht,collisionDetection:closestCorners,onDragStart:Te,onDragOver:mt,onDragEnd:wt,children:[jsxs("div",{ref:Pe,className:g("asakaa-board",G?"flex-1":"",rt,o),style:{...l,cursor:Re?"grabbing":void 0},"data-theme":Fe,children:[e.columns.sort((A,X)=>A.position-X.position).map(A=>{let X=vt.get(A.id)||[],ke=!Ie.includes(A.id),R=r?.renderColumnFooter?.(A);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(ls,{column:A,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ne?(q,we)=>Ne(q,we):void 0,onCardClick:je,onCardUpdate:ce,onColumnRename:t.onColumnUpdate?Ve:void 0,onColumnDelete:t.onColumnDelete?Qe:void 0,isDeletable:ke,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(A.id)}),R]},A.id)}),u]}),jsx(DragOverlay,{children:ve.draggedCardId?jsx(Wn,{card:e.cards.find(A=>A.id===ve.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),G]}),!$&&jsx(Ro,{task:ze,isOpen:!!ze,onClose:()=>oe(null),onCardUpdate:dt,theme:Be?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:ze?m?.get(ze.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:ot,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,isTimerRunning:D?.isRunning,timerElapsedSeconds:D?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:N,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:J,onTimerDiscard:L,blurFinancials:Le})]})}function Py({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 Ry={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, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},By={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},$y={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Oy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hy({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||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((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Uy({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||r||n))return null;let p=[{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:n}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Wy({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, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function $c({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=r==="dark"?Ry:By,m={...n==="es"?$y:Oy,...i},f=o||l||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:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Uy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsx(Hy,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(Wy,{onClick:()=>t(),label:a||m.newTask}))]})})}function Hc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.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(""),o(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:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,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 ei({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(false),[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(s||new Date),C=useRef(null),D=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{C.current?.focus();},[]);let N=useCallback(()=>{b(false),x(false),k(false);},[]),V=useCallback(()=>{i(""),p(void 0),m(null),v(null),N(),t();},[t,N]),O=f||s||new Date,J=useCallback(()=>{let G=c.trim();if(!G)return;let Ne=a.find(ve=>ve.id===d),$=O;e({name:G,priority:u,assignee:Ne||void 0,assigneeId:d,startDate:$,endDate:$}),i(""),p(void 0),m(null),v(null),N(),C.current?.focus();},[c,u,d,O,a,e,N]),L=useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),J()),G.key==="Escape"&&V();},[J,V,c]),Le=O;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:C,type:"text",value:c,onChange:G=>i(G.target.value),placeholder:D?"Nombre de la tarea...":"Task name...",className:g("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:L})}),jsxs("div",{className:g("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:G=>{G.stopPropagation(),b(!h),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[{id:"urgent",label:D?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:D?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:D?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:D?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:D?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(G=>jsxs("button",{onClick:()=>{p(G.id),b(false);},type:"button",className:g("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",u===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",G.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:G=>{G.stopPropagation(),k(!w),b(false),x(false),I(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":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"}),Le.toLocaleDateString(D?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,Ne=new Date(G);Ne.setDate(G.getDate()+1);let $=new Date(G);$.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let ve=new Date(G);ve.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let U=new Date(G);U.setDate(G.getDate()+14);let ze=new Date(G);ze.setDate(G.getDate()+28);let oe=D?"es-ES":"en-US";return [{label:D?"Hoy":"Today",date:G,display:G.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Ma\xF1ana":"Tomorrow",date:Ne,display:Ne.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Este fin de semana":"This weekend",date:$,display:D?"s\xE1b.":"sat."},{label:D?"Pr\xF3xima semana":"Next week",date:ve,display:D?"lun.":"mon."},{label:D?"2 semanas":"2 weeks",date:U,display:U.toLocaleDateString(oe,{day:"numeric",month:"short"})},{label:D?"4 semanas":"4 weeks",date:ze,display:ze.toLocaleDateString(oe,{day:"numeric",month:"short"})}].map((Q,Pe)=>jsxs("button",{type:"button",className:g("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:()=>{v(Q.date),k(false);},children:[jsx("span",{children:Q.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Q.display})]},Pe))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:M.toLocaleDateString(D?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>I(new Date),className:g("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:D?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>I(new Date(M.getFullYear(),M.getMonth()-1)),className:g("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:()=>I(new Date(M.getFullYear(),M.getMonth()+1)),className:g("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:(D?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(G=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:G},G))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=M.getFullYear(),Ne=M.getMonth(),$=new Date(G,Ne,1).getDay(),ve=new Date(G,Ne+1,0).getDate(),U=new Date(G,Ne,0).getDate(),ze=new Date().toDateString(),oe=[];for(let Q=$-1;Q>=0;Q--)oe.push({dayNum:U-Q,isCurrent:false,date:new Date(G,Ne-1,U-Q)});for(let Q=1;Q<=ve;Q++)oe.push({dayNum:Q,isCurrent:true,date:new Date(G,Ne,Q)});let Re=42-oe.length;for(let Q=1;Q<=Re;Q++)oe.push({dayNum:Q,isCurrent:false,date:new Date(G,Ne+1,Q)});return oe.map((Q,Pe)=>{let We=Q.date.toDateString()===ze,Fe=(f||s)?.toDateString()===Q.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!Q.isCurrent&&(r?"text-white/20":"text-gray-300"),Q.isCurrent&&(r?"text-white":"text-gray-900"),We&&"ring-1 ring-[#007FFF]",Fe&&"bg-[#007FFF] text-white",!Fe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(Q.date),k(false);},children:Q.dayNum},Pe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:G=>{G.stopPropagation(),x(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?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(G=>G.id===d)?.color||"#007FFF"},children:a.find(G=>G.id===d)?.initials||a.find(G=>G.id===d)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("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",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("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:D?"Sin asignar":"Unassigned"})]}),a.map(G=>jsxs("button",{type:"button",onClick:()=>{m(G.id),x(false);},className:g("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",d===G.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:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:D?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:J,disabled:!c.trim(),type:"button",className:g("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:D?"Guardar":"Save"})]})]})}function Vc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let w=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:u,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!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"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("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(ei,{onSubmit:x,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var ai=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(co,{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 n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
|
|
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((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function fm(e={}){return new ai(e)}var ps=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:n,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}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=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:o?`Error in ${o}`:"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"})]})]})}):n}};function jc(e,t){let a=r=>jsx(ps,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Kc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,h]=useState("home"),[b,y]=useState(""),[x,w]=useState("");useEffect(()=>{let C=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),d(P=>!P)),D.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(C=>{let[D,P]=C.split(":");switch(D){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(a?.(P),k()):h("navigate");break;case "search":r?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[m,x,t,a,r,n,s,o,l,c,k]),I=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsx(ua,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:C=>C.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,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:v==="create-card"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&I();}}),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."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:M,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:M,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:M,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:M,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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},C.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(C=>jsxs(Command.Item,{value:`create-card-in:${C.id}`,onSelect:M,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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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(C=>{let D=e.columns.find(P=>P.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,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:M,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:M,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:M,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 ym(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function ax(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function rx(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Gc(e){return e.startsWith("image/")}function ss({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((C,N)=>{N.preventDefault(),N.stopPropagation();let P=m.current.filter(O=>Gc(O.type)),T=P.findIndex(O=>O.id===C.id),V=O=>{let Q=m.current.filter(Le=>Gc(Le.type)),L=Q[O];L&&bm(L.url,L.name,Q,O,V);};bm(C.url,C.name,P,T,V);},[]),v=useCallback(C=>{let N=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(C.forEach(T=>{if(T.size/1048576>r){P.push(`${T.name} is too large (max ${r}MB)`);return}if(n&&!n.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}N.push(T);}),{valid:N,errors:P})},[e.length,s,r,n]),h=useCallback(async C=>{let{valid:N,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(N.length!==0){i(true),p(null);try{await t?.(N);}catch(T){p(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let N=Array.from(C.dataTransfer.files);h(N);},[h]),k=useCallback(C=>{let N=C.target.files?Array.from(C.target.files):[];h(N),d.current&&(d.current.value="");},[h]),M=useCallback(()=>{d.current?.click();},[]),I=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Gc(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(C,N),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:rx(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:ax(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(C.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},C.id))})]})}function ux({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function jc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ux,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function vx({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function _c({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Mx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Tm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Px({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Nm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Kc({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Mx[c.name]||Tm[e.indexOf(c)%Tm.length]})),l=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Px:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Nm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Nm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var rl=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(I=>{I.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));r.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w),children:[jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});rl.displayName="BulkOperationsToolbar";function Rx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,c,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,l=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function qc({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),h=useMemo(()=>s||Rx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),b={callbacks:r,availableUsers:a,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsx(oo,{board:e,className:n,...b}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(x=>{let w=f.has(x.id),k=e.cards.filter(I=>x.cardIds.includes(I.id)),M={...e,cards:k};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&y(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(oo,{board:M,...b})})]},x.id)}),h.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Yc=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Xc({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=Yc.find(i=>i.value===e)||Yc[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),n(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Yc.map(i=>jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Js=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function Ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function Pm(e={}){let{shortcuts:t=Js,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),l=useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Ox(i,p)){r&&i.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:l,isEnabled:a}}function Ux(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Wx(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function zx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Wx(e),r=t?Ux(t):"";return a?`${a} + ${r}`:r}function Gx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Jc({shortcuts:e=Js,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=Gx(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:zx(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Qc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function ax(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function rx(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Yc(e){return e.startsWith("image/")}function ms({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((C,D)=>{D.preventDefault(),D.stopPropagation();let P=m.current.filter(O=>Yc(O.type)),N=P.findIndex(O=>O.id===C.id),V=O=>{let J=m.current.filter(Le=>Yc(Le.type)),L=J[O];L&&ym(L.url,L.name,J,O,V);};ym(C.url,C.name,P,N,V);},[]),v=useCallback(C=>{let D=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:D,errors:P}):(C.forEach(N=>{if(N.size/1048576>r){P.push(`${N.name} is too large (max ${r}MB)`);return}if(n&&!n.some(O=>N.type.match(O))){P.push(`${N.name} has invalid file type`);return}D.push(N);}),{valid:D,errors:P})},[e.length,s,r,n]),h=useCallback(async C=>{let{valid:D,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(D.length!==0){i(true),p(null);try{await t?.(D);}catch(N){p(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let D=Array.from(C.dataTransfer.files);h(D);},[h]),k=useCallback(C=>{let D=C.target.files?Array.from(C.target.files):[];h(D),d.current&&(d.current.value="");},[h]),M=useCallback(()=>{d.current?.click();},[]),I=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:k,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Yc(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>f(C,D),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:rx(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:ax(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(C.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},C.id))})]})}function ux({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Jc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(ux,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function vx({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Qc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Mx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Dm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Px({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Sm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Zc({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Mx[c.name]||Dm[e.indexOf(c)%Dm.length]})),l=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Px:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Sm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Sm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var cl=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(I=>{I.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));r.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w),children:[jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});cl.displayName="BulkOperationsToolbar";function Rx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,c,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,l=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function ed({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),h=useMemo(()=>s||Rx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),b={callbacks:r,availableUsers:a,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsx(co,{board:e,className:n,...b}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(x=>{let w=f.has(x.id),k=e.cards.filter(I=>x.cardIds.includes(I.id)),M={...e,cards:k};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&y(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(co,{board:M,...b})})]},x.id)}),h.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var td=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function ad({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=td.find(i=>i.value===e)||td[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),n(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:td.map(i=>jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var ni=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function Ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function Lm(e={}){let{shortcuts:t=ni,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),l=useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Ox(i,p)){r&&i.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:l,isEnabled:a}}function Ux(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Wx(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function zx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Wx(e),r=t?Ux(t):"";return a?`${a} + ${r}`:r}function Gx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function rd({shortcuts:e=ni,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=Gx(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:zx(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var nd=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,13 +122,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Zc({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function td({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[c,i]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await ap(e,c,v);rp(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await sp(h),y=h.name.endsWith(".json")?"json":"csv",x=op(b,y);p(x),x.success&&r&&r(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(v=>jsxs("button",{onClick:()=>i(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var qx=["URGENT","HIGH","MEDIUM","LOW"],Yx=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Xx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ad({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=useState(true),b=useCallback(M=>{a({search:M.target.value});},[a]),y=useCallback(M=>{a({dateFilter:M.target.value});},[a]),x=useCallback(M=>{r({by:M.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[p&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let I=M.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),qx.map(M=>jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let I=M.target.value;a({assignees:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let I=M.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsx("option",{value:M,children:M},M))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:Yx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Xx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function rd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",r),ref:p,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,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:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>d(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>d(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>d(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},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",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},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:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>d(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var nd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},od={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},sd={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Ao={dark:nd,light:od,neutral:sd},ol="dark";var sl=createContext(void 0),sv="asakaa-theme";function Am({children:e,defaultTheme:t=ol,storageKey:a=sv}){let[r,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Ao[r];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${iv(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&l.style.setProperty(p,d);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Ao};return jsx(sl.Provider,{value:o,children:e})}function cs(){let e=useContext(sl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function iv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function id({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=cs();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ao).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",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:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function Im(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return dt[e]||dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",dt[e].bgSecondary),bgGrid:r("--theme-bg-card",dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",dt[e].bgWeekend),border:r("--theme-border-primary",dt[e].border),borderLight:r("--theme-border-subtle",dt[e].borderLight),textPrimary:r("--theme-text-primary",dt[e].textPrimary),textSecondary:r("--theme-text-secondary",dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",dt[e].textTertiary),accent:r("--theme-accent-primary",dt[e].accent),accentHover:r("--theme-accent-hover",dt[e].accentHover),accentLight:r("--theme-accent-primary",dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",dt[e].dependency),dependencyHover:r("--theme-border-secondary",dt[e].dependencyHover),criticalPath:r("--theme-error",dt[e].criticalPath),criticalPathLight:r("--theme-error",dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",dt[e].today):e==="neutral"?r("--theme-text-primary",dt[e].today):r("--theme-error",dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",dt[e].todayLight):e==="neutral"?r("--theme-text-primary",dt[e].todayLight):r("--theme-error",dt[e].todayLight),milestone:r("--theme-warning",dt[e].milestone),milestoneLight:r("--theme-warning",dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",dt[e].statusInProgress),statusCompleted:r("--theme-success",dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",dt[e].hoverBg),focusRing:r("--theme-accent-primary",dt[e].focusRing),...dt[e].dotGrid&&{dotGrid:dt[e].dotGrid},...dt[e].glassHeader&&{glassHeader:dt[e].glassHeader},...dt[e].glassToolbar&&{glassToolbar:dt[e].glassToolbar},...dt[e].forecastHud&&{forecastHud:dt[e].forecastHud},...dt[e].neonRedGlow&&{neonRedGlow:dt[e].neonRedGlow},...dt[e].executionBarBg&&{executionBarBg:dt[e].executionBarBg}}}var il={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Rm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ld={en:il,es:Rm};function Bm(e){return ld[e]||ld.en}function cd(e,t){let a=Bm(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var us=createContext(il);function qr(){return useContext(us)}function ei(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),n}function Vm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=useState(false),[i,u]=useState(null),p=useRef(null),d=useRef(null),m=qr(),f=ei(p,l,"right",176);if(useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||a||r||n||s||o))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),b=async(y,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:d,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:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:h.map((y,x)=>jsxs(motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function dd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[c,i]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=qr(),v=ei(d,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let I=M.target;d.current&&!d.current.contains(I)&&m.current&&!m.current.contains(I)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(k=>k.handler),x=async(k,M)=>{if(M){i(k);try{await M();}catch(I){console.error(`Export ${k} failed:`,I);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((k,M)=>jsxs(motion.button,{onClick:()=>x(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Mv({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Pv({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function ud({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),c=qr(),i=ei(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],p=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:l,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function pd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),c=useRef(null),i=qr(),u=ei(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),d&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(f=>{let v=t===f.value&&!r,h=()=>f.value==="all"?v?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Om({value:e,onChange:t,theme:a}){let r=qr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Fv({theme:e,forecast:t}){let a=qr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Hm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),h=qr(),b=ei(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=I=>{let C=I.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,I)=>{let C=M.icon,N=M.disabled,P=M.tooltip;return jsxs(motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:I*.03},title:P,children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?y?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,I)=>{let C=i===M.value;return jsxs(motion.button,{onClick:()=>u(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+I)*.03},children:[jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Lv({theme:e,etiqueta:t,children:a}){let[r,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[r]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),r&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function ll({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:I,projectForecast:C,hideForecastHud:N,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportCSV:O,onExportJSON:Q,onExportMSProject:L,showCriticalPath:Le=true,onShowCriticalPathChange:G,showDependencies:Ne=true,onShowDependenciesChange:$,highlightWeekends:ve=true,onHighlightWeekendsChange:U,showBaseline:We=false,onShowBaselineChange:oe,onCopySnapshotLink:Re,hasDependencies:Z=true}){let Pe=qr(),Ue=P||T||V||O||Q||L,Fe=!!t.glassToolbar,Be=[{value:"day",label:Pe.toolbar.day},{value:"week",label:Pe.toolbar.week},{value:"month",label:Pe.toolbar.month}],rt=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],le=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Om,{value:a,onChange:r,theme:t}),v&&jsx(pd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsx(Hm,{theme:t,showCriticalPath:Le,onShowCriticalPathChange:G,showBaseline:We,onShowBaselineChange:oe,highlightWeekends:ve,onHighlightWeekendsChange:U,showDependencies:Ne,onShowDependenciesChange:$,rowDensity:c,onRowDensityChange:i,hasDependencies:Z}),jsx(dd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),(I||w)&&jsxs(Lv,{theme:t,etiqueta:Pe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[I&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(Ve=>jsxs("button",{type:"button",onClick:()=>I(Ve),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===Ve?le?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[Ve==="execution"?Pe.toolbar.viewExecution:Pe.toolbar.viewOracle,M===Ve&&jsx(Check,{className:"w-3.5 h-3.5"})]},Ve))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(ud,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if(Fe){let Ve=le?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:I&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:le?"#000000":t.bgSecondary,border:`1px solid ${le?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>I("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?le?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Pe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>I("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?le?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Pe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Om,{value:a,onChange:r,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),w&&jsx(ud,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsx(pd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),jsx(Hm,{theme:t,showCriticalPath:Le,onShowCriticalPathChange:G,showBaseline:We,onShowBaselineChange:oe,highlightWeekends:ve,onHighlightWeekendsChange:U,showDependencies:Ne,onShowDependenciesChange:$,rowDensity:c,onRowDensityChange:i,hasDependencies:Z}),jsx(dd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${le?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${le?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Pe.toolbar.createTask})]})]})]}),C&&!N&&jsx(Fv,{theme:t,forecast:C})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Pv,{options:Be,value:a,onChange:Ve=>r(Ve),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),w&&jsx(ud,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(pd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxs(Fragment,{children:[y,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Pe.toolbar.createTask})]}),(Ue||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(dd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(Mv,{options:rt,value:o,onChange:Ve=>l(Ve),theme:t})]})]})}function cl({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(ca,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function ps({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,h=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&n();},p=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var na={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Jm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],k=M=>{for(let I of M)w.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&k(I.subtasks);};return k(x),w},[]),h=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){a(k[0].id,false);return}let I=k.findIndex(P=>P.id===M.id);if(I===-1)return;let C=x==="up"?I-1:I+1;if(C<0||C>=k.length)return;let N=k[C];a(N.id,w);},[e,h,v,a]),y=useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),N=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(N&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!N.isExpanded||x.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!I){N&&(x.preventDefault(),r(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!I){N&&(x.preventDefault(),r(N.id,"above"));return}if(x.key==="Enter"&&I){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),i(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&I){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&I&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,r,n,s,o,l,c,i,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function Zm(e){let[t,a]=useState(new Set),[r,n]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),n(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),l=useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);a(new Set(y)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=useCallback(()=>{a(new Set),n(null);},[]),p=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function hd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?hd(t.subtasks):t.subtasks}))}function $o(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ms(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ms(a.subtasks,t);if(r)return r}}return null}function bd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=bd(a.subtasks,t);if(r)return r}return null}function yd(e,t){if(t.length===0)return e;let a=$o(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return hd(p)}function xd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=bd(a,r);if(!n)continue;let s=bd(a,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(a,n.id,r);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(a,n.id,c));}return hd(a)}function vd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function wd(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ai(e,t){let a=[...e],r=[];for(let n of t){let s=(c,i)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(i+1,0,d),d},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function eg(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function kd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:kd(r.subtasks,t,a)}:r)}function Cd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Cd(a.subtasks,t)}:a)}function Td(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,l=r?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function tg(e,t,a,r){if(t===a)return e;let n=ms(e,t);if(!n)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],p=r!==void 0?r:u.length,d=[...u];d.splice(p,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Yr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function ul({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:I,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:T,allTasks:V,scrollContainerRef:O,showCriticalPath:Q=false}){let L=useContext(us),[Le,G]=useState(null),[Ne,$]=useState(null),[ve,U]=useState(""),We=useRef(null),[oe,Re]=useState(null),[Z,Pe]=useState(0),[Ue,Fe]=useState(0),[Be,rt]=useState({isOpen:false,x:0,y:0,type:"header"}),[le,Ve]=useState(null),[Qe,Ie]=useState(null),[ht,vt]=useState(null),ot=useRef(0),Te=5,mt=useRef(false),[wt,je]=useState(null),[ut,A]=useState(false),J=useRef(null),[ke,R]=useState(null),[q,we]=useState(null),[Oe,me]=useState(false),et=useRef(null);useEffect(()=>{function se(fe){et.current&&!et.current.contains(fe.target)&&me(false);}if(Oe)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[Oe]),useEffect(()=>{Ne&&We.current&&(We.current.focus(),We.current.select());},[Ne]),useEffect(()=>{if(!oe)return;let se=pt=>{let j=pt.clientX-Z,he=Ue+j;f?.(oe,he);},fe=()=>{Re(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,Z,Ue,f]);let{selectedTaskIds:ce,handleTaskClick:ue,isTaskSelected:$e}=Zm(l),{setIsEditing:ct}=Jm({tasks:e,selectedTaskIds:ce,onTaskSelect:(se,fe)=>{let j=$o(e).map(he=>he.id);ue(se,j,fe||false,false),o?.(se);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:se=>{let fe=$o(e).find(pt=>pt.id===se);fe&&ja(fe);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:se=>{let fe=$o(e).find(pt=>pt.id===se);fe&&N&&N(fe);},enableKeyboard:true}),st=(se,fe=0,pt="")=>{let j=[],he=[...se].sort((ae,B)=>(ae.position??0)-(B.position??0));for(let ae=0;ae<he.length;ae++){let B=he[ae],ee=ae+1,De=pt?`${pt}.${ee}`:`${ee}.0`,S=B.wbsCode||De;if(B.wbsCode=S,j.push({task:B,level:fe}),B.subtasks&&B.subtasks.length>0&&B.isExpanded){let pe=B.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${ee}`:`${ee}`);j.push(...st(B.subtasks,fe+1,pe));}}return j},Ye=st(e),kt=48,qt=Math.max(Ye.length*a,600-kt),za=(se,fe)=>fe==="assignees"?se.assignees:fe==="startDate"?se.startDate:se.endDate,pa=(se,fe,pt,j)=>{se.preventDefault(),se.stopPropagation(),R({sourceTaskId:fe,column:pt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let he=se.currentTarget.closest("[data-grid-body]"),ae=nt=>{let be=he?.getBoundingClientRect().top??0,_=Math.floor((nt-be)/a);return _=Math.max(0,Math.min(Ye.length-1,_)),_<j&&(_=j),_},B=se.clientY,ee=O?.current??null,De=()=>{J.current&&(cancelAnimationFrame(J.current),J.current=null);},S=()=>{let nt=ae(B);R(be=>be&&{...be,targetIndex:nt});},W=()=>{if(De(),!ee)return;let nt=ee.getBoundingClientRect(),be=60,_=12,gt=B-nt.top,bt=nt.bottom-B;if(bt<be&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Ut=Math.max(1,Math.round(_*(1-Math.max(0,bt)/be))),Vt=()=>{ee.scrollTop+=Ut,S(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(J.current=requestAnimationFrame(Vt));};J.current=requestAnimationFrame(Vt);}else if(gt<be&&ee.scrollTop>0){let Ut=Math.max(1,Math.round(_*(1-Math.max(0,gt)/be))),Vt=()=>{ee.scrollTop-=Ut,S(),ee.scrollTop>0&&(J.current=requestAnimationFrame(Vt));};J.current=requestAnimationFrame(Vt);}},pe=nt=>{B=nt.clientY,S(),W();},Ce=nt=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",Ce),De(),document.body.style.cursor="",document.body.style.userSelect="",R(null);let be=ae(nt.clientY),_=Ye.find(nr=>nr.task.id===fe)?.task;if(!_)return;let gt=za(_,pt),bt=Math.min(j,be),Ut=Math.max(j,be),Vt=[];for(let nr=bt;nr<=Ut;nr++){if(nr===j)continue;let yr=Ye[nr]?.task;!yr||yr.subtasks&&yr.subtasks.length>0||Vt.push(yr.id);}Vt.length!==0&&h?.(Vt,pt,gt);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",Ce);},Lt=se=>{if(!ke)return false;let fe=Math.min(ke.sourceIndex,ke.targetIndex),pt=Math.max(ke.sourceIndex,ke.targetIndex);return se>=fe&&se<=pt},Ht=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,ja=se=>{$(se.id),U(se.name),ct(true);},Bt=se=>{ve.trim()&&ve!==e.find(fe=>fe.id===se)?.name&&I?.(se,ve.trim()),$(null),U(""),ct(false);},pr=()=>{$(null),U(""),ct(false);},ma=(se,fe)=>{fe.stopPropagation(),C?.(se.id);},hr=(se,fe)=>{fe.preventDefault(),ot.current=fe.clientY,Ve(se),mt.current=false,A(false),je({x:fe.clientX,y:fe.clientY});},Xe=se=>{if(!le||(Math.abs(se.clientY-ot.current)>Te&&!mt.current&&(mt.current=true,A(true)),je({x:se.clientX,y:se.clientY}),!mt.current))return;if(O?.current){let ae=O.current,B=ae.getBoundingClientRect(),ee=60,De=12;J.current&&(cancelAnimationFrame(J.current),J.current=null);let S=se.clientY-B.top,W=B.bottom-se.clientY;if(S<ee&&ae.scrollTop>0){let pe=Math.round(De*(1-S/ee)),Ce=()=>{ae.scrollTop-=pe,mt.current&&ae.scrollTop>0&&(J.current=requestAnimationFrame(Ce));};J.current=requestAnimationFrame(Ce);}else if(W<ee&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let pe=Math.round(De*(1-W/ee)),Ce=()=>{ae.scrollTop+=pe,mt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(J.current=requestAnimationFrame(Ce));};J.current=requestAnimationFrame(Ce);}}let pt=document.querySelectorAll("[data-task-row]"),j=null,he=null;pt.forEach(ae=>{let B=ae.getBoundingClientRect(),ee=ae.getAttribute("data-task-row");if(ee&&ee!==le&&se.clientY>=B.top&&se.clientY<=B.bottom){j=ee;let De=se.clientY-B.top,S=B.height;De<S*.25?he="above":De>S*.75?he="below":he="child";}}),Ie(j),vt(he);},Ze=()=>{if(mt.current&&le&&Qe&&ht){if(ht==="child")T?.(le,Qe);else if(ht==="above"||ht==="below"){let se=(ae,B,ee=null)=>{for(let De of ae){if(De.id===B)return ee;if(De.subtasks){let S=se(De.subtasks,B,De.id);if(S!==void 0)return S}}},fe=V&&V.length>0?V:e,pt=se(fe,le,null),j=se(fe,Qe,null),he=(ae,B,ee,De)=>{let S=ae.findIndex(Ce=>Ce.id===B),W=De?ae.findIndex(Ce=>Ce.id===ee):-1,pe=ht==="below"?S+1:S;return De&&W!==-1&&W<S&&(pe-=1),Math.max(0,pe)};if(j===null){let B=he(fe,Qe,le,pt===null);T?.(le,null,B);}else {let ae=ms(fe,j);if(ae?.subtasks){let B=pt===j,ee=he(ae.subtasks,Qe,le,B);T?.(le,j,ee);}}}}J.current&&(cancelAnimationFrame(J.current),J.current=null),Ve(null),Ie(null),vt(null),je(null),mt.current=false,A(false);};useEffect(()=>{if(le)return document.addEventListener("mousemove",Xe),document.addEventListener("mouseup",Ze),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Xe),document.removeEventListener("mouseup",Ze),document.body.style.cursor="",document.body.style.userSelect="";}},[le,Qe,ht]);let Fa=(se,fe,pt)=>{let j=fe.subtasks&&fe.subtasks.length>0;switch(se.id){case "name":let he=Ne===fe.id,ae=Le===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[T&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ae?1:.3},onMouseDown:_=>hr(fe.id,_),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:_=>{_.stopPropagation(),u?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),he?jsx("input",{ref:We,type:"text",value:ve,onChange:_=>U(_.target.value),onKeyDown:_=>{_.key==="Enter"?Bt(fe.id):_.key==="Escape"&&pr();},onBlur:()=>Bt(fe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:_=>_.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),Q&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),Q&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ae&&!he&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsx("button",{onClick:_=>ma(fe,_),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:_=>{_.stopPropagation(),ja(fe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let ee=se.id==="startDate"?"startDate":"endDate",De=fe[ee],S=q?.taskId===fe.id&&q?.field===ee,W=_=>_?(typeof _=="string"?new Date(_):_).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:_=>_.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:_=>{if(!j)if(S)we(null);else {let gt=_.currentTarget.getBoundingClientRect();we({taskId:fe.id,field:ee,month:De?typeof De=="string"?new Date(De):De:new Date,position:{top:gt.bottom+4,left:gt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(De)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),S&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>we(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:q?.position.top,left:q?.position.left},onClick:_=>_.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,gt=new Date(_);gt.setDate(_.getDate()+1);let bt=new Date(_);bt.setDate(_.getDate()+7);let Ut=new Date(_);return Ut.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:gt},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Ut}].map((nr,yr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Tr=>Tr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Tr=>Tr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[ee]:nr.date}),we(null);},children:nr.label},yr))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[ee]:void 0}),we(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:q?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((_,gt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},gt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=q?.month||new Date,gt=_.getFullYear(),bt=_.getMonth(),Ut=new Date(gt,bt,1).getDay(),Vt=new Date(gt,bt+1,0).getDate(),nr=new Date,yr=[];for(let ta=Ut-1;ta>=0;ta--)yr.push({day:new Date(gt,bt,-ta).getDate(),date:new Date(gt,bt-1,new Date(gt,bt,-ta).getDate()),isCurrentMonth:false});for(let ta=1;ta<=Vt;ta++)yr.push({day:ta,date:new Date(gt,bt,ta),isCurrentMonth:true});let Tr=42-yr.length;for(let ta=1;ta<=Tr;ta++)yr.push({day:ta,date:new Date(gt,bt+1,ta),isCurrentMonth:false});return yr.map((ta,qo)=>{let Rn=ta.date.toDateString()===nr.toDateString(),Yn=(De?typeof De=="string"?new Date(De):De:null)?.toDateString()===ta.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ta.isCurrentMonth?Yn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Yn?"#00E5CC":"transparent",boxShadow:Rn&&!Yn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(fe.id,{[ee]:ta.date}),we(null);},children:ta.day},qo)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ht(fe)})});case "assignees":if(j)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let pe=r.filter(_=>fe.assignees?.some(gt=>gt.id?gt.id===_.id:gt.name===_.name||gt.initials===_.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Eo,{assignedUsers:pe,availableUsers:r,onChange:_=>{let gt=_.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(fe.id,{assignees:gt});}})});case "status":if(j){let _=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:_})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Np,{status:fe.status||"todo",onChange:_=>{v?.(fe.id,{status:_,progress:_==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[fe.progress,"%"]})]});case "priority":let Ce={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},nt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=Ce[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Do,{priority:be,onChange:_=>{_&&v?.(fe.id,{priority:nt[_]||"medium"});}})});default:return null}},La=se=>[{id:"hide",label:"Hide Column",icon:na.Hide,onClick:()=>m(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:na.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:na.SortDesc,onClick:()=>{}}],rr=se=>{let fe=se.subtasks&&se.subtasks.length>0,pt=$o(e),j=ce.size>1&&ce.has(se.id),he=j?pt.filter(S=>ce.has(S.id)):[se],ae=he.map(S=>S.id),B=he.filter(S=>!(S.subtasks&&S.subtasks.length>0)),ee=j?` (${ae.length})`:"",De=()=>{P?P(ae,se.name):w?.(ae);};return fe?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:na.Add,onClick:()=>{C?.(se.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:na.Duplicate,onClick:()=>{k?.(ae);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:na.Delete,onClick:De}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:na.Pencil,onClick:()=>{c?.(se);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:na.Add,onClick:()=>{C?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:na.MarkIncomplete,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"todo",progress:0}));},disabled:B.length===0||B.every(S=>S.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:na.SetInProgress,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"in-progress"}));},disabled:B.length===0||B.every(S=>S.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+ee,icon:na.MarkComplete,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"completed",progress:100}));},disabled:B.length===0||B.every(S=>S.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:na.Duplicate,onClick:()=>{k?.(ae);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:na.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:na.Delete,onClick:De}]},ka=d.filter(se=>se.visible),Lr=ka.reduce((se,fe)=>se+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Lr},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${kt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ka.map((se,fe)=>{let pt=fe===ka.length-1,j=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(j?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:j&&ka.length===1?1:0,flexGrow:j&&ka.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:he=>{he.preventDefault(),rt({isOpen:true,x:he.clientX,y:he.clientY,type:"header",columnId:se.id});},onMouseEnter:he=>{he.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:he=>{he.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:oe===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:he=>{he.preventDefault(),he.stopPropagation(),Re(se.id),Pe(he.clientX),Fe(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:oe===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(cl,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>me(!Oe),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),Oe&&jsxs("div",{ref:et,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>me(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:qt},children:Ye.map(({task:se,level:fe},pt)=>{let j=$e(se.id),he=Lt(pt),ae=Qe===se.id,B=ae&&ht==="above",ee=ae&&ht==="below",De=ae&&ht==="child",S={};return De&&(S.backgroundColor=`${t.accent}15`,S.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${le===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:De?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:Q?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...S},onMouseEnter:()=>G(se.id),onMouseLeave:()=>G(null),onClick:W=>{let Ce=$o(e).map(_=>_.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;ue(se.id,Ce,be,W.shiftKey),o?.(se.id),!be&&!W.shiftKey&&s?.(se);},onDoubleClick:W=>{W.stopPropagation(),c?.(se);},onContextMenu:W=>{W.preventDefault(),rt({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:se}),i?.(se,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[B&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ka.map((W,pe)=>{let Ce=pe===ka.length-1,nt=W.id==="name",be=!!(se.subtasks&&se.subtasks.length>0),_=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!_&&!be&&Le===se.id&&!ke,Ut=he&&!!ke&&ke.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${nt?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(nt?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:nt&&ka.length===1?1:0,flexGrow:nt&&ka.length===1?1:0,borderRight:Ce?"none":`1px solid ${Le===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Ut?`${t.accent}22`:void 0,boxShadow:Ut?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Fa(W,se,nt?fe:0),bt&&_&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Vt=>pa(Vt,se.id,_,pt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${se.id}-${W.id}`)})]},se.id)})}),jsx(ps,{isOpen:Be.isOpen,x:Be.x,y:Be.y,items:Be.type==="header"&&Be.columnId?La(Be.columnId):Be.type==="task"&&Be.task?rr(Be.task):[],onClose:()=>rt({...Be,isOpen:false}),theme:t}),ut&&wt&&le&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:wt.x+12,top:wt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Ye.find(fe=>fe.task.id===le)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function sg(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[c,i]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(0),[w,k]=useState(0),[M,I]=useState(null),[C,N]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:C,setIsHovered:N,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Q,L)=>{r("none"),p(null),m(null),l(Q),i(L),k(0),b(null),x(0);}}}function pl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=sg(t,r),M=useRef(null),I=useRef(false),C=useRef(null),N=useRef(null),{dragMode:P,setDragMode:T,dragOffset:V,setDragOffset:O,ghostX:Q,setGhostX:L,ghostWidth:Le,setGhostWidth:G,connectionLine:Ne,setConnectionLine:$,hoveredTaskId:ve,setHoveredTaskId:U,activeZone:We,setActiveZone:oe,draggedSegmentIndex:Re,setDraggedSegmentIndex:Z,draggedSegmentStartX:Pe,setDraggedSegmentStartX:Ue,segmentDragOffsetX:Fe,setSegmentDragOffsetX:Be,hoveredSegmentIndex:rt,setHoveredSegmentIndex:le,isHovered:Ve,setIsHovered:Qe,isDragging:Ie,isResizing:ht,isConnecting:vt,resetDragState:ot}=k,Te=18,mt=!!n.executionBarBg,wt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",je=mt?3:6,ut=e.subtasks&&e.subtasks.length>0,A=useRef(null),[J,ke]=(()=>{let j=useRef(null),[,he]=useState(0);return [j.current,ae=>{j.current=ae,he(B=>B+1);}]})(),R=!!w&&!x&&!ut&&!e.segments&&!!e.startDate&&!!e.endDate,q=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let he=new Date(e.endDate);return he.setHours(0,0,0,0),he<j})()&&e.progress<100,we=y&&e.isCriticalPath,Oe=n.name==="neutral"||n.today==="#1C1917",me=e.status==="completed"||e.progress===100,et={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ue=y&&e.isCriticalPath||q?"#EF4444":e.color?e.color:e.priority&&et[e.priority]?et[e.priority]:n.taskBarPrimary,$e=x?"default":Ie?vt?"crosshair":ht?"ew-resize":"grabbing":"grab",ct=x?"default":"ew-resize",Ye=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),kt=r<50,qt=r<40;useEffect(()=>{v&&(!Ve||Ie||e.segments)&&v(null);},[Ve,Ie,e.segments,v]);let za=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),pa=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Lt=j=>Math.round(j/s)*s,Ht=j=>{let he=Math.round(j/s),ae=new Date(o);return ae.setDate(ae.getDate()+he),ae},ja=(j,he)=>{for(let ae of m){if(ae.id===e.id)continue;let B=5;if(j>=ae.x-B&&j<=ae.x+ae.width+B&&he>=ae.y-B&&he<=ae.y+ae.height+B)return ae.id}return null},Bt=useCallback((j,he,ae)=>{if(x)return;j.preventDefault(),j.stopPropagation();let B=M.current?.ownerSVGElement;if(!B)return;let ee=B.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let De=ee.matrixTransform(B.getScreenCTM()?.inverse()),S=ae!==void 0?ae:t,W=he;if(!W){let pe=De.x-S;j.shiftKey?(W="connect",$({x:t+r,y:a+Te/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=pe<r/2?"resize-start":"resize-end":qt?pe<r/2?W="move":W="resize-end":kt?pe<=Ye/2?W="resize-start":pe>=r-Ye/2?W="resize-end":W="move":pe<=Ye?W="resize-start":pe>=r-Ye?W="resize-end":W="move";}I.current=false,T(W),Qe(false),oe(null),W==="move"?O(De.x-S):W==="connect"?$({x:t+r,y:a+Te/2}):O(0),L(S),G(r);},[t,r,a,Te,x]),pr=useCallback(j=>{let he=M.current?.ownerSVGElement;if(!he)return;let ae=he.closest(".gantt-timeline-scroll");if(!ae)return;let B=ae.getBoundingClientRect(),ee=60,De=15,S=0;if(j.clientX<B.left+ee){let W=B.left+ee-j.clientX;S=-Math.min(De,W/2);}else if(j.clientX>B.right-ee){let W=j.clientX-(B.right-ee);S=Math.min(De,W/2);}return S!==0&&(ae.scrollLeft+=S),S!==0},[]),ma=useCallback(j=>{if(P==="none")return;I.current=true,N.current=j;let he=M.current?.ownerSVGElement;if(!he)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=pr(j);ee&&!C.current?C.current=window.setInterval(()=>{N.current&&(pr(N.current),ma(N.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let ae=he.createSVGPoint();ae.x=j.clientX,ae.y=j.clientY;let B=ae.matrixTransform(he.getScreenCTM()?.inverse());if(P==="connect"){$({x:B.x,y:B.y});let ee=ja(B.x,B.y);U(ee);}else if(P==="move"){let ee=B.x-V,De=Lt(ee);L(De),G(r);let S=Math.round((De-t)/s);if(f?.(e.id,S,true),e.segments&&e.segments.length>0&&Re!==null){let W=De-Pe;Be(W);}}else if(P==="resize-start"){let ee=B.x,De=Lt(ee),S=t+r-De;S>=s&&(L(De),G(S));}else if(P==="resize-end"){let ee=B.x,S=Lt(ee)-t;S>=s&&G(S);}},[P,t,r,s,V,e,Lt,Re,Pe,ja,U,$,L,G,Be,f,pr]),hr=useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),N.current=null,P!=="none"){if(P==="connect")ve&&d&&d(e,ve),$(null),U(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),he,ae,B=true;if(P==="move"){if(he=Ht(Q),ae=new Date(he.getTime()+j),e.segments&&e.segments.length>0&&Re!==null){let ee=Math.round(Fe/s),De=e.segments.map((Ce,nt)=>{if(nt===Re){let be=new Date(Ce.startDate),_=new Date(Ce.endDate);return be.setDate(be.getDate()+ee),_.setDate(_.getDate()+ee),{startDate:be,endDate:_}}return Ce}),S=De.flatMap(Ce=>[Ce.startDate,Ce.endDate]),W=new Date(Math.min(...S.map(Ce=>Ce.getTime()))),pe=new Date(Math.max(...S.map(Ce=>Ce.getTime())));p?.({...e,segments:De},W,pe),ot(t,r);return}}else P==="resize-start"?(he=Ht(Q),ae=e.endDate,he>ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):P==="resize-end"?(he=e.startDate,ae=Ht(Q+Le),ae.setDate(ae.getDate()-1),ae<he&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&he&&ae&&(ae.getTime()<he.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,he,ae));}f?.(e.id,0,false),ot(t,r);}},[P,Q,Le,e,p,ve,d,t,r,s,Ht,Fe,Re,ot,f]);useEffect(()=>{if(P==="none")return;let j=ae=>{ma(ae);},he=()=>{hr();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",he),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",he),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,ma,hr]);let Xe=Ie&&!vt?Q:t,Ze=Ie&&!vt?Le:r,Fa=l.taskClass(e),La=24,rr=y?e.isCriticalPath?1:.25:1,ka=useCallback(j=>{if(!R)return;j.stopPropagation(),j.preventDefault();let ae=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:ae,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),ke(e.progress||0);},[R,e.progress,ke]),Lr=useCallback(j=>{let he=A.current;if(!he)return;let B=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??he.barRect;if(!B||B.width<=0)return;let ee=(j.clientX-B.left)/B.width,De=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(De=Math.round(De/25)*25),ke(De);},[ke]),se=useCallback(j=>{let he=A.current;if(!he)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let ae=J;A.current=null,ke(null),ae!=null&&ae!==he.initialPct&&w&&w(e,ae);},[J,w,e,ke]),fe=useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),pt=J??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true","data-estado":me?"completed":q?"overdue":"planned","data-resumen":ut?"true":void 0,style:{opacity:rr,transition:"opacity 300ms ease"},onClick:()=>{!Ie&&!I.current&&c?.(e),I.current=false;},onDoubleClick:j=>{!Ie&&!I.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!Ie&&Qe(true),onMouseMove:j=>{v&&Ve&&!Ie&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Ie||(Qe(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+La,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),Ve&&!Ie&&!kt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ye,height:Te,fill:We==="resize-start"?n.accent:"transparent",opacity:We==="resize-start"?.15:0,style:{cursor:ct,pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:j=>Bt(j,"resize-start")}),jsx("rect",{x:t+Ye,y:a,width:r-Ye*2,height:Te,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Bt(j,"move")}),jsx("rect",{x:t+r-Ye,y:a,width:Ye,height:Te,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.15:0,style:{cursor:ct,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Bt(j,"resize-end")})]}),Ve&&!Ie&&qt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:We==="move"?n.accent:"transparent",opacity:We==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Bt(j,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:We==="resize-end"?n.accent:"transparent",opacity:We==="resize-end"?.2:0,style:{cursor:ct,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Bt(j,"resize-end")}),Ve&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!vt&&!e.segments&&jsx(motion.rect,{x:Q,y:a,width:Le,height:Te,rx:je,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let j=e.baselineStartDate.getTime(),he=e.baselineEndDate.getTime(),ae=o.getTime(),B=864e5,ee=(j-ae)/B,De=(he-j)/B,S=ee*s,W=Math.max(De*s,s),pe=Xe+Ze,Ce=S+W,nt=e.endDate?.getTime()??0,be=Math.ceil((nt-he)/B),_=be>0,gt=be<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:S,y:a,width:W,height:Te,rx:je,fill:"none",stroke:wt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),_&&pe>Ce&&jsx("rect",{x:Ce,y:a,width:pe-Ce,height:Te,rx:0,fill:"#EF4444",opacity:.2}),_&&jsxs("text",{x:Math.max(pe,Ce)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",be,"d"]}),gt&&jsxs("text",{x:pe+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[be,"d"]})]})})(),!e.segments&&mt&&ut&&(()=>{let he=a+(Te-8)/2,ae=4,B=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let De=e.startDate&&ee>=e.startDate,S=e.endDate&&(()=>{let _=new Date(e.endDate);return _.setHours(0,0,0,0),ee>_})(),W=e.startDate&&ee<e.startDate,pe=1;if(De&&e.startDate&&e.endDate&&!W){let _=new Date(e.startDate);_.setHours(0,0,0,0);let gt=new Date(e.endDate);gt.setHours(0,0,0,0);let bt=Math.max(1,(gt.getTime()-_.getTime())/(1e3*60*60*24)),Vt=Math.min((ee.getTime()-_.getTime())/(1e3*60*60*24),bt)/bt*100;pe=Vt>0?B/Vt:1;}let Ce;B>=100?Ce="#00E5CC":W?Ce="#4B5563":S&&B<100?Ce="#EF4444":pe>=.95?Ce="#22C55E":pe>=.8?Ce="#F59E0B":Ce="#EF4444";let nt=Math.max(B/100*Ze,B>0?ae*2:0),be=Ze>100&&B>0;return jsxs("g",{"data-task-class":Fa,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:Xe,y:he,width:Ze,height:8,rx:ae,fill:"rgba(255,255,255,0.10)"}),B>0&&jsx("rect",{"data-parte":"avance",x:Xe,y:he,width:nt,height:8,rx:ae,fill:Ce}),be&&jsxs("text",{x:Xe+nt+6,y:he+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(B),"%"]})]})})(),!e.segments&&mt&&!ut&&jsx(motion.rect,{x:Xe,y:a,width:Ze,height:Te,rx:je,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Fa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!vt?.15:e.parentId?.6:1,scale:Ve&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Bt(j),style:{cursor:$e,pointerEvents:"all"}}),!e.segments&&!mt&&jsx(motion.rect,{x:Xe,y:a,width:Ze,height:Te,rx:je,fill:ue,"data-task-class":Fa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!vt?.15:e.parentId?.6:Ve?.9:.8,scale:Ve&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ut?void 0:j=>Bt(j),style:{cursor:ut?"default":$e,pointerEvents:"all"}}),mt&&(q||we)&&!e.segments&&jsx("rect",{x:Xe,y:a,width:Ze,height:Te,rx:je,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),q&&!me&&!e.segments&&!ut&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Xe+Ze+4}, ${a+Te/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&pt>0&&!ut&&jsx("rect",{x:Xe,y:a,width:Math.max(Ze*(pt/100),je*2),height:Te,rx:je,fill:ue,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!ut&&e.progress<100&&(()=>{let j=e.progress>0?Ze*(e.progress/100):0,he=Xe+j,ae=Ze-j,B=e.progress===0?je:0,ee=e.progress===0?Xe:he,De=e.progress===0?Ze:ae;return jsxs(Fragment,{children:[jsx("rect",{x:ee,y:a,width:De,height:Te,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:ee,y:a,width:De,height:Te,rx:B,fill:"none",stroke:ue,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),mt&&!e.segments&&e.progress>0&&e.progress<100&&!ut&&!Ie&&J===null&&(()=>{let j=Xe+Ze*(e.progress/100),he=8,ae=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:j,cy:a+Te/2,r:he,fill:ae?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:j,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ae?.initials||ae?.name?.charAt(0)?.toUpperCase()||""})]})})(),R&&!Ie&&Ze>=40&&(J!==null||pt<88)&&(()=>{let j=Xe+Ze*(pt/100),he=a+Te/2,ae=J!==null,B=ae?7:Ve?6:5,ee=ae||Ve?1:.35,De=Xe+Ze-j,S=Math.max(4,Math.min(12,De-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:j-W,y:he-12,width:W+S,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ka,onPointerMove:Lr,onPointerUp:se,onPointerCancel:se,onClick:fe,onDoubleClick:fe,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:j,cy:he,r:B,fill:"#FFFFFF",stroke:ue,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:ae?`drop-shadow(0 0 4px ${ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ae&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:j-20,y:he-28,width:40,height:18,rx:4,fill:wt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:ue,strokeWidth:1}),jsxs("text",{x:j,y:he-16,textAnchor:"middle",dominantBaseline:"central",fill:wt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((j,he)=>{let ae=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ae+s,De=Ie&&P==="move"&&Re===he,S=rt===he,W=De?ae+Fe:ae;return jsxs("g",{onMouseEnter:()=>!Ie&&le(he),onMouseLeave:()=>!Ie&&le(null),children:[jsx(motion.rect,{x:W,y:a,width:ee,height:Te,rx:je,fill:ue,initial:{opacity:0,scale:.95},animate:{opacity:De||e.parentId?.6:S?.9:.8,scale:S&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),Z(he),Ue(ae),Bt(pe,void 0,ae);},style:{cursor:$e,pointerEvents:"all"}}),jsx("rect",{x:W,y:a,width:ee*(e.progress/100),height:Te,rx:je,fill:ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${he}`)}),Oe&&(q||we)&&!e.segments&&jsxs(Fragment,{children:[we&&!q&&jsx("rect",{x:Xe,y:a,width:Ze,height:Te,rx:je,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),q&&jsx("rect",{x:Xe,y:a,width:Ze,height:Te,rx:je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ze>60&&!e.segments&&!(mt&&ut)&&(()=>{let j=l.taskLabel(e),he=typeof j=="string"?j:e.name,ae=he.length>Math.floor(Ze/8)?`${he.substring(0,Math.floor(Ze/8))}...`:he;return jsx("text",{"data-parte":"etiqueta",x:Xe+8,y:a+Te/2,dominantBaseline:"middle",fill:me?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:me?"line-through":"none"},children:ae})})(),!Ie&&!e.segments&&!ut&&e.progress>0&&e.progress<100&&(mt?jsxs("text",{x:Xe+Ze+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ze>100?jsxs("text",{x:Xe+Ze-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Ze>80&&!Ie&&!e.segments&&!(mt&&ut)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Xe+Ze-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Xe+Ze-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ve||ht)&&!vt&&!e.segments&&!ut&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Xe-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ct},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"resize-start");}}),jsx(motion.rect,{x:Xe+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:We==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Xe+Ze-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:ct},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"resize-end");}}),jsx(motion.rect,{x:Xe+Ze-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:We==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ve&&!Ie&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:We==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),vt&&Ne&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:Ne.x,y2:Ne.y,stroke:ve?n.statusCompleted:n.accent,strokeWidth:ve?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ve?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ne.x,cy:Ne.y,r:ve?8:6,fill:ve?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ve&&jsx(motion.text,{x:Ne.x+15,y:Ne.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ne.x+10},animate:{opacity:1,x:Ne.x+15},transition:{duration:.2},children:"Connect"})]}),(Ve||Ie)&&!vt&&!e.segments&&jsx(motion.rect,{x:Xe-1,y:a-1,width:Ze+2,height:Te+2,rx:je+1,fill:"none",stroke:Ie?n.accent:mt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:mt?1:2,opacity:Ie||mt?.6:.4,initial:{opacity:0},animate:{opacity:Ie||mt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ht&&jsxs(Fragment,{children:[jsx("line",{x1:Q,y1:0,x2:Q,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:Q+Le,y1:0,x2:Q+Le,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ve&&!Ie&&!e.segments&&!v&&(()=>{let ae=a<100,B=ae?a+Te+13:a-82-13,ee=ae?`M ${Xe+Ze/2-6} ${a+Te+3} L ${Xe+Ze/2} ${a+Te+13} L ${Xe+Ze/2+6} ${a+Te+3}`:`M ${Xe+Ze/2-6} ${a-13} L ${Xe+Ze/2} ${a-3} L ${Xe+Ze/2+6} ${a-13}`,De=B+22,S=B+40,W=B+55,pe=B+70,Ce=ae?B+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Xe+Ze/2-120,y:B,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Xe+Ze/2,y:De,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Xe+Ze/2-110,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Xe+Ze/2-70,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:za(e.startDate)}),jsx("text",{x:Xe+Ze/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Xe+Ze/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:za(e.endDate)}),jsx("text",{x:Xe+Ze/2+10,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Xe+Ze/2+65,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pa()}),jsx("text",{x:Xe+Ze/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Xe+Ze/2+65,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Xe+Ze/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Xe+Ze/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(nt=>nt.name).join(", ").substring(0,30),e.assignees.map(nt=>nt.name).join(", ").length>30?"...":""]})]}),!ae&&jsx("text",{x:Xe+Ze/2,y:Ce,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:qt?"Left: move \u2022 Right: resize":kt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Nd=260,fs=8,cg=16,ww=-12;function dg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,I=x.lastActivity!=null,C=(M?155:105)+(I?28:0),N=w+cg,P=k+ww-C;N+Nd>window.innerWidth-fs&&(N=w-Nd-cg),N<fs&&(N=fs);let T=P<fs;T&&(P=k+20),P+C>window.innerHeight-fs&&(P=window.innerHeight-fs-C),s({left:N,top:P,showBelow:T});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},i=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,I=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;I.getTime()<=C.getTime();){let P=I.getDay();x[P]&&!w.has(k(I))&&M++,I.setDate(I.getDate()+1);}let N=Math.max(0,M);return a==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Nd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ml,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(ml,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(ml,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(ml,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),l&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function od({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>l(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function id({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[c,i]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await np(e,c,v);op(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await lp(h),y=h.name.endsWith(".json")?"json":"csv",x=ip(b,y);p(x),x.success&&r&&r(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(v=>jsxs("button",{onClick:()=>i(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var qx=["URGENT","HIGH","MEDIUM","LOW"],Yx=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Xx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ld({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=useState(true),b=useCallback(M=>{a({search:M.target.value});},[a]),y=useCallback(M=>{a({dateFilter:M.target.value});},[a]),x=useCallback(M=>{r({by:M.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[p&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let I=M.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),qx.map(M=>jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let I=M.target.value;a({assignees:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let I=M.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(M=>jsx("option",{value:M,children:M},M))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:Yx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Xx.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function cd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",r),ref:p,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,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:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>d(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>d(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>d(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},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",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},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:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>d(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var dd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ud={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},pd={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},$o={dark:dd,light:ud,neutral:pd},ul="dark";var pl=createContext(void 0),sv="asakaa-theme";function Rm({children:e,defaultTheme:t=ul,storageKey:a=sv}){let[r,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=$o[r];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${iv(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&l.style.setProperty(p,d);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:$o};return jsx(pl.Provider,{value:o,children:e})}function bs(){let e=useContext(pl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function iv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function md({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=bs();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries($o).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var ct={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",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:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function Bm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:r("--theme-bg-card",ct[e].bgGrid),bgWeekend:r("--theme-bg-hover",ct[e].bgWeekend),border:r("--theme-border-primary",ct[e].border),borderLight:r("--theme-border-subtle",ct[e].borderLight),textPrimary:r("--theme-text-primary",ct[e].textPrimary),textSecondary:r("--theme-text-secondary",ct[e].textSecondary),textTertiary:r("--theme-text-tertiary",ct[e].textTertiary),accent:r("--theme-accent-primary",ct[e].accent),accentHover:r("--theme-accent-hover",ct[e].accentHover),accentLight:r("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ct[e].dependency),dependencyHover:r("--theme-border-secondary",ct[e].dependencyHover),criticalPath:r("--theme-error",ct[e].criticalPath),criticalPathLight:r("--theme-error",ct[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ct[e].today):e==="neutral"?r("--theme-text-primary",ct[e].today):r("--theme-error",ct[e].today),todayLight:e==="light"?r("--theme-accent-primary",ct[e].todayLight):e==="neutral"?r("--theme-text-primary",ct[e].todayLight):r("--theme-error",ct[e].todayLight),milestone:r("--theme-warning",ct[e].milestone),milestoneLight:r("--theme-warning",ct[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:r("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:r("--theme-success",ct[e].statusCompleted),hoverBg:r("--theme-bg-hover",ct[e].hoverBg),focusRing:r("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var ml={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},$m={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},gd={en:ml,es:$m};function Om(e){return gd[e]||gd.en}function fd(e,t){let a=Om(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ys=createContext(ml);function Xr(){return useContext(ys)}function ii(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),n}function _m({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=useState(false),[i,u]=useState(null),p=useRef(null),d=useRef(null),m=Xr(),f=ii(p,l,"right",176);if(useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||a||r||n||s||o))return null;let h=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),b=async(y,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#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:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:d,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:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:h.map((y,x)=>jsxs(motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<h.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function bd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[c,i]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=Xr(),v=ii(d,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let I=M.target;d.current&&!d.current.contains(I)&&m.current&&!m.current.contains(I)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(k=>k.handler),x=async(k,M)=>{if(M){i(k);try{await M();}catch(I){console.error(`Export ${k} failed:`,I);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((k,M)=>jsxs(motion.button,{onClick:()=>x(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Mv({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Pv({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function hd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),c=Xr(),i=ii(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],p=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:l,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:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function yd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),c=useRef(null),i=Xr(),u=ii(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),d&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,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:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(f=>{let v=t===f.value&&!r,h=()=>f.value==="all"?v?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Um({value:e,onChange:t,theme:a}){let r=Xr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Fv({theme:e,forecast:t}){let a=Xr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Wm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),h=Xr(),b=ii(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=I=>{let C=I.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,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:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,I)=>{let C=M.icon,D=M.disabled,P=M.tooltip;return jsxs(motion.button,{onClick:()=>!D&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:D?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:D?"not-allowed":"pointer"},whileHover:D?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:I*.03},title:P,children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:D?y?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!D&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,I)=>{let C=i===M.value;return jsxs(motion.button,{onClick:()=>u(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+I)*.03},children:[jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Lv({theme:e,etiqueta:t,children:a}){let[r,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[r]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),r&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function gl({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:I,projectForecast:C,hideForecastHud:D,onExportPNG:P,onExportPDF:N,onExportExcel:V,onExportCSV:O,onExportJSON:J,onExportMSProject:L,showCriticalPath:Le=true,onShowCriticalPathChange:G,showDependencies:Ne=true,onShowDependenciesChange:$,highlightWeekends:ve=true,onHighlightWeekendsChange:U,showBaseline:ze=false,onShowBaselineChange:oe,onCopySnapshotLink:Re,hasDependencies:Q=true}){let Pe=Xr(),We=P||N||V||O||J||L,Fe=!!t.glassToolbar,Be=[{value:"day",label:Pe.toolbar.day},{value:"week",label:Pe.toolbar.week},{value:"month",label:Pe.toolbar.month}],rt=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],ce=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Um,{value:a,onChange:r,theme:t}),v&&jsx(yd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsx(Wm,{theme:t,showCriticalPath:Le,onShowCriticalPathChange:G,showBaseline:ze,onShowBaselineChange:oe,highlightWeekends:ve,onHighlightWeekendsChange:U,showDependencies:Ne,onShowDependenciesChange:$,rowDensity:c,onRowDensityChange:i,hasDependencies:Q}),jsx(bd,{theme:t,onExportPNG:P,onExportPDF:N,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),(I||w)&&jsxs(Lv,{theme:t,etiqueta:Pe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[I&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(Ve=>jsxs("button",{type:"button",onClick:()=>I(Ve),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===Ve?ce?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[Ve==="execution"?Pe.toolbar.viewExecution:Pe.toolbar.viewOracle,M===Ve&&jsx(Check,{className:"w-3.5 h-3.5"})]},Ve))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(hd,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if(Fe){let Ve=ce?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:I&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ce?"#000000":t.bgSecondary,border:`1px solid ${ce?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>I("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?ce?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Pe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>I("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?ce?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Pe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Um,{value:a,onChange:r,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),w&&jsx(hd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsx(yd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ve}}),jsx(Wm,{theme:t,showCriticalPath:Le,onShowCriticalPathChange:G,showBaseline:ze,onShowBaselineChange:oe,highlightWeekends:ve,onHighlightWeekendsChange:U,showDependencies:Ne,onShowDependenciesChange:$,rowDensity:c,onRowDensityChange:i,hasDependencies:Q}),jsx(bd,{theme:t,onExportPNG:P,onExportPDF:N,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ce?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ce?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Pe.toolbar.createTask})]})]})]}),C&&!D&&jsx(Fv,{theme:t,forecast:C})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Pv,{options:Be,value:a,onChange:Ve=>r(Ve),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),w&&jsx(hd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(yd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxs(Fragment,{children:[y,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Pe.toolbar.createTask})]}),(We||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(bd,{theme:t,onExportPNG:P,onExportPDF:N,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Re}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(Mv,{options:rt,value:o,onChange:Ve=>l(Ve),theme:t})]})]})}function fl({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(ua,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function xs({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,h=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&n();},p=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var sa={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Zm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],k=M=>{for(let I of M)w.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&k(I.subtasks);};return k(x),w},[]),h=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){a(k[0].id,false);return}let I=k.findIndex(P=>P.id===M.id);if(I===-1)return;let C=x==="up"?I-1:I+1;if(C<0||C>=k.length)return;let D=k[C];a(D.id,w);},[e,h,v,a]),y=useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let I=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),D=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(D&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!D.isExpanded||x.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!I){D&&(x.preventDefault(),r(D.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!I){D&&(x.preventDefault(),r(D.id,"above"));return}if(x.key==="Enter"&&I){D&&(x.preventDefault(),p(D.id));return}if(x.key==="F2"){D&&(x.preventDefault(),i(D.id));return}if(x.key==="Delete"||x.key==="Backspace"&&I){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&I&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,r,n,s,o,l,c,i,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function tg(e){let[t,a]=useState(new Set),[r,n]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),n(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),l=useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);a(new Set(y)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=useCallback(()=>{a(new Set),n(null);},[]),p=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function Cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Cd(t.subtasks):t.subtasks}))}function Wo(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function vs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=vs(a.subtasks,t);if(r)return r}}return null}function kd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=kd(a.subtasks,t);if(r)return r}return null}function Td(e,t){if(t.length===0)return e;let a=Wo(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return Cd(p)}function Nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=kd(a,r);if(!n)continue;let s=kd(a,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(a,n.id,r);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(a,n.id,c));}return Cd(a)}function Dd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function Sd(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ci(e,t){let a=[...e],r=[];for(let n of t){let s=(c,i)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(i+1,0,d),d},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function ag(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function Ed(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ed(r.subtasks,t,a)}:r)}function Md(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Md(a.subtasks,t)}:a)}function Pd(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,l=r?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function rg(e,t,a,r){if(t===a)return e;let n=vs(e,t);if(!n)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.subtasks||[],p=r!==void 0?r:u.length,d=[...u];d.splice(p,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Jr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Jr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function hl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:I,onCreateSubtask:C,onOpenTaskModal:D,onDeleteRequest:P,onTaskReparent:N,allTasks:V,scrollContainerRef:O,showCriticalPath:J=false}){let L=useContext(ys),[Le,G]=useState(null),[Ne,$]=useState(null),[ve,U]=useState(""),ze=useRef(null),[oe,Re]=useState(null),[Q,Pe]=useState(0),[We,Fe]=useState(0),[Be,rt]=useState({isOpen:false,x:0,y:0,type:"header"}),[ce,Ve]=useState(null),[Qe,Ie]=useState(null),[ht,vt]=useState(null),ot=useRef(0),Te=5,mt=useRef(false),[wt,je]=useState(null),[dt,A]=useState(false),X=useRef(null),[ke,R]=useState(null),[q,we]=useState(null),[Ue,me]=useState(false),et=useRef(null);useEffect(()=>{function se(fe){et.current&&!et.current.contains(fe.target)&&me(false);}if(Ue)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[Ue]),useEffect(()=>{Ne&&ze.current&&(ze.current.focus(),ze.current.select());},[Ne]),useEffect(()=>{if(!oe)return;let se=ut=>{let j=ut.clientX-Q,ye=We+j;f?.(oe,ye);},fe=()=>{Re(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,Q,We,f]);let{selectedTaskIds:de,handleTaskClick:ue,isTaskSelected:Oe}=tg(l),{setIsEditing:lt}=Zm({tasks:e,selectedTaskIds:de,onTaskSelect:(se,fe)=>{let j=Wo(e).map(ye=>ye.id);ue(se,j,fe||false,false),o?.(se);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:se=>{let fe=Wo(e).find(ut=>ut.id===se);fe&&_a(fe);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:se=>{let fe=Wo(e).find(ut=>ut.id===se);fe&&D&&D(fe);},enableKeyboard:true}),st=(se,fe=0,ut="")=>{let j=[],ye=[...se].sort((ne,B)=>(ne.position??0)-(B.position??0));for(let ne=0;ne<ye.length;ne++){let B=ye[ne],ee=ne+1,De=ut?`${ut}.${ee}`:`${ee}.0`,S=B.wbsCode||De;if(B.wbsCode=S,j.push({task:B,level:fe}),B.subtasks&&B.subtasks.length>0&&B.isExpanded){let pe=B.wbsCode?.replace(/\.0$/,"")||(ut?`${ut}.${ee}`:`${ee}`);j.push(...st(B.subtasks,fe+1,pe));}}return j},qe=st(e),kt=48,Yt=Math.max(qe.length*a,600-kt),za=(se,fe)=>fe==="assignees"?se.assignees:fe==="startDate"?se.startDate:se.endDate,ma=(se,fe,ut,j)=>{se.preventDefault(),se.stopPropagation(),R({sourceTaskId:fe,column:ut,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ye=se.currentTarget.closest("[data-grid-body]"),ne=nt=>{let be=ye?.getBoundingClientRect().top??0,_=Math.floor((nt-be)/a);return _=Math.max(0,Math.min(qe.length-1,_)),_<j&&(_=j),_},B=se.clientY,ee=O?.current??null,De=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},S=()=>{let nt=ne(B);R(be=>be&&{...be,targetIndex:nt});},W=()=>{if(De(),!ee)return;let nt=ee.getBoundingClientRect(),be=60,_=12,gt=B-nt.top,bt=nt.bottom-B;if(bt<be&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Ut=Math.max(1,Math.round(_*(1-Math.max(0,bt)/be))),Vt=()=>{ee.scrollTop+=Ut,S(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(X.current=requestAnimationFrame(Vt));};X.current=requestAnimationFrame(Vt);}else if(gt<be&&ee.scrollTop>0){let Ut=Math.max(1,Math.round(_*(1-Math.max(0,gt)/be))),Vt=()=>{ee.scrollTop-=Ut,S(),ee.scrollTop>0&&(X.current=requestAnimationFrame(Vt));};X.current=requestAnimationFrame(Vt);}},pe=nt=>{B=nt.clientY,S(),W();},Ce=nt=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",Ce),De(),document.body.style.cursor="",document.body.style.userSelect="",R(null);let be=ne(nt.clientY),_=qe.find(or=>or.task.id===fe)?.task;if(!_)return;let gt=za(_,ut),bt=Math.min(j,be),Ut=Math.max(j,be),Vt=[];for(let or=bt;or<=Ut;or++){if(or===j)continue;let hr=qe[or]?.task;!hr||hr.subtasks&&hr.subtasks.length>0||Vt.push(hr.id);}Vt.length!==0&&h?.(Vt,ut,gt);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",Ce);},Lt=se=>{if(!ke)return false;let fe=Math.min(ke.sourceIndex,ke.targetIndex),ut=Math.max(ke.sourceIndex,ke.targetIndex);return se>=fe&&se<=ut},Ht=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,_a=se=>{$(se.id),U(se.name),lt(true);},Bt=se=>{ve.trim()&&ve!==e.find(fe=>fe.id===se)?.name&&I?.(se,ve.trim()),$(null),U(""),lt(false);},pr=()=>{$(null),U(""),lt(false);},ga=(se,fe)=>{fe.stopPropagation(),C?.(se.id);},br=(se,fe)=>{fe.preventDefault(),ot.current=fe.clientY,Ve(se),mt.current=false,A(false),je({x:fe.clientX,y:fe.clientY});},Ye=se=>{if(!ce||(Math.abs(se.clientY-ot.current)>Te&&!mt.current&&(mt.current=true,A(true)),je({x:se.clientX,y:se.clientY}),!mt.current))return;if(O?.current){let ne=O.current,B=ne.getBoundingClientRect(),ee=60,De=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let S=se.clientY-B.top,W=B.bottom-se.clientY;if(S<ee&&ne.scrollTop>0){let pe=Math.round(De*(1-S/ee)),Ce=()=>{ne.scrollTop-=pe,mt.current&&ne.scrollTop>0&&(X.current=requestAnimationFrame(Ce));};X.current=requestAnimationFrame(Ce);}else if(W<ee&&ne.scrollTop<ne.scrollHeight-ne.clientHeight){let pe=Math.round(De*(1-W/ee)),Ce=()=>{ne.scrollTop+=pe,mt.current&&ne.scrollTop<ne.scrollHeight-ne.clientHeight&&(X.current=requestAnimationFrame(Ce));};X.current=requestAnimationFrame(Ce);}}let ut=document.querySelectorAll("[data-task-row]"),j=null,ye=null;ut.forEach(ne=>{let B=ne.getBoundingClientRect(),ee=ne.getAttribute("data-task-row");if(ee&&ee!==ce&&se.clientY>=B.top&&se.clientY<=B.bottom){j=ee;let De=se.clientY-B.top,S=B.height;De<S*.25?ye="above":De>S*.75?ye="below":ye="child";}}),Ie(j),vt(ye);},Ze=()=>{if(mt.current&&ce&&Qe&&ht){if(ht==="child")N?.(ce,Qe);else if(ht==="above"||ht==="below"){let se=(ne,B,ee=null)=>{for(let De of ne){if(De.id===B)return ee;if(De.subtasks){let S=se(De.subtasks,B,De.id);if(S!==void 0)return S}}},fe=V&&V.length>0?V:e,ut=se(fe,ce,null),j=se(fe,Qe,null),ye=(ne,B,ee,De)=>{let S=ne.findIndex(Ce=>Ce.id===B),W=De?ne.findIndex(Ce=>Ce.id===ee):-1,pe=ht==="below"?S+1:S;return De&&W!==-1&&W<S&&(pe-=1),Math.max(0,pe)};if(j===null){let B=ye(fe,Qe,ce,ut===null);N?.(ce,null,B);}else {let ne=vs(fe,j);if(ne?.subtasks){let B=ut===j,ee=ye(ne.subtasks,Qe,ce,B);N?.(ce,j,ee);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),Ve(null),Ie(null),vt(null),je(null),mt.current=false,A(false);};useEffect(()=>{if(ce)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",Ze),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",Ze),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,Qe,ht]);let Fa=(se,fe,ut)=>{let j=fe.subtasks&&fe.subtasks.length>0;switch(se.id){case "name":let ye=Ne===fe.id,ne=Le===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ut*20}px`},children:[N&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ne?1:.3},onMouseDown:_=>br(fe.id,_),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:_=>{_.stopPropagation(),u?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),ye?jsx("input",{ref:ze,type:"text",value:ve,onChange:_=>U(_.target.value),onKeyDown:_=>{_.key==="Enter"?Bt(fe.id):_.key==="Escape"&&pr();},onBlur:()=>Bt(fe.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:_=>_.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),J&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),J&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),ne&&!ye&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:_=>_.stopPropagation(),children:[jsx("button",{onClick:_=>ga(fe,_),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:_=>{_.stopPropagation(),_a(fe);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let ee=se.id==="startDate"?"startDate":"endDate",De=fe[ee],S=q?.taskId===fe.id&&q?.field===ee,W=_=>_?(typeof _=="string"?new Date(_):_).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:_=>_.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:_=>{if(!j)if(S)we(null);else {let gt=_.currentTarget.getBoundingClientRect();we({taskId:fe.id,field:ee,month:De?typeof De=="string"?new Date(De):De:new Date,position:{top:gt.bottom+4,left:gt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(De)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),S&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>we(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:q?.position.top,left:q?.position.left},onClick:_=>_.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let _=new Date,gt=new Date(_);gt.setDate(_.getDate()+1);let bt=new Date(_);bt.setDate(_.getDate()+7);let Ut=new Date(_);return Ut.setDate(_.getDate()+14),[{label:"Hoy",date:_},{label:"Ma\xF1ana",date:gt},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Ut}].map((or,hr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Dr=>Dr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Dr=>Dr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[ee]:or.date}),we(null);},children:or.label},hr))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:_=>_.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:_=>_.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(fe.id,{[ee]:void 0}),we(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:q?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>we(_=>_?{..._,month:new Date(_.month.getFullYear(),_.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((_,gt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:_},gt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=q?.month||new Date,gt=_.getFullYear(),bt=_.getMonth(),Ut=new Date(gt,bt,1).getDay(),Vt=new Date(gt,bt+1,0).getDate(),or=new Date,hr=[];for(let ra=Ut-1;ra>=0;ra--)hr.push({day:new Date(gt,bt,-ra).getDate(),date:new Date(gt,bt-1,new Date(gt,bt,-ra).getDate()),isCurrentMonth:false});for(let ra=1;ra<=Vt;ra++)hr.push({day:ra,date:new Date(gt,bt,ra),isCurrentMonth:true});let Dr=42-hr.length;for(let ra=1;ra<=Dr;ra++)hr.push({day:ra,date:new Date(gt,bt+1,ra),isCurrentMonth:false});return hr.map((ra,Zo)=>{let Bn=ra.date.toDateString()===or.toDateString(),Zn=(De?typeof De=="string"?new Date(De):De:null)?.toDateString()===ra.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:ra.isCurrentMonth?Zn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Zn?"#00E5CC":"transparent",boxShadow:Bn&&!Zn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(fe.id,{[ee]:ra.date}),we(null);},children:ra.day},Zo)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ht(fe)})});case "assignees":if(j)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let pe=r.filter(_=>fe.assignees?.some(gt=>gt.id?gt.id===_.id:gt.name===_.name||gt.initials===_.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Lo,{assignedUsers:pe,availableUsers:r,onChange:_=>{let gt=_.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(fe.id,{assignees:gt});}})});case "status":if(j){let _=fe.progress===100?"\u2713":fe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:_})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Sp,{status:fe.status||"todo",onChange:_=>{v?.(fe.id,{status:_,progress:_==="completed"?100:fe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:fe.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[fe.progress,"%"]})]});case "priority":let Ce={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},nt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},be=Ce[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:_=>_.stopPropagation(),children:jsx(Po,{priority:be,onChange:_=>{_&&v?.(fe.id,{priority:nt[_]||"medium"});}})});default:return null}},La=se=>[{id:"hide",label:"Hide Column",icon:sa.Hide,onClick:()=>m(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:sa.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:sa.SortDesc,onClick:()=>{}}],nr=se=>{let fe=se.subtasks&&se.subtasks.length>0,ut=Wo(e),j=de.size>1&&de.has(se.id),ye=j?ut.filter(S=>de.has(S.id)):[se],ne=ye.map(S=>S.id),B=ye.filter(S=>!(S.subtasks&&S.subtasks.length>0)),ee=j?` (${ne.length})`:"",De=()=>{P?P(ne,se.name):w?.(ne);};return fe?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:sa.Add,onClick:()=>{C?.(se.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:sa.Duplicate,onClick:()=>{k?.(ne);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:sa.Delete,onClick:De}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:sa.Pencil,onClick:()=>{c?.(se);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:sa.Add,onClick:()=>{C?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:sa.MarkIncomplete,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"todo",progress:0}));},disabled:B.length===0||B.every(S=>S.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:sa.SetInProgress,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"in-progress"}));},disabled:B.length===0||B.every(S=>S.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+ee,icon:sa.MarkComplete,onClick:()=>{B.forEach(S=>v?.(S.id,{status:"completed",progress:100}));},disabled:B.length===0||B.every(S=>S.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:sa.Duplicate,onClick:()=>{k?.(ne);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:sa.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:sa.Delete,onClick:De}]},ka=d.filter(se=>se.visible),Ar=ka.reduce((se,fe)=>se+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ar},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${kt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ka.map((se,fe)=>{let ut=fe===ka.length-1,j=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(j?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:j&&ka.length===1?1:0,flexGrow:j&&ka.length===1?1:0,borderRight:ut?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ye=>{ye.preventDefault(),rt({isOpen:true,x:ye.clientX,y:ye.clientY,type:"header",columnId:se.id});},onMouseEnter:ye=>{ye.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ye=>{ye.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:oe===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ye=>{ye.preventDefault(),ye.stopPropagation(),Re(se.id),Pe(ye.clientX),Fe(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:oe===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(fl,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>me(!Ue),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),Ue&&jsxs("div",{ref:et,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>me(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Yt},children:qe.map(({task:se,level:fe},ut)=>{let j=Oe(se.id),ye=Lt(ut),ne=Qe===se.id,B=ne&&ht==="above",ee=ne&&ht==="below",De=ne&&ht==="child",S={};return De&&(S.backgroundColor=`${t.accent}15`,S.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${ce===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:De?`${t.accent}15`:ut%2===0?t.bgPrimary:t.bgGrid,opacity:J?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...S},onMouseEnter:()=>G(se.id),onMouseLeave:()=>G(null),onClick:W=>{let Ce=Wo(e).map(_=>_.id),be=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;ue(se.id,Ce,be,W.shiftKey),o?.(se.id),!be&&!W.shiftKey&&s?.(se);},onDoubleClick:W=>{W.stopPropagation(),c?.(se);},onContextMenu:W=>{W.preventDefault(),rt({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:se}),i?.(se,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[B&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ka.map((W,pe)=>{let Ce=pe===ka.length-1,nt=W.id==="name",be=!!(se.subtasks&&se.subtasks.length>0),_=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!_&&!be&&Le===se.id&&!ke,Ut=ye&&!!ke&&ke.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${nt?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(nt?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:nt&&ka.length===1?1:0,flexGrow:nt&&ka.length===1?1:0,borderRight:Ce?"none":`1px solid ${Le===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Ut?`${t.accent}22`:void 0,boxShadow:Ut?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Fa(W,se,nt?fe:0),bt&&_&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Vt=>ma(Vt,se.id,_,ut),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${se.id}-${W.id}`)})]},se.id)})}),jsx(xs,{isOpen:Be.isOpen,x:Be.x,y:Be.y,items:Be.type==="header"&&Be.columnId?La(Be.columnId):Be.type==="task"&&Be.task?nr(Be.task):[],onClose:()=>rt({...Be,isOpen:false}),theme:t}),dt&&wt&&ce&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:wt.x+12,top:wt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=qe.find(fe=>fe.task.id===ce)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function lg(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[c,i]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(0),[w,k]=useState(0),[M,I]=useState(null),[C,D]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:C,setIsHovered:D,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,L)=>{r("none"),p(null),m(null),l(J),i(L),k(0),b(null),x(0);}}}function yl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=lg(t,r),M=useRef(null),I=useRef(false),C=useRef(null),D=useRef(null),{dragMode:P,setDragMode:N,dragOffset:V,setDragOffset:O,ghostX:J,setGhostX:L,ghostWidth:Le,setGhostWidth:G,connectionLine:Ne,setConnectionLine:$,hoveredTaskId:ve,setHoveredTaskId:U,activeZone:ze,setActiveZone:oe,draggedSegmentIndex:Re,setDraggedSegmentIndex:Q,draggedSegmentStartX:Pe,setDraggedSegmentStartX:We,segmentDragOffsetX:Fe,setSegmentDragOffsetX:Be,hoveredSegmentIndex:rt,setHoveredSegmentIndex:ce,isHovered:Ve,setIsHovered:Qe,isDragging:Ie,isResizing:ht,isConnecting:vt,resetDragState:ot}=k,Te=18,mt=!!n.executionBarBg,wt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",je=mt?3:6,dt=e.subtasks&&e.subtasks.length>0,A=useRef(null),[X,ke]=(()=>{let j=useRef(null),[,ye]=useState(0);return [j.current,ne=>{j.current=ne,ye(B=>B+1);}]})(),R=!!w&&!x&&!dt&&!e.segments&&!!e.startDate&&!!e.endDate,q=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let ye=new Date(e.endDate);return ye.setHours(0,0,0,0),ye<j})()&&e.progress<100,we=y&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",me=e.status==="completed"||e.progress===100,et={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ue=y&&e.isCriticalPath||q?"#EF4444":e.color?e.color:e.priority&&et[e.priority]?et[e.priority]:n.taskBarPrimary,Oe=x?"default":Ie?vt?"crosshair":ht?"ew-resize":"grabbing":"grab",lt=x?"default":"ew-resize",qe=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),kt=r<50,Yt=r<40;useEffect(()=>{v&&(!Ve||Ie||e.segments)&&v(null);},[Ve,Ie,e.segments,v]);let za=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ma=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Lt=j=>Math.round(j/s)*s,Ht=j=>{let ye=Math.round(j/s),ne=new Date(o);return ne.setDate(ne.getDate()+ye),ne},_a=(j,ye)=>{for(let ne of m){if(ne.id===e.id)continue;let B=5;if(j>=ne.x-B&&j<=ne.x+ne.width+B&&ye>=ne.y-B&&ye<=ne.y+ne.height+B)return ne.id}return null},Bt=useCallback((j,ye,ne)=>{if(x)return;j.preventDefault(),j.stopPropagation();let B=M.current?.ownerSVGElement;if(!B)return;let ee=B.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let De=ee.matrixTransform(B.getScreenCTM()?.inverse()),S=ne!==void 0?ne:t,W=ye;if(!W){let pe=De.x-S;j.shiftKey?(W="connect",$({x:t+r,y:a+Te/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=pe<r/2?"resize-start":"resize-end":Yt?pe<r/2?W="move":W="resize-end":kt?pe<=qe/2?W="resize-start":pe>=r-qe/2?W="resize-end":W="move":pe<=qe?W="resize-start":pe>=r-qe?W="resize-end":W="move";}I.current=false,N(W),Qe(false),oe(null),W==="move"?O(De.x-S):W==="connect"?$({x:t+r,y:a+Te/2}):O(0),L(S),G(r);},[t,r,a,Te,x]),pr=useCallback(j=>{let ye=M.current?.ownerSVGElement;if(!ye)return;let ne=ye.closest(".gantt-timeline-scroll");if(!ne)return;let B=ne.getBoundingClientRect(),ee=60,De=15,S=0;if(j.clientX<B.left+ee){let W=B.left+ee-j.clientX;S=-Math.min(De,W/2);}else if(j.clientX>B.right-ee){let W=j.clientX-(B.right-ee);S=Math.min(De,W/2);}return S!==0&&(ne.scrollLeft+=S),S!==0},[]),ga=useCallback(j=>{if(P==="none")return;I.current=true,D.current=j;let ye=M.current?.ownerSVGElement;if(!ye)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=pr(j);ee&&!C.current?C.current=window.setInterval(()=>{D.current&&(pr(D.current),ga(D.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let ne=ye.createSVGPoint();ne.x=j.clientX,ne.y=j.clientY;let B=ne.matrixTransform(ye.getScreenCTM()?.inverse());if(P==="connect"){$({x:B.x,y:B.y});let ee=_a(B.x,B.y);U(ee);}else if(P==="move"){let ee=B.x-V,De=Lt(ee);L(De),G(r);let S=Math.round((De-t)/s);if(f?.(e.id,S,true),e.segments&&e.segments.length>0&&Re!==null){let W=De-Pe;Be(W);}}else if(P==="resize-start"){let ee=B.x,De=Lt(ee),S=t+r-De;S>=s&&(L(De),G(S));}else if(P==="resize-end"){let ee=B.x,S=Lt(ee)-t;S>=s&&G(S);}},[P,t,r,s,V,e,Lt,Re,Pe,_a,U,$,L,G,Be,f,pr]),br=useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),D.current=null,P!=="none"){if(P==="connect")ve&&d&&d(e,ve),$(null),U(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),ye,ne,B=true;if(P==="move"){if(ye=Ht(J),ne=new Date(ye.getTime()+j),e.segments&&e.segments.length>0&&Re!==null){let ee=Math.round(Fe/s),De=e.segments.map((Ce,nt)=>{if(nt===Re){let be=new Date(Ce.startDate),_=new Date(Ce.endDate);return be.setDate(be.getDate()+ee),_.setDate(_.getDate()+ee),{startDate:be,endDate:_}}return Ce}),S=De.flatMap(Ce=>[Ce.startDate,Ce.endDate]),W=new Date(Math.min(...S.map(Ce=>Ce.getTime()))),pe=new Date(Math.max(...S.map(Ce=>Ce.getTime())));p?.({...e,segments:De},W,pe),ot(t,r);return}}else P==="resize-start"?(ye=Ht(J),ne=e.endDate,ye>ne&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):P==="resize-end"?(ye=e.startDate,ne=Ht(J+Le),ne.setDate(ne.getDate()-1),ne<ye&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&ye&&ne&&(ne.getTime()<ye.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,ye,ne));}f?.(e.id,0,false),ot(t,r);}},[P,J,Le,e,p,ve,d,t,r,s,Ht,Fe,Re,ot,f]);useEffect(()=>{if(P==="none")return;let j=ne=>{ga(ne);},ye=()=>{br();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",ye),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",ye),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,ga,br]);let Ye=Ie&&!vt?J:t,Ze=Ie&&!vt?Le:r,Fa=l.taskClass(e),La=24,nr=y?e.isCriticalPath?1:.25:1,ka=useCallback(j=>{if(!R)return;j.stopPropagation(),j.preventDefault();let ne=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:ne,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),ke(e.progress||0);},[R,e.progress,ke]),Ar=useCallback(j=>{let ye=A.current;if(!ye)return;let B=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??ye.barRect;if(!B||B.width<=0)return;let ee=(j.clientX-B.left)/B.width,De=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(De=Math.round(De/25)*25),ke(De);},[ke]),se=useCallback(j=>{let ye=A.current;if(!ye)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let ne=X;A.current=null,ke(null),ne!=null&&ne!==ye.initialPct&&w&&w(e,ne);},[X,w,e,ke]),fe=useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),ut=X??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true","data-estado":me?"completed":q?"overdue":"planned","data-resumen":dt?"true":void 0,style:{opacity:nr,transition:"opacity 300ms ease"},onClick:()=>{!Ie&&!I.current&&c?.(e),I.current=false;},onDoubleClick:j=>{!Ie&&!I.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!Ie&&Qe(true),onMouseMove:j=>{v&&Ve&&!Ie&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Te,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Ie||(Qe(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+La,height:Te,fill:"transparent",style:{pointerEvents:"all"}}),Ve&&!Ie&&!kt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:qe,height:Te,fill:ze==="resize-start"?n.accent:"transparent",opacity:ze==="resize-start"?.15:0,style:{cursor:lt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:j=>Bt(j,"resize-start")}),jsx("rect",{x:t+qe,y:a,width:r-qe*2,height:Te,fill:ze==="move"?n.accent:"transparent",opacity:ze==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Bt(j,"move")}),jsx("rect",{x:t+r-qe,y:a,width:qe,height:Te,fill:ze==="resize-end"?n.accent:"transparent",opacity:ze==="resize-end"?.15:0,style:{cursor:lt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Bt(j,"resize-end")})]}),Ve&&!Ie&&Yt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Te,fill:ze==="move"?n.accent:"transparent",opacity:ze==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Bt(j,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Te,fill:ze==="resize-end"?n.accent:"transparent",opacity:ze==="resize-end"?.2:0,style:{cursor:lt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Bt(j,"resize-end")}),Ve&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Te-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!vt&&!e.segments&&jsx(motion.rect,{x:J,y:a,width:Le,height:Te,rx:je,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let j=e.baselineStartDate.getTime(),ye=e.baselineEndDate.getTime(),ne=o.getTime(),B=864e5,ee=(j-ne)/B,De=(ye-j)/B,S=ee*s,W=Math.max(De*s,s),pe=Ye+Ze,Ce=S+W,nt=e.endDate?.getTime()??0,be=Math.ceil((nt-ye)/B),_=be>0,gt=be<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:S,y:a,width:W,height:Te,rx:je,fill:"none",stroke:wt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),_&&pe>Ce&&jsx("rect",{x:Ce,y:a,width:pe-Ce,height:Te,rx:0,fill:"#EF4444",opacity:.2}),_&&jsxs("text",{x:Math.max(pe,Ce)+6,y:a+Te/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",be,"d"]}),gt&&jsxs("text",{x:pe+6,y:a+Te/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[be,"d"]})]})})(),!e.segments&&mt&&dt&&(()=>{let ye=a+(Te-8)/2,ne=4,B=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let De=e.startDate&&ee>=e.startDate,S=e.endDate&&(()=>{let _=new Date(e.endDate);return _.setHours(0,0,0,0),ee>_})(),W=e.startDate&&ee<e.startDate,pe=1;if(De&&e.startDate&&e.endDate&&!W){let _=new Date(e.startDate);_.setHours(0,0,0,0);let gt=new Date(e.endDate);gt.setHours(0,0,0,0);let bt=Math.max(1,(gt.getTime()-_.getTime())/(1e3*60*60*24)),Vt=Math.min((ee.getTime()-_.getTime())/(1e3*60*60*24),bt)/bt*100;pe=Vt>0?B/Vt:1;}let Ce;B>=100?Ce="#00E5CC":W?Ce="#4B5563":S&&B<100?Ce="#EF4444":pe>=.95?Ce="#22C55E":pe>=.8?Ce="#F59E0B":Ce="#EF4444";let nt=Math.max(B/100*Ze,B>0?ne*2:0),be=Ze>100&&B>0;return jsxs("g",{"data-task-class":Fa,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:Ye,y:ye,width:Ze,height:8,rx:ne,fill:"rgba(255,255,255,0.10)"}),B>0&&jsx("rect",{"data-parte":"avance",x:Ye,y:ye,width:nt,height:8,rx:ne,fill:Ce}),be&&jsxs("text",{x:Ye+nt+6,y:ye+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(B),"%"]})]})})(),!e.segments&&mt&&!dt&&jsx(motion.rect,{x:Ye,y:a,width:Ze,height:Te,rx:je,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Fa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!vt?.15:e.parentId?.6:1,scale:Ve&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Bt(j),style:{cursor:Oe,pointerEvents:"all"}}),!e.segments&&!mt&&jsx(motion.rect,{x:Ye,y:a,width:Ze,height:Te,rx:je,fill:ue,"data-task-class":Fa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!vt?.15:e.parentId?.6:Ve?.9:.8,scale:Ve&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:dt?void 0:j=>Bt(j),style:{cursor:dt?"default":Oe,pointerEvents:"all"}}),mt&&(q||we)&&!e.segments&&jsx("rect",{x:Ye,y:a,width:Ze,height:Te,rx:je,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),q&&!me&&!e.segments&&!dt&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Ye+Ze+4}, ${a+Te/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&ut>0&&!dt&&jsx("rect",{x:Ye,y:a,width:Math.max(Ze*(ut/100),je*2),height:Te,rx:je,fill:ue,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!dt&&e.progress<100&&(()=>{let j=e.progress>0?Ze*(e.progress/100):0,ye=Ye+j,ne=Ze-j,B=e.progress===0?je:0,ee=e.progress===0?Ye:ye,De=e.progress===0?Ze:ne;return jsxs(Fragment,{children:[jsx("rect",{x:ee,y:a,width:De,height:Te,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:ee,y:a,width:De,height:Te,rx:B,fill:"none",stroke:ue,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),mt&&!e.segments&&e.progress>0&&e.progress<100&&!dt&&!Ie&&X===null&&(()=>{let j=Ye+Ze*(e.progress/100),ye=8,ne=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:j,cy:a+Te/2,r:ye,fill:ne?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:j,y:a+Te/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ne?.initials||ne?.name?.charAt(0)?.toUpperCase()||""})]})})(),R&&!Ie&&Ze>=40&&(X!==null||ut<88)&&(()=>{let j=Ye+Ze*(ut/100),ye=a+Te/2,ne=X!==null,B=ne?7:Ve?6:5,ee=ne||Ve?1:.35,De=Ye+Ze-j,S=Math.max(4,Math.min(12,De-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:j-W,y:ye-12,width:W+S,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ka,onPointerMove:Ar,onPointerUp:se,onPointerCancel:se,onClick:fe,onDoubleClick:fe,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:j,cy:ye,r:B,fill:"#FFFFFF",stroke:ue,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:ne?`drop-shadow(0 0 4px ${ue})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ne&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:j-20,y:ye-28,width:40,height:18,rx:4,fill:wt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:ue,strokeWidth:1}),jsxs("text",{x:j,y:ye-16,textAnchor:"middle",dominantBaseline:"central",fill:wt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((j,ye)=>{let ne=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ne+s,De=Ie&&P==="move"&&Re===ye,S=rt===ye,W=De?ne+Fe:ne;return jsxs("g",{onMouseEnter:()=>!Ie&&ce(ye),onMouseLeave:()=>!Ie&&ce(null),children:[jsx(motion.rect,{x:W,y:a,width:ee,height:Te,rx:je,fill:ue,initial:{opacity:0,scale:.95},animate:{opacity:De||e.parentId?.6:S?.9:.8,scale:S&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),Q(ye),We(ne),Bt(pe,void 0,ne);},style:{cursor:Oe,pointerEvents:"all"}}),jsx("rect",{x:W,y:a,width:ee*(e.progress/100),height:Te,rx:je,fill:ue,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ye}`)}),Ue&&(q||we)&&!e.segments&&jsxs(Fragment,{children:[we&&!q&&jsx("rect",{x:Ye,y:a,width:Ze,height:Te,rx:je,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),q&&jsx("rect",{x:Ye,y:a,width:Ze,height:Te,rx:je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ze>60&&!e.segments&&!(mt&&dt)&&(()=>{let j=l.taskLabel(e),ye=typeof j=="string"?j:e.name,ne=ye.length>Math.floor(Ze/8)?`${ye.substring(0,Math.floor(Ze/8))}...`:ye;return jsx("text",{"data-parte":"etiqueta",x:Ye+8,y:a+Te/2,dominantBaseline:"middle",fill:me?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:me?"line-through":"none"},children:ne})})(),!Ie&&!e.segments&&!dt&&e.progress>0&&e.progress<100&&(mt?jsxs("text",{x:Ye+Ze+6,y:a+Te/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ze>100?jsxs("text",{x:Ye+Ze-12,y:a+Te/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Ze>80&&!Ie&&!e.segments&&!(mt&&dt)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ye+Ze-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ye+Ze-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ve||ht)&&!vt&&!e.segments&&!dt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ye-2,y:a,width:16,height:Te,fill:"transparent",style:{cursor:lt},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"resize-start");}}),jsx(motion.rect,{x:Ye+4,y:a+8,width:3,height:Te-16,rx:1.5,fill:ze==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ye+Ze-14,y:a,width:16,height:Te,fill:"transparent",style:{cursor:lt},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"resize-end");}}),jsx(motion.rect,{x:Ye+Ze-7,y:a+8,width:3,height:Te-16,rx:1.5,fill:ze==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ve&&!Ie&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Te/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Bt(j,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Te/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ze==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),vt&&Ne&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Te/2,x2:Ne.x,y2:Ne.y,stroke:ve?n.statusCompleted:n.accent,strokeWidth:ve?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ve?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ne.x,cy:Ne.y,r:ve?8:6,fill:ve?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ve&&jsx(motion.text,{x:Ne.x+15,y:Ne.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ne.x+10},animate:{opacity:1,x:Ne.x+15},transition:{duration:.2},children:"Connect"})]}),(Ve||Ie)&&!vt&&!e.segments&&jsx(motion.rect,{x:Ye-1,y:a-1,width:Ze+2,height:Te+2,rx:je+1,fill:"none",stroke:Ie?n.accent:mt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:mt?1:2,opacity:Ie||mt?.6:.4,initial:{opacity:0},animate:{opacity:Ie||mt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ht&&jsxs(Fragment,{children:[jsx("line",{x1:J,y1:0,x2:J,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:J+Le,y1:0,x2:J+Le,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ve&&!Ie&&!e.segments&&!v&&(()=>{let ne=a<100,B=ne?a+Te+13:a-82-13,ee=ne?`M ${Ye+Ze/2-6} ${a+Te+3} L ${Ye+Ze/2} ${a+Te+13} L ${Ye+Ze/2+6} ${a+Te+3}`:`M ${Ye+Ze/2-6} ${a-13} L ${Ye+Ze/2} ${a-3} L ${Ye+Ze/2+6} ${a-13}`,De=B+22,S=B+40,W=B+55,pe=B+70,Ce=ne?B+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ne?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ne?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Ye+Ze/2-120,y:B,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ye+Ze/2,y:De,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ye+Ze/2-110,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ye+Ze/2-70,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:za(e.startDate)}),jsx("text",{x:Ye+Ze/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ye+Ze/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:za(e.endDate)}),jsx("text",{x:Ye+Ze/2+10,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ye+Ze/2+65,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ma()}),jsx("text",{x:Ye+Ze/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ye+Ze/2+65,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ye+Ze/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ye+Ze/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(nt=>nt.name).join(", ").substring(0,30),e.assignees.map(nt=>nt.name).join(", ").length>30?"...":""]})]}),!ne&&jsx("text",{x:Ye+Ze/2,y:Ce,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":kt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Fd=260,ks=8,ug=16,ww=-12;function pg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,I=x.lastActivity!=null,C=(M?155:105)+(I?28:0),D=w+ug,P=k+ww-C;D+Fd>window.innerWidth-ks&&(D=w-Fd-ug),D<ks&&(D=ks);let N=P<ks;N&&(P=k+20),P+C>window.innerHeight-ks&&(P=window.innerHeight-ks-C),s({left:D,top:P,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},i=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,I=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;I.getTime()<=C.getTime();){let P=I.getDay();x[P]&&!w.has(k(I))&&M++,I.setDate(I.getDate()+1);}let D=Math.max(0,M);return a==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Fd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(xl,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(xl,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),l&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(y,document.body)}function
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Ee.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Ee.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Ee.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ee.findTaskById(e,t);return !a||!a.dependencies?[]:Ee.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ee.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ee.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ee.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ee.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=Ee.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Ee.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Ee.formatDate(c.startDate):"N/A",c.endDate?Ee.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Ee.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return o;let b=h.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return b.length===0?o:b.reduce((y,x)=>y+x,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(x.id,k),x.subtasks?.length&&i(x.subtasks,k);});};i(e);let u=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),p=n.map(h=>{let b=h.startDate&&h.endDate?Ee.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,x=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,I=typeof w=="number"?+(w/60).toFixed(1):0,C=h._costRate>0?h._costRate:l(h),
|
|
130
|
+
`})]});return createPortal(y,document.body)}function xl({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ui({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:p,glowFilter:d}){let[,m]=useState(false),[f,v]=useState(null),h=r-t,b=h>0,y=Math.abs(h)<5,x=20,w=!y&&a<=e,k,M,I=a-e,C=e+I/2;M=C;let D=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${a} ${r}`;else if(w){let We=e+15,Fe=a-x,Be=b?t+20:t-20;M=Fe;let rt=b?1:-1;k=`M ${e} ${t} L ${We-D} ${t} Q ${We} ${t} ${We} ${t+rt*D} L ${We} ${Be-rt*D} Q ${We} ${Be} ${We-D} ${Be} L ${Fe+D} ${Be} Q ${Fe} ${Be} ${Fe} ${Be+rt*D} L ${Fe} ${r-rt*D} Q ${Fe} ${r} ${Fe+D} ${r} L ${a} ${r}`;}else {M=a-x;let Pe=b?1:-1;k=`M ${e} ${t} L ${M-D} ${t} Q ${M} ${t} ${M} ${t+Pe*D} L ${M} ${r-Pe*D} Q ${M} ${r} ${M+D} ${r} L ${a} ${r}`;}else k=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let P=6,N=5,V=`M ${a} ${r} L ${a-P} ${r-N/2} L ${a-P} ${r+N/2} Z`,O=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),J=u||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=p||1,Le=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),G="#f87171",Ne="rgba(248, 113, 113, 0.15)",$=M,ve=(t+r)/2;if(f)if(o==="squared")if(y)$=Math.max(e+10,Math.min(a-10,f.x)),ve=t;else if(w){let Pe=e+15,We=a-x,Fe=b?t+20:t-20,Be=[[e,t,Pe,t],[Pe,t,Pe,Fe],[Pe,Fe,We,Fe],[We,Fe,We,r],[We,r,a,r]],rt=1/0,ce={x:$,y:ve};for(let Ve of Be){let Qe=U(f.x,f.y,Ve[0],Ve[1],Ve[2],Ve[3]),Ie=Math.hypot(f.x-Qe.x,f.y-Qe.y);Ie<rt&&(rt=Ie,ce=Qe);}$=ce.x,ve=ce.y;}else {let Pe=[[e,t,M,t],[M,t,M,r],[M,r,a,r]],We=1/0,Fe={x:$,y:ve};for(let Be of Pe){let rt=U(f.x,f.y,Be[0],Be[1],Be[2],Be[3]),ce=Math.hypot(f.x-rt.x,f.y-rt.y);ce<We&&(We=ce,Fe=rt);}$=Fe.x,ve=Fe.y;}else {let Pe=C,We=t,Fe=C,Be=r,rt=1/0,ce=$,Ve=ve;for(let Qe=0;Qe<=1;Qe+=.02){let Ie=1-Qe,ht=Ie*Ie*Ie*e+3*Ie*Ie*Qe*Pe+3*Ie*Qe*Qe*Fe+Qe*Qe*Qe*a,vt=Ie*Ie*Ie*t+3*Ie*Ie*Qe*We+3*Ie*Qe*Qe*Be+Qe*Qe*Qe*r,ot=Math.hypot(f.x-ht,f.y-vt);ot<rt&&(rt=ot,ce=ht,Ve=vt);}$=ce,ve=Ve;}function U(Pe,We,Fe,Be,rt,ce){let Ve=rt-Fe,Qe=ce-Be,Ie=Ve*Ve+Qe*Qe;if(Ie===0)return {x:Fe,y:Be};let ht=((Pe-Fe)*Ve+(We-Be)*Qe)/Ie;return ht=Math.max(0,Math.min(1,ht)),{x:Fe+ht*Ve,y:Be+ht*Qe}}let ze=Pe=>{let We=Pe.currentTarget.ownerSVGElement;if(!We)return;let Fe=We.getScreenCTM();if(!Fe)return;let Be=Fe.inverse();v({x:Be.a*Pe.clientX+Be.c*Pe.clientY+Be.e,y:Be.b*Pe.clientX+Be.d*Pe.clientY+Be.f});},oe=()=>{m(false),v(null),c?.(false);},Re=()=>{m(true),c?.(true);},Q=Pe=>s?jsxs(motion.g,{initial:Pe,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:We=>{We.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:$,cy:ve,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:$,cy:ve,r:9,fill:Ne,stroke:G,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:$-3,y1:ve-3,x2:$+3,y2:ve+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:$+3,y1:ve-3,x2:$-3,y2:ve+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:oe,onMouseMove:ze,children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:Le,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Le,opacity:.9,style:{pointerEvents:"none"}}),Q({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Re,onMouseLeave:oe,onMouseMove:ze,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:k,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:k,fill:"none",stroke:Le,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:Le,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Le,style:{pointerEvents:"none"}}),Q({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:Re,onMouseLeave:oe,onMouseMove:ze,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:k,fill:"none",stroke:J,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:V,fill:J,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:J,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Cl({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Ee={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,l=new Set,c=i=>{if(!o.has(i)){o.add(i),l.add(i);let u=r.get(i)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(l.has(p))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ee.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ee.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Ee.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Ee.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Ee.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=Ee.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Ee.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ee.findTaskById(e,t);return !a||!a.dependencies?[]:Ee.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ee.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ee.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ee.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ee.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=Ee.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Ee.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Ee.formatDate(c.startDate):"N/A",c.endDate?Ee.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Ee.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return o;let b=h.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return b.length===0?o:b.reduce((y,x)=>y+x,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(x.id,k),x.subtasks?.length&&i(x.subtasks,k);});};i(e);let u=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),p=n.map(h=>{let b=h.startDate&&h.endDate?Ee.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,x=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,I=typeof w=="number"?+(w/60).toFixed(1):0,C=h._costRate>0?h._costRate:l(h),D={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Ee.formatDate(h.startDate):"","End Date":h.endDate?Ee.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(N=>N.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":I||""};u&&(D["$ Estimated"]=k>0&&C>0?Math.round(k*C):"",D["$ Executed"]=M>0&&C>0?Math.round(M*C):"",D["$ Quoted"]=I>0&&C>0?Math.round(I*C):"",D["Rate ($/h)"]=C>0?C:"");let P=h.weight;return D["Weight (%)"]=typeof P=="number"&&P>0?P:"",D["Is Milestone"]=h.isMilestone?"Yes":"No",D}),d=a?.projectName||"";if(d||p.length>0){let h=0,b=0,y=0,x=0,w=0,k=0,M=0,I=0,C=n.filter(N=>N.startDate).map(N=>N.startDate.getTime()),D=n.filter(N=>N.endDate).map(N=>N.endDate.getTime());for(let N of p)typeof N["Estimated (h)"]=="number"&&(h+=N["Estimated (h)"]),typeof N["Logged (h)"]=="number"&&(b+=N["Logged (h)"]),typeof N["Quoted (h)"]=="number"&&(y+=N["Quoted (h)"]),u&&(typeof N["$ Estimated"]=="number"&&(x+=N["$ Estimated"]),typeof N["$ Executed"]=="number"&&(w+=N["$ Executed"]),typeof N["$ Quoted"]=="number"&&(k+=N["$ Quoted"])),typeof N["Progress (%)"]=="number"&&(M+=N["Progress (%)"],I++);let P={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":C.length>0?Ee.formatDate(new Date(Math.min(...C))):"","End Date":D.length>0?Ee.formatDate(new Date(Math.max(...D))):"","Duration (days)":C.length>0&&D.length>0?Ee.calculateDuration(new Date(Math.min(...C)),new Date(Math.max(...D))):"","Progress (%)":I>0?Math.round(M/I):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};u&&(P["$ Estimated"]=x||"",P["$ Executed"]=w||"",P["$ Quoted"]=k||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",p.unshift(P);}let m=r.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=r.utils.book_new();if(r.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let h=new Date,b=x=>String(x).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ee.flattenTasks(e),n=new Map;r.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=Ee.getEarliestStartDate(e)||new Date,l=Ee.getLatestEndDate(e)||new Date,c=r.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?Ee.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(b=>n.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${n.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ee.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;r.set(i.id,{es:p,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Ee.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let l=new Map,c=[],i=[];for(let d of r)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Ee.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Ee.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Ee.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ee.calculateCriticalPath(e).includes(t))return 0;let n=Ee.getDependentTasks(e,t);if(n.length===0){let l=Ee.getLatestEndDate(e);if(!l)return null;let c=Ee.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=Ee.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ee.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Ee.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ee.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=Ee.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ee.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=Ee.autoScheduleDependents(l,c.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let c=[],i=n.getTime(),u=1e3*60*60*24,p=Ee.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=Ee.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(T=>T.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,I=(x-i)/u*s,C=I+f*s,N=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:I,previewX:C,width:N,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Ee.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function yl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:k="number",canEditTask:M,onTaskProgressDrag:I,workingDaysConfig:C}){let P=qr(),T=useRef(null),[V,O]=useState([]),[Q,L]=useState(null),[Le,G]=useState(null),[Ne,$]=useState(null),ve=useRef(false),[U,We]=useState(new Set),[oe,Re]=useState(null),Z=useCallback(R=>{if(Ne&&!ve.current){let q=R.target,we=false;for(;q&&q!==R.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){we=true;break}q=q.parentElement;}we||$(null);}},[Ne]),Pe=useCallback(R=>{G(R);},[]),Ue=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Fe=r==="day"?60:r==="week"?20:8,Be=Ue*Fe*o,rt=R=>{let q=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),we=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-we);let Oe=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-Oe.getTime())/864e5+1)/7)},le=R=>{let q=R.getDay();return q===0||q===6},Ve=useMemo(()=>{let R=C?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[C?.holidayDates]),Qe=R=>{if(!Ve)return false;let q=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return Ve.has(q)},Ie=useCallback(R=>{let q=Math.round(R/(Fe*o)),we=new Date(n);return we.setDate(we.getDate()+q),we},[n,Fe,o]),ht=useCallback((R,q)=>{if(q.startDate&&q.endDate)return;let we=R.currentTarget.ownerSVGElement;if(!we)return;let Oe=we.createSVGPoint();Oe.x=R.clientX,Oe.y=R.clientY;let me=Oe.matrixTransform(we.getScreenCTM()?.inverse()),et=Ie(me.x),ce=new Date(et);ce.setDate(ce.getDate()+1),Re(null),f?.(q,et,ce);},[Ie,f]),vt=useCallback((R,q,we)=>{let Oe=R.currentTarget.ownerSVGElement;if(!Oe)return;let me=Oe.createSVGPoint();me.x=R.clientX,me.y=R.clientY;let et=me.matrixTransform(Oe.getScreenCTM()?.inverse()),ce=Ie(et.x),$e=Math.round(et.x/(Fe*o))*Fe*o;Re({taskId:q.id,x:$e,y:we*a+a/2,date:ce});},[Ie,Fe,o,a]),ot=useCallback(()=>{Re(null);},[]),Te=useMemo(()=>{let R=me=>me.map(et=>{if(et.subtasks&&et.subtasks.length>0){let ce=R(et.subtasks),ue=ce.filter($e=>$e.startDate&&$e.endDate);if(ue.length>0){let $e=ue.map(kt=>kt.startDate.getTime()),ct=ue.map(kt=>kt.endDate.getTime()),st=new Date(Math.min(...$e)),Ye=new Date(Math.max(...ct));return {...et,subtasks:ce,startDate:st,endDate:Ye}}return {...et,subtasks:ce}}return et}),q=(me,et=[])=>{let ce=[...me].sort((ue,$e)=>(ue.position??0)-($e.position??0));for(let ue of ce)et.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&q(ue.subtasks,et);return et},we=R(e);return q(we)},[e]),mt=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let q=R.startDate.getTime(),we=R.endDate.getTime(),Oe=n.getTime(),me=(q-Oe)/(1e3*60*60*24),et=(we-q)/(1e3*60*60*24)+1,ce=me*Fe*o,ue=Math.max(Fe*o,40),$e=Math.max(et*Fe*o,ue);return {x:ce,width:$e}},[n,Fe,o]),wt=useMemo(()=>Te.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:q,width:we}=mt(R),me=Te.findIndex(et=>et.id===R.id)*a+(a-18)/2;return {id:R.id,x:q,y:me,width:we,height:18}}),[Te,mt]),je=useCallback((R,q,we)=>{if(!we){O([]),L(null);return}if(L({taskId:R,daysDelta:q}),q===0){O([]);return}let Oe=Ee.calculateCascadePreview(e,R,q,Te,n,Fe*o,a,48);O(Oe);},[e,Te,n,Fe,o,a,48]),ut=useCallback((R,q)=>{if(!Q)return q;let we=Fe*o,Oe=Q.daysDelta*we;if(R===Q.taskId)return {x:q.x+Oe,width:q.width};let me=V.find(et=>et.taskId===R);return me?{x:me.previewX,width:me.width}:q},[Q,V,Fe,o]),A=useMemo(()=>{let R=[],q=new Date(n);for(;q<=s;){let me=(q.getTime()-n.getTime())/864e5*Fe*o;if(r==="day")R.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:me}),q.setDate(q.getDate()+1);else if(r==="week"){let et=rt(q);R.push({date:new Date(q),label:k==="range"?(()=>{let ce=new Date(q);ce.setDate(ce.getDate()+6);let ue=$e=>$e.toLocaleDateString(l,{month:"short"});return ue(q)===ue(ce)?`${ue(q)} ${q.getDate()}\u2013${ce.getDate()}`:`${ue(q)} ${q.getDate()}\u2013${ue(ce)} ${ce.getDate()}`})():`${P.labels.week} ${et}`,x:me}),q.setDate(q.getDate()+7);}else R.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:me}),q.setMonth(q.getMonth()+1);}return R},[n,s,r,Fe,o,l,P.labels.week,k]),J=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Fe*o,[n,Fe,o]),ke=Math.max(Te.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Be,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Be,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),A.map((R,q)=>jsxs("g",{children:[q>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:r==="day"&&!le(R.date)&&Qe(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${q}`)),J>=0&&J<=Be&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:J,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:J,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${J-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:P.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(Be,1e3),height:ke,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Z,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Be,1e3),height:ke,fill:t.bgPrimary}),Te.map((R,q)=>jsx("rect",{x:0,y:q*a,width:Math.max(Be,1e3),height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),A.map((R,q)=>q>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Te.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),A.map((R,q)=>{let we=A[q+1]?.x||Be,Oe=w&&le(R.date),me=r==="day"&&!le(R.date)&&Qe(R.date);return Oe||me?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:R.x,y:0,width:we-R.x,height:Te.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:we-R.x,height:Te.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),Te.map((R,q)=>{let we=R.startDate&&R.endDate;return jsx("g",{children:!we&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:q*a,width:Be,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Oe=>ht(Oe,R),onMouseMove:Oe=>vt(Oe,R,q),onMouseLeave:()=>{ot();}},`clickable-${R.id}`),oe&&oe.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:oe.x,y1:q*a+4,x2:oe.x,y2:q*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:oe.x,cy:oe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:oe.x,cy:oe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${oe.x}, ${q*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:oe.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!oe||oe.taskId!==R.id)&&jsx("text",{x:J>0?J:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:P.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),Te.map((R,q)=>{if(!R.startDate||!R.endDate)return null;let{x:we,width:Oe}=mt(R),me=q*a+(a-18)/2,et=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(hl,{task:R,x:we+Oe/2,y:me+12,theme:t,onClick:p},R.id);if(et){let ce=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ue=8,$e=me+(a-18)/2+(18-ue)/2,ct=4,st=R.progress||0,Ye=new Date;Ye.setHours(0,0,0,0);let kt=R.startDate&&Ye>=R.startDate,qt=R.endDate&&(()=>{let ma=new Date(R.endDate);return ma.setHours(0,0,0,0),Ye>ma})(),za=R.startDate&&Ye<R.startDate,pa=1;if(kt&&R.startDate&&R.endDate&&!za){let ma=new Date(R.startDate);ma.setHours(0,0,0,0);let hr=new Date(R.endDate);hr.setHours(0,0,0,0);let Xe=Math.max(1,(hr.getTime()-ma.getTime())/(1e3*60*60*24)),Fa=Math.min((Ye.getTime()-ma.getTime())/(1e3*60*60*24),Xe)/Xe*100;pa=Fa>0?st/Fa:1;}let Lt;st>=100?Lt="#00E5CC":za?Lt="#4B5563":qt&&st<100?Lt="#EF4444":pa>=.95?Lt="#22C55E":pa>=.8?Lt="#F59E0B":Lt="#EF4444";let Ht=Math.max(st/100*Oe,st>0?ct*2:0),ja=Oe>100&&st>0,Bt=R.isCriticalPath;return jsxs("g",{onClick:()=>p?.(R),onContextMenu:ma=>{ma.preventDefault(),ma.stopPropagation(),m?.(R,ma);},onMouseMove:ma=>{Pe({task:R,x:we,y:$e,width:Oe,height:ue,showBelow:$e<100,mouseX:ma.clientX,mouseY:ma.clientY});},onMouseLeave:()=>Pe(null),style:{cursor:"default",opacity:y?Bt?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":st>=100?"completed":qt?"overdue":"planned",children:[jsx("rect",{x:we,y:me,width:Oe,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:we,y:$e,width:Oe,height:ue,rx:ct,fill:ce?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),st>0&&jsx("rect",{x:we,y:$e,width:Ht,height:ue,rx:ct,fill:Lt,"data-parte":"avance"}),y&&Bt&&jsx("rect",{x:we,y:$e,width:Oe,height:ue,rx:ct,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),ja&&jsxs("text",{x:we+Ht+6,y:$e+ue/2,dominantBaseline:"central",fill:ce?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(st),"%"]})]},R.id)}return jsx(pl,{task:R,x:we,y:me,width:Oe,theme:t,dayWidth:Fe*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:wt,onDragMove:je,onHoverChange:Pe,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:M?!M(R):false,onProgressChange:I},R.id)}),x&&Te.map((R,q)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(we=>{let Oe=Te.find(Lt=>Lt.id===we);if(!Oe||!Oe.startDate||!Oe.endDate)return null;let me=Te.findIndex(Lt=>Lt.id===we),et=ut(Oe.id,mt(Oe)),ce=ut(R.id,mt(R)),ue=et.x+et.width,$e=me*a+26,ct=ce.x,st=q*a+26,Ye=`dep-${we}-${R.id}`;if(U.has(Ye))return null;let kt=y&&R.isCriticalPath&&Oe.isCriticalPath;return jsx(ni,{x1:ue,y1:$e,x2:ct,y2:st,theme:t,lineStyle:i,colorOverride:y?kt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?kt?2:1:void 0,glowFilter:kt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,we),onHoverChange:Lt=>{ve.current=Lt,Lt&&$({key:Ye,fromId:we,toId:R.id,exitX:ue,exitY:$e,enterX:ct,enterY:st});}},Ye)})),V.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),x&&Ne&&jsx(ni,{x1:Ne.exitX,y1:Ne.exitY,x2:Ne.enterX,y2:Ne.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=Ne.key;$(null),ve.current=false,We(q=>new Set(q).add(R)),h?.(Ne.toId,Ne.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{ve.current=R,R||$(null);}},`${Ne.key}-hover-overlay`),J>=0&&J<=Be&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:J,y1:0,x2:J,y2:ke,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:J,y1:0,x2:J,y2:ke,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Le&&jsx(dg,{tooltipData:Le,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:C})]})}var Nw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],mg=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Dw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Sw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Ew=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Mw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function wl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,h]=useState(""),[b,y]=useState(false),[x,w]=useState(true),[k,M]=useState(""),[I,C]=useState(-1),[N,P]=useState(false),[T,V]=useState(0),O=useRef(null),Q=useRef(null),L=useRef(null),Le=useRef(null),{enabled:G=true,placeholder:Ne='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:$="bottom-right",onCommand:ve,suggestions:U=Nw,maxHistory:We=50,persistHistory:oe,mentionableUsers:Re=[]}=a,Z=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=Z?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ue=Z?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Fe=Z?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Be=Z?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",rt=Z?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",le=Z?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ve=Z?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Qe=Z?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ie=Z?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ht=Z?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",vt=Z?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",ot=Z?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Te=Z?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",mt=Z?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",wt=Z?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",je=Z?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ut=Z?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=Z?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=Z?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ke=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",R="rgba(0, 229, 204, 0.04)",q=Z?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",we=Z?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Oe=Z?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",me=Z?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=Z?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ce=Z?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ue=Z?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",$e=Z?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",ct="rgba(0, 229, 204, 0.06)",st=Z?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ye=Z?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",kt=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",qt=Z?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",za=Z?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",pa=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Lt=Z?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ht=Z?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",ja=Z?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Bt=Z?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pr=Z?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ma=Z?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",hr=Z?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Xe=Z?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ze=Z?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Fa=oe?.storageKey||"gantt-ai-history",La=oe?.maxMessages??5,rr=Re.filter(B=>{if(!k)return true;let ee=k.toLowerCase();return B.name.toLowerCase().includes(ee)||B.email&&B.email.toLowerCase().includes(ee)}).slice(0,5),ka=useCallback(B=>{if(h(B),Re.length===0)return;let ee=O.current;if(!ee)return;let De=ee.selectionStart||B.length,S=B.slice(0,De),W=S.lastIndexOf("@");if(W>=0&&((W>0?S[W-1]:" ")===" "||W===0)){let Ce=S.slice(W+1);if(Ce.length<=40){M(Ce),C(W),P(true),V(0);return}}P(false),M(""),C(-1);},[Re.length]),Lr=useCallback(B=>{let ee=v.slice(0,I),De=v.slice(I+1+k.length),S=`${ee}@${B.name} ${De}`;h(S),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,I,k]),se=useCallback(B=>{if(!N||rr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),V(ee=>ee<rr.length-1?ee+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),V(ee=>ee>0?ee-1:rr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let ee=rr[T];return ee&&Lr(ee),true}return B.key==="Escape"?(P(false),true):false},[N,rr,T,Lr]);useEffect(()=>{if(oe?.enabled)try{let B=localStorage.getItem(Fa);if(B){let De=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));f(De.slice(-La));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[oe?.enabled,Fa,La]),useEffect(()=>{if(oe?.enabled&&m.length>0)try{let B=m.filter(ee=>!ee.isLoading).slice(-La);localStorage.setItem(Fa,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,oe?.enabled,Fa,La]),useEffect(()=>{Q.current&&Q.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let fe=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,l,c]),pt=useCallback(async B=>{if(!B.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(S=>[...S.slice(-(We-1)),ee]),h(""),w(false),y(true);let De={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(S=>[...S,De]);try{if(ve){let S=m.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await ve(B,e,S);f(pe=>{let Ce=pe.filter(be=>!be.isLoading),nt={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...Ce,nt]}),fe(W);}else f(S=>[...S.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(S){f(W=>[...W.filter(Ce=>!Ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,We,ve,e,fe]),j=B=>{B.preventDefault(),pt(v);},he=B=>{h(B),O.current?.focus();};if(useEffect(()=>{let B=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(De=>!De),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),useEffect(()=>{if(!i)return;let B=De=>{let S=De.target;L.current&&!L.current.contains(S)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",B);}},[i]),!G)return null;let ae={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ca,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ae[$]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ue}`,color:"#00E5CC",cursor:"pointer",boxShadow:Fe,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${rt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(mg,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Qe,background:le,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ve}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ee.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;r.set(i.id,{es:p,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ee.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Ee.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let l=new Map,c=[],i=[];for(let d of r)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Ee.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Ee.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Ee.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ee.calculateCriticalPath(e).includes(t))return 0;let n=Ee.getDependentTasks(e,t);if(n.length===0){let l=Ee.getLatestEndDate(e);if(!l)return null;let c=Ee.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=Ee.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ee.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Ee.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ee.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=Ee.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ee.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=Ee.autoScheduleDependents(l,c.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let c=[],i=n.getTime(),u=1e3*60*60*24,p=Ee.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=Ee.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(N=>N.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,I=(x-i)/u*s,C=I+f*s,D=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:I,previewX:C,width:D,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Ee.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function Tl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:k="number",canEditTask:M,onTaskProgressDrag:I,workingDaysConfig:C}){let P=Xr(),N=useRef(null),[V,O]=useState([]),[J,L]=useState(null),[Le,G]=useState(null),[Ne,$]=useState(null),ve=useRef(false),[U,ze]=useState(new Set),[oe,Re]=useState(null),Q=useCallback(R=>{if(Ne&&!ve.current){let q=R.target,we=false;for(;q&&q!==R.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){we=true;break}q=q.parentElement;}we||$(null);}},[Ne]),Pe=useCallback(R=>{G(R);},[]),We=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Fe=r==="day"?60:r==="week"?20:8,Be=We*Fe*o,rt=R=>{let q=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),we=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-we);let Ue=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-Ue.getTime())/864e5+1)/7)},ce=R=>{let q=R.getDay();return q===0||q===6},Ve=useMemo(()=>{let R=C?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[C?.holidayDates]),Qe=R=>{if(!Ve)return false;let q=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return Ve.has(q)},Ie=useCallback(R=>{let q=Math.round(R/(Fe*o)),we=new Date(n);return we.setDate(we.getDate()+q),we},[n,Fe,o]),ht=useCallback((R,q)=>{if(q.startDate&&q.endDate)return;let we=R.currentTarget.ownerSVGElement;if(!we)return;let Ue=we.createSVGPoint();Ue.x=R.clientX,Ue.y=R.clientY;let me=Ue.matrixTransform(we.getScreenCTM()?.inverse()),et=Ie(me.x),de=new Date(et);de.setDate(de.getDate()+1),Re(null),f?.(q,et,de);},[Ie,f]),vt=useCallback((R,q,we)=>{let Ue=R.currentTarget.ownerSVGElement;if(!Ue)return;let me=Ue.createSVGPoint();me.x=R.clientX,me.y=R.clientY;let et=me.matrixTransform(Ue.getScreenCTM()?.inverse()),de=Ie(et.x),Oe=Math.round(et.x/(Fe*o))*Fe*o;Re({taskId:q.id,x:Oe,y:we*a+a/2,date:de});},[Ie,Fe,o,a]),ot=useCallback(()=>{Re(null);},[]),Te=useMemo(()=>{let R=me=>me.map(et=>{if(et.subtasks&&et.subtasks.length>0){let de=R(et.subtasks),ue=de.filter(Oe=>Oe.startDate&&Oe.endDate);if(ue.length>0){let Oe=ue.map(kt=>kt.startDate.getTime()),lt=ue.map(kt=>kt.endDate.getTime()),st=new Date(Math.min(...Oe)),qe=new Date(Math.max(...lt));return {...et,subtasks:de,startDate:st,endDate:qe}}return {...et,subtasks:de}}return et}),q=(me,et=[])=>{let de=[...me].sort((ue,Oe)=>(ue.position??0)-(Oe.position??0));for(let ue of de)et.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&q(ue.subtasks,et);return et},we=R(e);return q(we)},[e]),mt=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let q=R.startDate.getTime(),we=R.endDate.getTime(),Ue=n.getTime(),me=(q-Ue)/(1e3*60*60*24),et=(we-q)/(1e3*60*60*24)+1,de=me*Fe*o,ue=Math.max(Fe*o,40),Oe=Math.max(et*Fe*o,ue);return {x:de,width:Oe}},[n,Fe,o]),wt=useMemo(()=>Te.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:q,width:we}=mt(R),me=Te.findIndex(et=>et.id===R.id)*a+(a-18)/2;return {id:R.id,x:q,y:me,width:we,height:18}}),[Te,mt]),je=useCallback((R,q,we)=>{if(!we){O([]),L(null);return}if(L({taskId:R,daysDelta:q}),q===0){O([]);return}let Ue=Ee.calculateCascadePreview(e,R,q,Te,n,Fe*o,a,48);O(Ue);},[e,Te,n,Fe,o,a,48]),dt=useCallback((R,q)=>{if(!J)return q;let we=Fe*o,Ue=J.daysDelta*we;if(R===J.taskId)return {x:q.x+Ue,width:q.width};let me=V.find(et=>et.taskId===R);return me?{x:me.previewX,width:me.width}:q},[J,V,Fe,o]),A=useMemo(()=>{let R=[],q=new Date(n);for(;q<=s;){let me=(q.getTime()-n.getTime())/864e5*Fe*o;if(r==="day")R.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:me}),q.setDate(q.getDate()+1);else if(r==="week"){let et=rt(q);R.push({date:new Date(q),label:k==="range"?(()=>{let de=new Date(q);de.setDate(de.getDate()+6);let ue=Oe=>Oe.toLocaleDateString(l,{month:"short"});return ue(q)===ue(de)?`${ue(q)} ${q.getDate()}\u2013${de.getDate()}`:`${ue(q)} ${q.getDate()}\u2013${ue(de)} ${de.getDate()}`})():`${P.labels.week} ${et}`,x:me}),q.setDate(q.getDate()+7);}else R.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:me}),q.setMonth(q.getMonth()+1);}return R},[n,s,r,Fe,o,l,P.labels.week,k]),X=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Fe*o,[n,Fe,o]),ke=Math.max(Te.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Be,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Be,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),A.map((R,q)=>jsxs("g",{children:[q>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:r==="day"&&!ce(R.date)&&Qe(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${q}`)),X>=0&&X<=Be&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:X,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:X,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${X-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:P.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:N,width:Math.max(Be,1e3),height:ke,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Q,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Be,1e3),height:ke,fill:t.bgPrimary}),Te.map((R,q)=>jsx("rect",{x:0,y:q*a,width:Math.max(Be,1e3),height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),A.map((R,q)=>q>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Te.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),A.map((R,q)=>{let we=A[q+1]?.x||Be,Ue=w&&ce(R.date),me=r==="day"&&!ce(R.date)&&Qe(R.date);return Ue||me?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:R.x,y:0,width:we-R.x,height:Te.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:we-R.x,height:Te.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),Te.map((R,q)=>{let we=R.startDate&&R.endDate;return jsx("g",{children:!we&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:q*a,width:Be,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ue=>ht(Ue,R),onMouseMove:Ue=>vt(Ue,R,q),onMouseLeave:()=>{ot();}},`clickable-${R.id}`),oe&&oe.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:oe.x,y1:q*a+4,x2:oe.x,y2:q*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:oe.x,cy:oe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:oe.x,cy:oe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${oe.x}, ${q*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:oe.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!oe||oe.taskId!==R.id)&&jsx("text",{x:X>0?X:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:P.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),Te.map((R,q)=>{if(!R.startDate||!R.endDate)return null;let{x:we,width:Ue}=mt(R),me=q*a+(a-18)/2,et=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(Cl,{task:R,x:we+Ue/2,y:me+12,theme:t,onClick:p},R.id);if(et){let de=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ue=8,Oe=me+(a-18)/2+(18-ue)/2,lt=4,st=R.progress||0,qe=new Date;qe.setHours(0,0,0,0);let kt=R.startDate&&qe>=R.startDate,Yt=R.endDate&&(()=>{let ga=new Date(R.endDate);return ga.setHours(0,0,0,0),qe>ga})(),za=R.startDate&&qe<R.startDate,ma=1;if(kt&&R.startDate&&R.endDate&&!za){let ga=new Date(R.startDate);ga.setHours(0,0,0,0);let br=new Date(R.endDate);br.setHours(0,0,0,0);let Ye=Math.max(1,(br.getTime()-ga.getTime())/(1e3*60*60*24)),Fa=Math.min((qe.getTime()-ga.getTime())/(1e3*60*60*24),Ye)/Ye*100;ma=Fa>0?st/Fa:1;}let Lt;st>=100?Lt="#00E5CC":za?Lt="#4B5563":Yt&&st<100?Lt="#EF4444":ma>=.95?Lt="#22C55E":ma>=.8?Lt="#F59E0B":Lt="#EF4444";let Ht=Math.max(st/100*Ue,st>0?lt*2:0),_a=Ue>100&&st>0,Bt=R.isCriticalPath;return jsxs("g",{onClick:()=>p?.(R),onContextMenu:ga=>{ga.preventDefault(),ga.stopPropagation(),m?.(R,ga);},onMouseMove:ga=>{Pe({task:R,x:we,y:Oe,width:Ue,height:ue,showBelow:Oe<100,mouseX:ga.clientX,mouseY:ga.clientY});},onMouseLeave:()=>Pe(null),style:{cursor:"default",opacity:y?Bt?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":st>=100?"completed":Yt?"overdue":"planned",children:[jsx("rect",{x:we,y:me,width:Ue,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:we,y:Oe,width:Ue,height:ue,rx:lt,fill:de?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),st>0&&jsx("rect",{x:we,y:Oe,width:Ht,height:ue,rx:lt,fill:Lt,"data-parte":"avance"}),y&&Bt&&jsx("rect",{x:we,y:Oe,width:Ue,height:ue,rx:lt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),_a&&jsxs("text",{x:we+Ht+6,y:Oe+ue/2,dominantBaseline:"central",fill:de?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(st),"%"]})]},R.id)}return jsx(yl,{task:R,x:we,y:me,width:Ue,theme:t,dayWidth:Fe*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:wt,onDragMove:je,onHoverChange:Pe,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:M?!M(R):false,onProgressChange:I},R.id)}),x&&Te.map((R,q)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(we=>{let Ue=Te.find(Lt=>Lt.id===we);if(!Ue||!Ue.startDate||!Ue.endDate)return null;let me=Te.findIndex(Lt=>Lt.id===we),et=dt(Ue.id,mt(Ue)),de=dt(R.id,mt(R)),ue=et.x+et.width,Oe=me*a+26,lt=de.x,st=q*a+26,qe=`dep-${we}-${R.id}`;if(U.has(qe))return null;let kt=y&&R.isCriticalPath&&Ue.isCriticalPath;return jsx(ui,{x1:ue,y1:Oe,x2:lt,y2:st,theme:t,lineStyle:i,colorOverride:y?kt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?kt?2:1:void 0,glowFilter:kt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,we),onHoverChange:Lt=>{ve.current=Lt,Lt&&$({key:qe,fromId:we,toId:R.id,exitX:ue,exitY:Oe,enterX:lt,enterY:st});}},qe)})),V.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),x&&Ne&&jsx(ui,{x1:Ne.exitX,y1:Ne.exitY,x2:Ne.enterX,y2:Ne.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=Ne.key;$(null),ve.current=false,ze(q=>new Set(q).add(R)),h?.(Ne.toId,Ne.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{ve.current=R,R||$(null);}},`${Ne.key}-hover-overlay`),X>=0&&X<=Be&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:X,y1:0,x2:X,y2:ke,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:X,y1:0,x2:X,y2:ke,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Le&&jsx(pg,{tooltipData:Le,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:C})]})}var Nw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],fg=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Dw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Sw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Ew=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Mw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Sl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,h]=useState(""),[b,y]=useState(false),[x,w]=useState(true),[k,M]=useState(""),[I,C]=useState(-1),[D,P]=useState(false),[N,V]=useState(0),O=useRef(null),J=useRef(null),L=useRef(null),Le=useRef(null),{enabled:G=true,placeholder:Ne='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:$="bottom-right",onCommand:ve,suggestions:U=Nw,maxHistory:ze=50,persistHistory:oe,mentionableUsers:Re=[]}=a,Q=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=Q?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",We=Q?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Fe=Q?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Be=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",rt=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ce=Q?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ve=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Qe=Q?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ie=Q?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ht=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",vt=Q?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",ot=Q?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Te=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",mt=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",wt=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",je=Q?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",dt=Q?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=Q?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",X=Q?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",ke=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",R="rgba(0, 229, 204, 0.04)",q=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",we=Q?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=Q?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",me=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=Q?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",de=Q?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ue=Q?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Oe=Q?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",lt="rgba(0, 229, 204, 0.06)",st=Q?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",qe=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",kt=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Yt=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",za=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ma=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Lt=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ht=Q?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",_a=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Bt=Q?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",pr=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ga=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",br=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ye=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ze=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Fa=oe?.storageKey||"gantt-ai-history",La=oe?.maxMessages??5,nr=Re.filter(B=>{if(!k)return true;let ee=k.toLowerCase();return B.name.toLowerCase().includes(ee)||B.email&&B.email.toLowerCase().includes(ee)}).slice(0,5),ka=useCallback(B=>{if(h(B),Re.length===0)return;let ee=O.current;if(!ee)return;let De=ee.selectionStart||B.length,S=B.slice(0,De),W=S.lastIndexOf("@");if(W>=0&&((W>0?S[W-1]:" ")===" "||W===0)){let Ce=S.slice(W+1);if(Ce.length<=40){M(Ce),C(W),P(true),V(0);return}}P(false),M(""),C(-1);},[Re.length]),Ar=useCallback(B=>{let ee=v.slice(0,I),De=v.slice(I+1+k.length),S=`${ee}@${B.name} ${De}`;h(S),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,I,k]),se=useCallback(B=>{if(!D||nr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),V(ee=>ee<nr.length-1?ee+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),V(ee=>ee>0?ee-1:nr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let ee=nr[N];return ee&&Ar(ee),true}return B.key==="Escape"?(P(false),true):false},[D,nr,N,Ar]);useEffect(()=>{if(oe?.enabled)try{let B=localStorage.getItem(Fa);if(B){let De=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));f(De.slice(-La));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[oe?.enabled,Fa,La]),useEffect(()=>{if(oe?.enabled&&m.length>0)try{let B=m.filter(ee=>!ee.isLoading).slice(-La);localStorage.setItem(Fa,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,oe?.enabled,Fa,La]),useEffect(()=>{J.current&&J.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let fe=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&l?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,l,c]),ut=useCallback(async B=>{if(!B.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(S=>[...S.slice(-(ze-1)),ee]),h(""),w(false),y(true);let De={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(S=>[...S,De]);try{if(ve){let S=m.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await ve(B,e,S);f(pe=>{let Ce=pe.filter(be=>!be.isLoading),nt={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...Ce,nt]}),fe(W);}else f(S=>[...S.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(S){f(W=>[...W.filter(Ce=>!Ce.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,ze,ve,e,fe]),j=B=>{B.preventDefault(),ut(v);},ye=B=>{h(B),O.current?.focus();};if(useEffect(()=>{let B=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(De=>!De),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[i]),useEffect(()=>{if(!i)return;let B=De=>{let S=De.target;L.current&&!L.current.contains(S)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",B);}},[i]),!G)return null;let ne={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ua,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ne[$]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${We}`,color:"#00E5CC",cursor:"pointer",boxShadow:Fe,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${rt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(fg,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Qe,background:ce,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ve}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ae[$]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ie,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ht}`,boxShadow:vt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ot,borderBottom:`1px solid ${Te}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:mt,border:`1px solid ${wt}`,color:"#00E5CC"},children:jsx(mg,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:je},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:ut},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=ut;},children:jsx(Ew,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ut},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=ut;},children:jsx(Sw,{})})]})]}),jsx(AnimatePresence,{children:!p&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ke,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:U.slice(0,4).map((B,ee)=>jsx("button",{onClick:()=>he(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:R,color:we,border:`1px solid ${q}`},onMouseEnter:De=>{De.currentTarget.style.borderColor=Oe,De.currentTarget.style.color="#00E5CC";},onMouseLeave:De=>{De.currentTarget.style.borderColor=q,De.currentTarget.style.color=we;},children:B.length>30?B.slice(0,30)+"...":B},ee))})]}),m.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?me:ce,color:B.role==="user"?"#00E5CC":$e,border:B.role==="user"?`1px solid ${et}`:`1px solid ${ue}`},children:[B.isLoading?jsx(Mw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:Q})]}),jsxs("form",{onSubmit:B=>{if(N&&rr.length>0){B.preventDefault();return}j(B);},className:"p-3 relative",style:{borderTop:`1px solid ${ct}`},children:[jsx(AnimatePresence,{children:N&&rr.length>0&&jsx(motion.div,{ref:Le,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ht,border:`1px solid ${ja}`,boxShadow:Bt,backdropFilter:"blur(12px)"},children:rr.map((B,ee)=>jsxs("button",{type:"button",onClick:()=>Lr(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===T?pr:"transparent",color:ma},onMouseEnter:()=>V(ee),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Xe,border:`1px solid ${Ze}`,color:"#00E5CC"},children:B.name.split(" ").map(De=>De[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:hr},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${Ye}`},children:[jsx("input",{ref:O,type:"text",value:v,onChange:B=>ka(B.target.value),onKeyDown:B=>{se(B);},placeholder:Ne,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:kt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?qt:"transparent",color:v.trim()?"#00E5CC":pa,border:v.trim()?`1px solid ${za}`:"1px solid transparent"},children:jsx(Dw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Lt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function gg(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(p=>{let d=typeof i=="function"?i(p.present):i;if(n.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function fg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Aw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ee.formatDate(e.startDate)} - ${Ee.formatDate(e.endDate)}`);let a=Ee.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ee.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function bg(e){return {...Aw,...e}}var Ww=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},wg=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:I,onCreateTask:C,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:T,toolbarContainer:V,hideWbsLevel:O,showBaseline:Q,viewMode:L,onViewModeChange:Le,projectForecast:G,hideForecastHud:Ne,onThemeChange:$,onTaskClick:ve,onTaskSelectionChange:U,selectedTaskId:We,onTaskDblClick:oe,onTaskContextMenu:Re,onTaskUpdate:Z,onDependentTasksScheduled:Pe,onProgressChange:Ue,onTaskEdit:Fe,onTaskAddSubtask:Be,onTaskMarkIncomplete:rt,onTaskSetInProgress:le,onDependencyCreate:Ve,onDependencyDelete:Qe,onBeforeTaskAdd:Ie,onAfterTaskAdd:ht,onBeforeTaskUpdate:vt,onAfterTaskUpdate:ot,onBeforeTaskDelete:Te,onAfterTaskDelete:mt,permissions:wt,onCopySnapshotLink:je}=a,A=useContext(sl)?.theme,[J,ke]=useState(A||s||"dark"),[R,q]=useState(o),[we,Oe]=useState(l),[me,et]=useState(1),[ce,ue]=useState("all"),[$e,ct]=useState(L||"execution"),st=L??$e,Ye=useCallback(E=>{ct(E),Le?.(E);},[Le]),kt=Q??st==="oracle",[qt,za]=useState(a.showCriticalPath!==false),[pa,Lt]=useState(a.showDependencies!==false),[Ht,ja]=useState(a.highlightWeekends!==false),Bt=useCallback(E=>{za(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),pr=useCallback(E=>{Lt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),ma=useCallback(E=>{ja(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(R);},[R]),useEffect(()=>{a.onZoomChange?.(me);},[me]);let hr=useRef(a.onDateRangeChange);hr.current=a.onDateRangeChange;let Xe=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ze,Fa]=useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),La=N??Ze,rr=P??Fa,[ka,Lr]=useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Xe();if(E)try{let F={taskFilter:La,hideCompleted:ka};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[La,ka,Xe]);let se=useRef(y);useEffect(()=>{if(se.current!==y&&y!==void 0){Fa("all"),Lr(false);let E=Xe();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}se.current=y;},[y,Xe]);let[fe,pt]=useState(0),[j,he]=useState(false),[ae,B]=useState(null),[ee,De]=useState({isOpen:false,x:0,y:0,task:null}),[S,W]=useState(null),[pe,Ce]=useState(null);useEffect(()=>{A&&A!==J&&ke(A);},[A]),useEffect(()=>{s&&s!==J&&ke(s);},[s]);let nt=useCallback(E=>{ke(E),$?.(E);},[$]),{state:be,setState:_,undo:gt,redo:bt,canUndo:Ut,canRedo:Vt,clearHistory:nr}=gg(t,50),yr=useMemo(()=>{let E=(F,H=0)=>{let K=H;for(let ie of F)ie.subtasks?.length&&(K=Math.max(K,E(ie.subtasks,H+1)));return K};return E(be)+1},[be]),Tr=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ta=useRef(new Map),qo=useRef(false);if(!qo.current&&v){qo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let H=JSON.parse(F);Array.isArray(H)&&(ta.current=new Map(H));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Rn=useCallback(()=>{let E=Tr();if(E)try{let F=Array.from(ta.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[Tr]),Gr=useRef(0),Yn=useRef(be);useEffect(()=>{Yn.current=be;},[be]);let Xn=useRef(false),Ci=useCallback(E=>{ue(E),Gr.current+=1,_(F=>{let H=(ie,ge=0)=>ie.map(_e=>{let Ke=E==="all"||ge<E-1;return _e.subtasks?.length&&ta.current.set(_e.id,Ke),{..._e,isExpanded:Ke,subtasks:_e.subtasks?H(_e.subtasks,ge+1):void 0}}),K=H(F);return Rn(),K});},[_,Rn]);useEffect(()=>{if(Gr.current>0){Gr.current-=1;return}let E=H=>{let K=new Map;for(let ie of H){let ge=ie.id;K.get(ge)||K.set(ge,ie);}return Array.from(K.values())},F=H=>H.map(K=>{let ie=ta.current.get(K.id),ge=ie!==void 0?{...K,isExpanded:ie}:K;if(ge.subtasks?.length){let _e=E(ge.subtasks);return {...ge,subtasks:F(_e)}}return ge});if(ta.current.size>0)_(Yr(F(t)));else {let H=K=>K.map(ie=>ie.subtasks?.length?{...ie,subtasks:E(H(ie.subtasks))}:ie);_(Yr(H(t)));}},[t,_]);let Yo=useRef(t),Ti=useRef(true);useEffect(()=>{if(Ti.current){Ti.current=false,Yo.current=be;return}if(Xn.current){Xn.current=false,Yo.current=be;return}if(!r)return;let E=JSON.stringify(Yo.current),F=JSON.stringify(be);E!==F&&(Yo.current=be,r(be));},[be,r]);let _a=useMemo(()=>cd(w,k),[w,k]),Ps=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Jn=a.defaultVisibleColumns,Fs=useCallback(E=>Jn?E.map(F=>F.id==="name"?F:{...F,visible:Jn.includes(F.id)}):E,[Jn]),xr=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[tn,Bn]=useState(()=>{let E=Fs(Ps(_a));if(!b)return E;try{let F=typeof b=="string"?b:"gantt-columns-state",H=localStorage.getItem(F);if(!H)return E;let K=JSON.parse(H),ie=new Map(K.map(ge=>[ge.id,ge]));return E.map(ge=>{let _e=ie.get(ge.id);return _e?{...ge,visible:_e.visible??ge.visible,width:_e.width??ge.width}:ge})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Ls=useRef(xr);useEffect(()=>{if(Ls.current===xr)return;Ls.current=xr;let E=Fs(Ps(_a));if(!xr){Bn(E);return}try{let F=localStorage.getItem(xr);if(!F){Bn(E);return}let H=JSON.parse(F),K=new Map(H.map(ie=>[ie.id,ie]));Bn(E.map(ie=>{let ge=K.get(ie.id);return ge?{...ie,visible:ge.visible??ie.visible,width:ge.width??ie.width}:ie}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),Bn(E);}},[xr,Ps,_a]),useEffect(()=>{if(xr&&Ls.current===xr)try{let E=tn.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(xr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[tn,xr]),useEffect(()=>{Bn(E=>E.map(F=>({...F,label:_a.columns[F.id==="name"?"taskName":F.id]||F.label})));},[_a]);let kn=useMemo(()=>tn.filter(F=>F.visible).reduce((F,H)=>F+H.width,0),[tn]),Ni=useRef(tn.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=tn.filter(K=>K.visible),F=E.map(K=>K.id).join(","),H=Ni.current;if(F!==H){let K=E.some(ge=>ge.id!=="name"),ie=H.includes(",");K?!ie&&K&&B(null):B(null),Ni.current=F;}},[tn]);let As=60,Di=.6,Si=useMemo(()=>{let F=kn+As,H=typeof window<"u"?window.innerWidth*Di:800,K=Math.max(F,H);return ae!==null?Math.max(200,Math.min(ae,K)):Math.max(200,F)},[ae,kn]),Vr=useRef(null),Qn=useRef(null),or=useRef(null),D=useRef(null),X=useRef(null),Y=useMemo(()=>Im(J),[J]),de=useMemo(()=>({theme:Y,themeName:J}),[Y,J]),ye=useMemo(()=>bg(m),[m]),ze=useMemo(()=>{if(!f||!qt)return be;let E=Ee.calculateCriticalPathFull(be),F=H=>H.map(K=>{let ie=E.get(K.id),ge=K.subtasks?F(K.subtasks):void 0,_e=ge?.some(aa=>aa.isCriticalPath||aa.subtasks&&aa.subtasks.some(zt=>zt.isCriticalPath))||false,Ke=ie?ie.isCritical:_e;return {...K,isCriticalPath:Ke,cpmData:ie||void 0,subtasks:ge}});return F(be)},[be,f,qt]),re=useMemo(()=>Ee.flattenTasks(be).some(F=>F.dependencies&&F.dependencies.length>0),[be]),Se=useMemo(()=>{let E=(F,H="")=>[...F].sort((ie,ge)=>(ie.position??0)-(ge.position??0)).map((ie,ge)=>{let _e=ge+1,Ke=H?`${H}.${_e}`:`${_e}.0`,aa=H?`${H}.${_e}`:`${_e}`;return {...ie,wbsCode:Ke,subtasks:ie.subtasks?.length?E(ie.subtasks,aa):ie.subtasks}});return E(ze)},[ze]),He=useMemo(()=>{if(La==="all"&&!ka)return Se;let E=F=>{let H=[];for(let K of F){let ie=K.subtasks?.length?E(K.subtasks):void 0,ge=false;if(ka)ge=K.progress<100&&K.status!=="completed";else switch(La){case "all":ge=true;break;case "incomplete":ge=K.progress<100;break;case "in_progress":ge=K.progress>0&&K.progress<100;break;case "completed":ge=K.progress===100;break}(ge||ie&&ie.length>0)&&H.push({...K,subtasks:ie});}return H};return E(Se)},[Se,La,ka]),qe=Ww(we);fg({undo:gt,redo:bt,canUndo:Ut,canRedo:Vt,enabled:true});let Pt=useRef(null),it=(E,F="start")=>{let H=or.current,K=X.current;if(!H||!K)return;let ie=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),ge=K.timeScale==="day"?60:K.timeScale==="week"?20:8,_e=ie*ge*K.zoom,Ke=F==="center"?_e-H.clientWidth/2:_e-ge*K.zoom*2;H.scrollTo({left:Math.max(0,Ke),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>Ee.findTaskById(be,E),addTask:(E,F)=>{_(H=>{if(!F)return [...H,{...E,level:0}];let K=ie=>ie.map(ge=>ge.id===F?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:F,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(H)});},updateTask:(E,F)=>{_(H=>{let K=ie=>ie.map(ge=>ge.id===E?{...ge,...F}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(H)});},deleteTask:E=>{_(F=>{let H=K=>K.filter(ie=>ie.id===E?false:(ie.subtasks&&(ie.subtasks=H(ie.subtasks)),true));return H(F)});},deleteTasks:E=>{_(F=>wd(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Ee.findTaskById(be,E);F&&a.onTaskDuplicate(F);}else _(F=>ai(F,[E]).tasks);},splitTask:(E,F,H=3)=>{_(K=>Ee.splitTask(K,E,F,H));},calculateEndDate:Ee.calculateEndDate,calculateDuration:Ee.calculateDuration,validateDependency:(E,F)=>!Ee.validateDependencies(be,E,F),getAllTasks:()=>Ee.flattenTasks(be),getTasksByStatus:E=>Ee.flattenTasks(be).filter(F=>F.status===E),getTasksByParent:E=>E?Ee.findTaskById(be,E)?.subtasks||[]:be.filter(H=>!H.parentId),getCriticalPath:()=>Ee.flattenTasks(be).filter(E=>E.isCriticalPath),indentTask:E=>{_(F=>Yr(yd(F,[E])));},outdentTask:E=>{_(F=>Yr(xd(F,[E])));},moveTask:(E,F)=>{_(H=>vd(H,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:H}=Td(be,E);if(Ie){let K=Ie({...H,parentId:E});if((K instanceof Promise?await K:K)===false)return}_(Yr(F)),ht&&ht({...H,parentId:E});},scrollToTask:E=>{let H=Ee.flattenTasks(be).findIndex(K=>K.id===E);if(H!==-1&&Vr.current){let K=H*qe;Vr.current.scrollTo({top:K,behavior:"smooth"}),or.current&&or.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{_(F=>{let H=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie);return H(F)});},collapseTask:E=>{_(F=>{let H=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie);return H(F)});},expandAll:()=>{_(E=>{let F=H=>H.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseAll:()=>{_(E=>{let F=H=>H.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Ci(E);},undo:gt,redo:bt,canUndo:()=>Ut,canRedo:()=>Vt,clearHistory:nr,exportToPNG:async()=>{if(!D.current||!Vr.current||!or.current)throw new Error("Gantt container not found");let E=D.current,F=Vr.current,H=Qn.current||F.querySelector(".gantt-grid-scroll"),K=or.current,ie=H?.scrollTop||0,ge=K.scrollTop,_e=E.style.overflow,Ke=E.style.height,aa=F.style.overflow;try{let zt=H?.querySelector(".gantt-taskgrid-content"),la=K.querySelector("svg"),gr=zt?.scrollHeight||H?.scrollHeight||600,Hr=la?.getBoundingClientRect().height||K.scrollHeight,To=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(gr,Hr)+20;H&&(H.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${To}px`,F.style.overflow="visible",await new Promise(Qo=>setTimeout(Qo,100));let Tn=await toPng(E,{backgroundColor:Y.bgPrimary,pixelRatio:2,filter:Qo=>{if(!(Qo instanceof Element))return !0;let Ei=window.getComputedStyle(Qo),Bs=parseInt(Ei.zIndex,10);return (isNaN(Bs)||Bs<50)&&Ei.position!=="fixed"}});return await(await fetch(Tn)).blob()}finally{E.style.overflow=_e,E.style.height=Ke,F.style.overflow=aa,H&&(H.scrollTop=ie),K.scrollTop=ge;}},exportToPDF:async E=>{await Ee.exportToPDF(be,E);},exportToExcel:async E=>{await Ee.exportToExcel(be,E,oc.current);},exportToJSON:()=>Ee.exportToJSON(be),exportToCSV:()=>Ee.exportToCSV(be),importFromJSON:E=>{let F=Ee.importFromJSON(E);_(F);},getTasks:()=>be,refresh:()=>{_(E=>[...E]);},clearAll:()=>{_([]);},scrollToDate:(E,F="start")=>it(E,F),fitToDates:(E,F)=>{let H=Math.max(1,(F.getTime()-E.getTime())/864e5),K=H<=21?"day":H<=122?"week":"month";Pt.current=E,q(K),K===X.current?.timeScale&&requestAnimationFrame(()=>{let ie=Pt.current;Pt.current=null,ie&&it(ie);});},scrollToToday:()=>{let E=or.current,F=X.current;if(!E||!F)return;let K=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),ie=F.timeScale==="day"?60:F.timeScale==="week"?20:8,ge=K*ie*F.zoom,_e=E.clientWidth,Ke=Math.max(0,ge-_e/2);E.scrollTo({left:Ke,behavior:"smooth"});}}),[be,gt,bt,Ut,Vt,nr,Y,qe]);let ft=useCallback(E=>{Bn(F=>F.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),ia=useCallback((E,F)=>{Bn(H=>H.map(K=>{if(K.id!==E)return K;let ie=K.minWidth??100,ge=K.maxWidth??800,_e=Math.max(ie,Math.min(ge,F));return {...K,width:_e}}));},[]),jt=useCallback(E=>{_(F=>{let H=Cd(F,E),K=ie=>{for(let ge of ie){if(ge.id===E){ta.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&K(ge.subtasks);}};return K(H),Rn(),H}),a.onTaskToggleExpand?.(E);},[a,Rn]),ga=useCallback((E,F)=>{if(vt&&vt(E,F)===false)return;let K=Ee.findTaskById(be,E)?.progress,ie=_e=>_e.map(Ke=>Ke.id===E?{...Ke,...F}:Ke.subtasks?{...Ke,subtasks:ie(Ke.subtasks)}:Ke);_(_e=>ie(_e));let ge=Ee.findTaskById(ie(be),E);ge&&(Z?.(ge),ot?.(ge),F.progress!==void 0&&K!==void 0&&F.progress!==K&&Ue?.(E,K,F.progress));},[be,Z,vt,ot,Ue]),Wt=useCallback((E,F,H)=>{if(E.length===0)return;let K=new Set(E),ie=ge=>ge.map(_e=>{let Ke=K.has(_e.id)?{..._e,[F]:H}:_e;return Ke.subtasks?{...Ke,subtasks:ie(Ke.subtasks)}:Ke});_(ge=>{let _e=ie(ge);return a.onBulkFill?.(E,F,H,_e),_e});},[a]),Jt=useCallback(E=>{E.length!==0&&(Gr.current+=1,Xn.current=true,_(F=>Yr(yd(F,E))),a.onTaskIndent?.(E[0]));},[a]),Et=useCallback(E=>{E.length!==0&&(Gr.current+=1,Xn.current=true,_(F=>Yr(xd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),At=useCallback((E,F,H)=>{Gr.current+=1,Xn.current=true,_(K=>Yr(tg(K,E,F,H))),a.onTaskReparent?.(E,F,H);},[a]),Aa=useCallback((E,F)=>{E.length!==0&&(Gr.current+=1,Xn.current=true,_(H=>vd(H,E,F)),a.onTaskMove?.(E[0],F));},[a]),sr=useCallback(async E=>{let F=[];for(let H of E)Te&&await Promise.resolve(Te(H))===false||F.push(H);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(_(H=>Yr(wd(H,F))),F.forEach(H=>a.onTaskDelete?.(H))),mt&&F.forEach(H=>mt(H)));},[a,Te,mt]),Nr=useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let H=Ee.findTaskById(be,F);H&&a.onTaskDuplicate(H);}):_(F=>ai(F,E).tasks);},[a,be]),mr=useCallback((E,F)=>{_(H=>{let{tasks:K,newTask:ie}=eg(H,E,F);return Ie&&Ie(ie)===false?H:(a.onTaskCreate?.(ie.parentId,ie.position||0),ht?.(ie),K)});},[a,Ie,ht]),Ka=useCallback((E,F)=>{_(H=>kd(H,E,F)),a.onTaskRename?.(E,F);},[a]),$n=useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let H=ms(be,E);if(H){F(H);return}}_(H=>{let{tasks:K}=Td(H,E);return a.onTaskCreate?.(E,0),K});},[a,be]),Is=useCallback((E,F)=>{let H=Math.max(0,Math.min(100,Math.round(F))),K={progress:H};H===100?K.status="completed":H>0?K.status="in-progress":K.status="todo",ga(E.id,K);},[ga]),Co=useCallback((E,F,H)=>{let K=!E.startDate&&!E.endDate,ie=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=zt=>zt.map(la=>la.id===E.id?{...la,startDate:F,endDate:H,...E.segments&&{segments:E.segments}}:la.subtasks?{...la,subtasks:ge(la.subtasks)}:la),_e=ge(be),Ke=_e;_e=Ee.autoScheduleDependents(_e,E.id,ie),_e=Yr(_e),_(_e);let aa={...E,startDate:F,endDate:H};if(K&&a?.onTaskDateChange?a.onTaskDateChange(E,F,H):Z?.(aa),Pe&&ie!==0){let zt=Ee.flattenTasks(Ke),la=Ee.flattenTasks(_e),gr=[];for(let Hr of la){if(Hr.id===E.id)continue;let Zn=zt.find(Tn=>Tn.id===Hr.id);if(!Zn)continue;let Jo=Hr.startDate?.getTime()!==Zn.startDate?.getTime(),To=Hr.endDate?.getTime()!==Zn.endDate?.getTime();(Jo||To)&&gr.push(Hr);}gr.length>0&&Pe(gr);}},[be,Z,Pe,a]),Cb=useCallback((E,F)=>{Re?.(E,F),De({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Re]),Tb=useCallback((E,F)=>{let H=Ee.splitTask(be,E.id,F);_(H),De({isOpen:false,x:0,y:0,task:null});},[be]),Wu=useCallback(E=>{let F=Ee.findTaskById(be,E.id)||E;oe?.(F),Fe||W(F);},[be,oe,Fe]),zu=useCallback((E,F,H)=>{let K=new Map,ie=zt=>{zt.forEach(la=>{la.dependencies&&K.set(la.id,la.dependencies),la.subtasks&&ie(la.subtasks);});};ie(H);let ge=K.get(F)||[];K.set(F,[...ge,E]);let _e=new Set,Ke=new Set,aa=zt=>{if(!_e.has(zt)){_e.add(zt),Ke.add(zt);let la=K.get(zt)||[];for(let gr of la){if(!_e.has(gr)&&aa(gr))return true;if(Ke.has(gr))return true}}return Ke.delete(zt),false};return aa(F)},[]),Gu=useCallback((E,F)=>{if(zu(E.id,F,Yn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ne[$]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ie,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ht}`,boxShadow:vt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ot,borderBottom:`1px solid ${Te}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:mt,border:`1px solid ${wt}`,color:"#00E5CC"},children:jsx(fg,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:je},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=X,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Ew,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=X,B.currentTarget.style.color=A;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Sw,{})})]})]}),jsx(AnimatePresence,{children:!p&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ke,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:U.slice(0,4).map((B,ee)=>jsx("button",{onClick:()=>ye(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:R,color:we,border:`1px solid ${q}`},onMouseEnter:De=>{De.currentTarget.style.borderColor=Ue,De.currentTarget.style.color="#00E5CC";},onMouseLeave:De=>{De.currentTarget.style.borderColor=q,De.currentTarget.style.color=we;},children:B.length>30?B.slice(0,30)+"...":B},ee))})]}),m.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?me:de,color:B.role==="user"?"#00E5CC":Oe,border:B.role==="user"?`1px solid ${et}`:`1px solid ${ue}`},children:[B.isLoading?jsx(Mw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:J})]}),jsxs("form",{onSubmit:B=>{if(D&&nr.length>0){B.preventDefault();return}j(B);},className:"p-3 relative",style:{borderTop:`1px solid ${lt}`},children:[jsx(AnimatePresence,{children:D&&nr.length>0&&jsx(motion.div,{ref:Le,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ht,border:`1px solid ${_a}`,boxShadow:Bt,backdropFilter:"blur(12px)"},children:nr.map((B,ee)=>jsxs("button",{type:"button",onClick:()=>Ar(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===N?pr:"transparent",color:ga},onMouseEnter:()=>V(ee),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Ye,border:`1px solid ${Ze}`,color:"#00E5CC"},children:B.name.split(" ").map(De=>De[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:br},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${qe}`},children:[jsx("input",{ref:O,type:"text",value:v,onChange:B=>ka(B.target.value),onKeyDown:B=>{se(B);},placeholder:Ne,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:kt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?Yt:"transparent",color:v.trim()?"#00E5CC":ma,border:v.trim()?`1px solid ${za}`:"1px solid transparent"},children:jsx(Dw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Lt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function bg(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(p=>{let d=typeof i=="function"?i(p.present):i;if(n.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function hg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Aw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ee.formatDate(e.startDate)} - ${Ee.formatDate(e.endDate)}`);let a=Ee.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ee.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function yg(e){return {...Aw,...e}}var Ww=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Cg=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:I,onCreateTask:C,taskFilter:D,onTaskFilterChange:P,toolbarRightContent:N,toolbarContainer:V,hideWbsLevel:O,showBaseline:J,viewMode:L,onViewModeChange:Le,projectForecast:G,hideForecastHud:Ne,onThemeChange:$,onTaskClick:ve,onTaskSelectionChange:U,selectedTaskId:ze,onTaskDblClick:oe,onTaskContextMenu:Re,onTaskUpdate:Q,onDependentTasksScheduled:Pe,onProgressChange:We,onTaskEdit:Fe,onTaskAddSubtask:Be,onTaskMarkIncomplete:rt,onTaskSetInProgress:ce,onDependencyCreate:Ve,onDependencyDelete:Qe,onBeforeTaskAdd:Ie,onAfterTaskAdd:ht,onBeforeTaskUpdate:vt,onAfterTaskUpdate:ot,onBeforeTaskDelete:Te,onAfterTaskDelete:mt,permissions:wt,onCopySnapshotLink:je}=a,A=useContext(pl)?.theme,[X,ke]=useState(A||s||"dark"),[R,q]=useState(o),[we,Ue]=useState(l),[me,et]=useState(1),[de,ue]=useState("all"),[Oe,lt]=useState(L||"execution"),st=L??Oe,qe=useCallback(E=>{lt(E),Le?.(E);},[Le]),kt=J??st==="oracle",[Yt,za]=useState(a.showCriticalPath!==false),[ma,Lt]=useState(a.showDependencies!==false),[Ht,_a]=useState(a.highlightWeekends!==false),Bt=useCallback(E=>{za(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),pr=useCallback(E=>{Lt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),ga=useCallback(E=>{_a(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(R);},[R]),useEffect(()=>{a.onZoomChange?.(me);},[me]);let br=useRef(a.onDateRangeChange);br.current=a.onDateRangeChange;let Ye=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ze,Fa]=useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),La=D??Ze,nr=P??Fa,[ka,Ar]=useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Ye();if(E)try{let F={taskFilter:La,hideCompleted:ka};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[La,ka,Ye]);let se=useRef(y);useEffect(()=>{if(se.current!==y&&y!==void 0){Fa("all"),Ar(false);let E=Ye();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}se.current=y;},[y,Ye]);let[fe,ut]=useState(0),[j,ye]=useState(false),[ne,B]=useState(null),[ee,De]=useState({isOpen:false,x:0,y:0,task:null}),[S,W]=useState(null),[pe,Ce]=useState(null);useEffect(()=>{A&&A!==X&&ke(A);},[A]),useEffect(()=>{s&&s!==X&&ke(s);},[s]);let nt=useCallback(E=>{ke(E),$?.(E);},[$]),{state:be,setState:_,undo:gt,redo:bt,canUndo:Ut,canRedo:Vt,clearHistory:or}=bg(t,50),hr=useMemo(()=>{let E=(F,H=0)=>{let K=H;for(let ie of F)ie.subtasks?.length&&(K=Math.max(K,E(ie.subtasks,H+1)));return K};return E(be)+1},[be]),Dr=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ra=useRef(new Map),Zo=useRef(false);if(!Zo.current&&v){Zo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let H=JSON.parse(F);Array.isArray(H)&&(ra.current=new Map(H));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Bn=useCallback(()=>{let E=Dr();if(E)try{let F=Array.from(ra.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[Dr]),_r=useRef(0),Zn=useRef(be);useEffect(()=>{Zn.current=be;},[be]);let eo=useRef(false),Pi=useCallback(E=>{ue(E),_r.current+=1,_(F=>{let H=(ie,ge=0)=>ie.map(_e=>{let Ke=E==="all"||ge<E-1;return _e.subtasks?.length&&ra.current.set(_e.id,Ke),{..._e,isExpanded:Ke,subtasks:_e.subtasks?H(_e.subtasks,ge+1):void 0}}),K=H(F);return Bn(),K});},[_,Bn]);useEffect(()=>{if(_r.current>0){_r.current-=1;return}let E=H=>{let K=new Map;for(let ie of H){let ge=ie.id;K.get(ge)||K.set(ge,ie);}return Array.from(K.values())},F=H=>H.map(K=>{let ie=ra.current.get(K.id),ge=ie!==void 0?{...K,isExpanded:ie}:K;if(ge.subtasks?.length){let _e=E(ge.subtasks);return {...ge,subtasks:F(_e)}}return ge});if(ra.current.size>0)_(Jr(F(t)));else {let H=K=>K.map(ie=>ie.subtasks?.length?{...ie,subtasks:E(H(ie.subtasks))}:ie);_(Jr(H(t)));}},[t,_]);let es=useRef(t),Fi=useRef(true);useEffect(()=>{if(Fi.current){Fi.current=false,es.current=be;return}if(eo.current){eo.current=false,es.current=be;return}if(!r)return;let E=JSON.stringify(es.current),F=JSON.stringify(be);E!==F&&(es.current=be,r(be));},[be,r]);let Ka=useMemo(()=>fd(w,k),[w,k]),Bs=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),to=a.defaultVisibleColumns,$s=useCallback(E=>to?E.map(F=>F.id==="name"?F:{...F,visible:to.includes(F.id)}):E,[to]),yr=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[rn,$n]=useState(()=>{let E=$s(Bs(Ka));if(!b)return E;try{let F=typeof b=="string"?b:"gantt-columns-state",H=localStorage.getItem(F);if(!H)return E;let K=JSON.parse(H),ie=new Map(K.map(ge=>[ge.id,ge]));return E.map(ge=>{let _e=ie.get(ge.id);return _e?{...ge,visible:_e.visible??ge.visible,width:_e.width??ge.width}:ge})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Os=useRef(yr);useEffect(()=>{if(Os.current===yr)return;Os.current=yr;let E=$s(Bs(Ka));if(!yr){$n(E);return}try{let F=localStorage.getItem(yr);if(!F){$n(E);return}let H=JSON.parse(F),K=new Map(H.map(ie=>[ie.id,ie]));$n(E.map(ie=>{let ge=K.get(ie.id);return ge?{...ie,visible:ge.visible??ie.visible,width:ge.width??ie.width}:ie}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),$n(E);}},[yr,Bs,Ka]),useEffect(()=>{if(yr&&Os.current===yr)try{let E=rn.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(yr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[rn,yr]),useEffect(()=>{$n(E=>E.map(F=>({...F,label:Ka.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Ka]);let nn=useMemo(()=>rn.filter(F=>F.visible).reduce((F,H)=>F+H.width,0),[rn]),Hs=useRef(rn.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=rn.filter(K=>K.visible),F=E.map(K=>K.id).join(","),H=Hs.current;if(F!==H){let K=E.some(ge=>ge.id!=="name"),ie=H.includes(",");K?!ie&&K&&B(null):B(null),Hs.current=F;}},[rn]);let Li=60,On=.6,Ai=useMemo(()=>{let F=nn+Li,H=typeof window<"u"?window.innerWidth*On:800,K=Math.max(F,H);return ne!==null?Math.max(200,Math.min(ne,K)):Math.max(200,F)},[ne,nn]),Ir=useRef(null),ts=useRef(null),xr=useRef(null),Do=useRef(null),So=useRef(null),Qt=useMemo(()=>Bm(X),[X]),dc=useMemo(()=>({theme:Qt,themeName:X}),[Qt,X]),Us=useMemo(()=>yg(m),[m]),as=useMemo(()=>{if(!f||!Yt)return be;let E=Ee.calculateCriticalPathFull(be),F=H=>H.map(K=>{let ie=E.get(K.id),ge=K.subtasks?F(K.subtasks):void 0,_e=ge?.some(na=>na.isCriticalPath||na.subtasks&&na.subtasks.some(zt=>zt.isCriticalPath))||false,Ke=ie?ie.isCritical:_e;return {...K,isCriticalPath:Ke,cpmData:ie||void 0,subtasks:ge}});return F(be)},[be,f,Yt]),Ws=useMemo(()=>Ee.flattenTasks(be).some(F=>F.dependencies&&F.dependencies.length>0),[be]),Hn=useMemo(()=>{let E=(F,H="")=>[...F].sort((ie,ge)=>(ie.position??0)-(ge.position??0)).map((ie,ge)=>{let _e=ge+1,Ke=H?`${H}.${_e}`:`${_e}.0`,na=H?`${H}.${_e}`:`${_e}`;return {...ie,wbsCode:Ke,subtasks:ie.subtasks?.length?E(ie.subtasks,na):ie.subtasks}});return E(as)},[as]),T=useMemo(()=>{if(La==="all"&&!ka)return Hn;let E=F=>{let H=[];for(let K of F){let ie=K.subtasks?.length?E(K.subtasks):void 0,ge=false;if(ka)ge=K.progress<100&&K.status!=="completed";else switch(La){case "all":ge=true;break;case "incomplete":ge=K.progress<100;break;case "in_progress":ge=K.progress>0&&K.progress<100;break;case "completed":ge=K.progress===100;break}(ge||ie&&ie.length>0)&&H.push({...K,subtasks:ie});}return H};return E(Hn)},[Hn,La,ka]),Y=Ww(we);hg({undo:gt,redo:bt,canUndo:Ut,canRedo:Vt,enabled:true});let Z=useRef(null),le=(E,F="start")=>{let H=xr.current,K=So.current;if(!H||!K)return;let ie=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),ge=K.timeScale==="day"?60:K.timeScale==="week"?20:8,_e=ie*ge*K.zoom,Ke=F==="center"?_e-H.clientWidth/2:_e-ge*K.zoom*2;H.scrollTo({left:Math.max(0,Ke),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>Ee.findTaskById(be,E),addTask:(E,F)=>{_(H=>{if(!F)return [...H,{...E,level:0}];let K=ie=>ie.map(ge=>ge.id===F?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:F,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(H)});},updateTask:(E,F)=>{_(H=>{let K=ie=>ie.map(ge=>ge.id===E?{...ge,...F}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(H)});},deleteTask:E=>{_(F=>{let H=K=>K.filter(ie=>ie.id===E?false:(ie.subtasks&&(ie.subtasks=H(ie.subtasks)),true));return H(F)});},deleteTasks:E=>{_(F=>Sd(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Ee.findTaskById(be,E);F&&a.onTaskDuplicate(F);}else _(F=>ci(F,[E]).tasks);},splitTask:(E,F,H=3)=>{_(K=>Ee.splitTask(K,E,F,H));},calculateEndDate:Ee.calculateEndDate,calculateDuration:Ee.calculateDuration,validateDependency:(E,F)=>!Ee.validateDependencies(be,E,F),getAllTasks:()=>Ee.flattenTasks(be),getTasksByStatus:E=>Ee.flattenTasks(be).filter(F=>F.status===E),getTasksByParent:E=>E?Ee.findTaskById(be,E)?.subtasks||[]:be.filter(H=>!H.parentId),getCriticalPath:()=>Ee.flattenTasks(be).filter(E=>E.isCriticalPath),indentTask:E=>{_(F=>Jr(Td(F,[E])));},outdentTask:E=>{_(F=>Jr(Nd(F,[E])));},moveTask:(E,F)=>{_(H=>Dd(H,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:H}=Pd(be,E);if(Ie){let K=Ie({...H,parentId:E});if((K instanceof Promise?await K:K)===false)return}_(Jr(F)),ht&&ht({...H,parentId:E});},scrollToTask:E=>{let H=Ee.flattenTasks(be).findIndex(K=>K.id===E);if(H!==-1&&Ir.current){let K=H*Y;Ir.current.scrollTo({top:K,behavior:"smooth"}),xr.current&&xr.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{_(F=>{let H=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie);return H(F)});},collapseTask:E=>{_(F=>{let H=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie);return H(F)});},expandAll:()=>{_(E=>{let F=H=>H.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseAll:()=>{_(E=>{let F=H=>H.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Pi(E);},undo:gt,redo:bt,canUndo:()=>Ut,canRedo:()=>Vt,clearHistory:or,exportToPNG:async()=>{if(!Do.current||!Ir.current||!xr.current)throw new Error("Gantt container not found");let E=Do.current,F=Ir.current,H=ts.current||F.querySelector(".gantt-grid-scroll"),K=xr.current,ie=H?.scrollTop||0,ge=K.scrollTop,_e=E.style.overflow,Ke=E.style.height,na=F.style.overflow;try{let zt=H?.querySelector(".gantt-taskgrid-content"),da=K.querySelector("svg"),mr=zt?.scrollHeight||H?.scrollHeight||600,zr=da?.getBoundingClientRect().height||K.scrollHeight,Eo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(mr,zr)+20;H&&(H.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${Eo}px`,F.style.overflow="visible",await new Promise(os=>setTimeout(os,100));let Nn=await toPng(E,{backgroundColor:Qt.bgPrimary,pixelRatio:2,filter:os=>{if(!(os instanceof Element))return !0;let Ii=window.getComputedStyle(os),Gs=parseInt(Ii.zIndex,10);return (isNaN(Gs)||Gs<50)&&Ii.position!=="fixed"}});return await(await fetch(Nn)).blob()}finally{E.style.overflow=_e,E.style.height=Ke,F.style.overflow=na,H&&(H.scrollTop=ie),K.scrollTop=ge;}},exportToPDF:async E=>{await Ee.exportToPDF(be,E);},exportToExcel:async E=>{await Ee.exportToExcel(be,E,uc.current);},exportToJSON:()=>Ee.exportToJSON(be),exportToCSV:()=>Ee.exportToCSV(be),importFromJSON:E=>{let F=Ee.importFromJSON(E);_(F);},getTasks:()=>be,refresh:()=>{_(E=>[...E]);},clearAll:()=>{_([]);},scrollToDate:(E,F="start")=>le(E,F),fitToDates:(E,F)=>{let H=Math.max(1,(F.getTime()-E.getTime())/864e5),K=H<=21?"day":H<=122?"week":"month";Z.current=E,q(K),K===So.current?.timeScale&&requestAnimationFrame(()=>{let ie=Z.current;Z.current=null,ie&&le(ie);});},scrollToToday:()=>{let E=xr.current,F=So.current;if(!E||!F)return;let K=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),ie=F.timeScale==="day"?60:F.timeScale==="week"?20:8,ge=K*ie*F.zoom,_e=E.clientWidth,Ke=Math.max(0,ge-_e/2);E.scrollTo({left:Ke,behavior:"smooth"});}}),[be,gt,bt,Ut,Vt,or,Qt,Y]);let he=useCallback(E=>{$n(F=>F.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),$e=useCallback((E,F)=>{$n(H=>H.map(K=>{if(K.id!==E)return K;let ie=K.minWidth??100,ge=K.maxWidth??800,_e=Math.max(ie,Math.min(ge,F));return {...K,width:_e}}));},[]),re=useCallback(E=>{_(F=>{let H=Md(F,E),K=ie=>{for(let ge of ie){if(ge.id===E){ra.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&K(ge.subtasks);}};return K(H),Bn(),H}),a.onTaskToggleExpand?.(E);},[a,Bn]),Se=useCallback((E,F)=>{if(vt&&vt(E,F)===false)return;let K=Ee.findTaskById(be,E)?.progress,ie=_e=>_e.map(Ke=>Ke.id===E?{...Ke,...F}:Ke.subtasks?{...Ke,subtasks:ie(Ke.subtasks)}:Ke);_(_e=>ie(_e));let ge=Ee.findTaskById(ie(be),E);ge&&(Q?.(ge),ot?.(ge),F.progress!==void 0&&K!==void 0&&F.progress!==K&&We?.(E,K,F.progress));},[be,Q,vt,ot,We]),He=useCallback((E,F,H)=>{if(E.length===0)return;let K=new Set(E),ie=ge=>ge.map(_e=>{let Ke=K.has(_e.id)?{..._e,[F]:H}:_e;return Ke.subtasks?{...Ke,subtasks:ie(Ke.subtasks)}:Ke});_(ge=>{let _e=ie(ge);return a.onBulkFill?.(E,F,H,_e),_e});},[a]),Xe=useCallback(E=>{E.length!==0&&(_r.current+=1,eo.current=true,_(F=>Jr(Td(F,E))),a.onTaskIndent?.(E[0]));},[a]),Pt=useCallback(E=>{E.length!==0&&(_r.current+=1,eo.current=true,_(F=>Jr(Nd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),pt=useCallback((E,F,H)=>{_r.current+=1,eo.current=true,_(K=>Jr(rg(K,E,F,H))),a.onTaskReparent?.(E,F,H);},[a]),ft=useCallback((E,F)=>{E.length!==0&&(_r.current+=1,eo.current=true,_(H=>Dd(H,E,F)),a.onTaskMove?.(E[0],F));},[a]),Zt=useCallback(async E=>{let F=[];for(let H of E)Te&&await Promise.resolve(Te(H))===false||F.push(H);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(_(H=>Jr(Sd(H,F))),F.forEach(H=>a.onTaskDelete?.(H))),mt&&F.forEach(H=>mt(H)));},[a,Te,mt]),jt=useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let H=Ee.findTaskById(be,F);H&&a.onTaskDuplicate(H);}):_(F=>ci(F,E).tasks);},[a,be]),qa=useCallback((E,F)=>{_(H=>{let{tasks:K,newTask:ie}=ag(H,E,F);return Ie&&Ie(ie)===false?H:(a.onTaskCreate?.(ie.parentId,ie.position||0),ht?.(ie),K)});},[a,Ie,ht]),Wt=useCallback((E,F)=>{_(H=>Ed(H,E,F)),a.onTaskRename?.(E,F);},[a]),Kt=useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let H=vs(be,E);if(H){F(H);return}}_(H=>{let{tasks:K}=Pd(H,E);return a.onTaskCreate?.(E,0),K});},[a,be]),Et=useCallback((E,F)=>{let H=Math.max(0,Math.min(100,Math.round(F))),K={progress:H};H===100?K.status="completed":H>0?K.status="in-progress":K.status="todo",Se(E.id,K);},[Se]),At=useCallback((E,F,H)=>{let K=!E.startDate&&!E.endDate,ie=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=zt=>zt.map(da=>da.id===E.id?{...da,startDate:F,endDate:H,...E.segments&&{segments:E.segments}}:da.subtasks?{...da,subtasks:ge(da.subtasks)}:da),_e=ge(be),Ke=_e;_e=Ee.autoScheduleDependents(_e,E.id,ie),_e=Jr(_e),_(_e);let na={...E,startDate:F,endDate:H};if(K&&a?.onTaskDateChange?a.onTaskDateChange(E,F,H):Q?.(na),Pe&&ie!==0){let zt=Ee.flattenTasks(Ke),da=Ee.flattenTasks(_e),mr=[];for(let zr of da){if(zr.id===E.id)continue;let ro=zt.find(Nn=>Nn.id===zr.id);if(!ro)continue;let ns=zr.startDate?.getTime()!==ro.startDate?.getTime(),Eo=zr.endDate?.getTime()!==ro.endDate?.getTime();(ns||Eo)&&mr.push(zr);}mr.length>0&&Pe(mr);}},[be,Q,Pe,a]),Aa=useCallback((E,F)=>{Re?.(E,F),De({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Re]),vr=useCallback((E,F)=>{let H=Ee.splitTask(be,E.id,F);_(H),De({isOpen:false,x:0,y:0,task:null});},[be]),wr=useCallback(E=>{let F=Ee.findTaskById(be,E.id)||E;oe?.(F),Fe||W(F);},[be,oe,Fe]),sr=useCallback((E,F,H)=>{let K=new Map,ie=zt=>{zt.forEach(da=>{da.dependencies&&K.set(da.id,da.dependencies),da.subtasks&&ie(da.subtasks);});};ie(H);let ge=K.get(F)||[];K.set(F,[...ge,E]);let _e=new Set,Ke=new Set,na=zt=>{if(!_e.has(zt)){_e.add(zt),Ke.add(zt);let da=K.get(zt)||[];for(let mr of da){if(!_e.has(mr)&&na(mr))return true;if(Ke.has(mr))return true}}return Ke.delete(zt),false};return na(F)},[]),Ga=useCallback((E,F)=>{if(sr(E.id,F,Zn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let H=K=>K.map(ie=>{if(ie.id===F){let ge=ie.dependencies||[];if(!ge.includes(E.id))return {...ie,dependencies:[...ge,E.id]}}return ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie});Gr.current+=1,_(K=>H(K)),Ve?.(E.id,F);},[Ve,zu]),Vu=useCallback((E,F)=>{let H=K=>K.map(ie=>{if(ie.id===E&&ie.dependencies){let ge=ie.dependencies.filter(_e=>_e!==F);return {...ie,dependencies:ge}}return ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie});Gr.current+=1,_(K=>H(K)),Qe?.(E,F);},[Qe]),{startDate:Cn,endDate:nc}=useMemo(()=>{let E=be.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,_e=new Date(ge);_e.setDate(_e.getDate()-30);let Ke=new Date(ge);return Ke.setDate(Ke.getDate()+60),{startDate:_e,endDate:Ke}}let F=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),H=new Date(Math.min(...F.map(ge=>ge.getTime()))),K=new Date(Math.max(...F.map(ge=>ge.getTime()))),ie=R==="day"?7:R==="week"?14:30;return H.setDate(H.getDate()-ie),K.setDate(K.getDate()+ie),{startDate:H,endDate:K}},[be,R]);useEffect(()=>{hr.current?.(Cn,nc);},[Cn,nc]);let Nb=useCallback(async()=>{if(!D.current||!Vr.current||!or.current)return;await new Promise(To=>setTimeout(To,200));let E=D.current,F=Vr.current,H=Qn.current||F.querySelector(".gantt-grid-scroll"),K=or.current,ie=H?.scrollTop||0,ge=H?.scrollLeft||0,_e=K.scrollTop,Ke=K.scrollLeft,aa=E.style.overflow,zt=E.style.height,la=H?.style.overflow||"",gr=K.style.overflow,Hr=F.style.overflow,Zn=E.style.width,Jo=K.style.width;try{let To=H?.querySelector(".gantt-taskgrid-content"),Tn=K.querySelector("svg"),lc=Tn?.getAttribute("height")?parseInt(Tn.getAttribute("height"),10):Tn?.getBoundingClientRect().height||0,Qo=To?.scrollHeight||H?.scrollHeight||600,Ei=Math.max(lc,K.scrollHeight),Bs=Tn?.getAttribute("width")?parseInt(Tn.getAttribute("width"),10):Tn?.getBoundingClientRect().width||K.scrollWidth,Ab=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,cc=Math.max(Qo,Ei,lc),qu=Ab+cc+50,Yu=(H?.offsetWidth||F.offsetWidth||300)+Bs+10;H&&(H.scrollTop=0,H.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${qu}px`,E.style.width=`${Yu}px`,F.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${cc+50}px`),K.style.overflow="visible",K.style.height=`${cc+50}px`,K.style.width=`${Bs+10}px`,await new Promise(Mi=>setTimeout(Mi,150));let Ib=await toPng(E,{backgroundColor:Y.bgPrimary,pixelRatio:2,width:Yu,height:qu,skipFonts:!1,filter:Mi=>{if(!(Mi instanceof Element))return !0;let Xu=window.getComputedStyle(Mi),Ju=parseInt(Xu.zIndex,10);return !(!isNaN(Ju)&&Ju>=50||Xu.position==="fixed")}}),dc=document.createElement("a");dc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,dc.href=Ib,dc.click();}finally{E.style.overflow=aa,E.style.height=zt,E.style.width=Zn,F.style.overflow=Hr,H&&(H.style.overflow=la,H.style.height="",H.scrollTop=ie,H.scrollLeft=ge),K.style.overflow=gr,K.style.height="",K.style.width=Jo,K.scrollTop=_e,K.scrollLeft=Ke;}u?.("png");},[Y,u]),Db=useCallback(async()=>{await Ee.exportToPDF(be),u?.("pdf");},[be,u]),oc=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});oc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Sb=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let E=new Date,F=ie=>String(ie).padStart(2,"0"),H=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,K=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ee.exportToExcel(be,`${K}_${H}.xlsx`,oc.current),u?.("excel");},[be,p,u,a.onExportExcel]),Eb=useCallback(()=>{let E=Ee.exportToCSV(be),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[be,u]),Mb=useCallback(()=>{let E=Ee.exportToJSON(be),F=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[be,u]),Pb=useCallback(()=>{Ee.exportToMSProject(be,"Gantt Project","project.xml"),u?.("msproject");},[be,u]),Fb=E=>{E.preventDefault(),he(true);},Xo=useRef(false),[sc,ju]=useState(false),Rs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=or.current,F=Vr.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let H=()=>{if(Xo.current)return;Xo.current=true;let Ke=E.scrollTop;pt(Ke),F.scrollTop=Ke,requestAnimationFrame(()=>{Xo.current=false;});},K=()=>{if(Xo.current)return;Xo.current=true;let Ke=F.scrollTop;pt(Ke),E.scrollTop=Ke,requestAnimationFrame(()=>{Xo.current=false;});},ie=Ke=>{if(j&&F){let zt=F.parentElement?.getBoundingClientRect()?.left||0,la=Ke.clientX-zt,gr=200,Hr=kn+As,Zn=window.innerWidth*Di,Jo=Math.max(Hr,Zn);la>=gr&&la<=Jo&&B(la);}if(sc&&E){let aa=Ke.clientX-Rs.current.x,zt=Ke.clientY-Rs.current.y;E.scrollLeft=Rs.current.scrollLeft-aa,E.scrollTop=Rs.current.scrollTop-zt;}},ge=()=>{he(false),ju(false);},_e=Ke=>{if(Ke.button!==0)return;let aa=Ke.target;aa.closest("[data-task-bar]")||aa.closest("[data-dependency-line]")||aa.closest("button")||aa.closest('[role="button"]')||aa.tagName==="rect"&&aa.getAttribute("data-clickable")==="true"||(ju(true),Rs.current={x:Ke.clientX,y:Ke.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},Ke.preventDefault());};return E.addEventListener("scroll",H),F.addEventListener("scroll",K),E.addEventListener("mousedown",_e),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",H),F.removeEventListener("scroll",K),E.removeEventListener("mousedown",_e),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge);}},[j,sc,kn]),X.current={startDate:Cn,timeScale:R,zoom:me};let ic=a.onTodayVisibilityChange,_u=useRef(null);useEffect(()=>{if(!ic)return;let E=or.current;if(!E)return;let F=R==="day"?60:R==="week"?20:8,H=()=>{let ge=(new Date().getTime()-Cn.getTime())/(1e3*60*60*24)*F*me,_e=E.scrollLeft,Ke=_e+E.clientWidth,aa=ge>=_e&&ge<=Ke;_u.current!==aa&&(_u.current=aa,ic(aa));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[ic,Cn,R,me]);let Ku=useRef(false),Lb=useRef(null);return useLayoutEffect(()=>{if(Ku.current||be.length===0||!or.current)return;Ku.current=true,Lb.current=Cn;let E=or.current,F=new Date,H=R==="day"?60:R==="week"?20:8,K=(F.getTime()-Cn.getTime())/(1e3*60*60*24),ie=E.clientWidth,_e=K*H*me-ie/2;K>=0&&ie>0&&(E.scrollLeft=Math.max(0,_e));},[be.length,Cn,R,me]),useLayoutEffect(()=>{let E=Pt.current;!E||X.current?.timeScale!==R||(Pt.current=null,it(E));},[R,Cn,me]),jsx(us.Provider,{value:_a,children:jsx(fc.Provider,{value:de,children:jsxs("div",{ref:D,className:"flex flex-col h-full w-full",style:{backgroundColor:Y.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Y.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Y.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(ll,{enCabecera:!!V,theme:Y,timeScale:R,onTimeScaleChange:q,zoom:me,onZoomChange:et,currentTheme:J,onThemeChange:nt,rowDensity:we,onRowDensityChange:Oe,showThemeSelector:c,showCreateTaskButton:M&&wt?.canCreateTask!==false&&!wt?.canCreateSubtaskOnly,createTaskLabel:I,onCreateTask:C,taskFilter:La,onTaskFilterChange:rr,hideCompleted:ka,onHideCompletedChange:Lr,toolbarRightContent:T,wbsLevel:ce,onWbsLevelChange:O?void 0:Ci,maxWbsDepth:yr,viewMode:st,onViewModeChange:Le?Ye:void 0,projectForecast:G,hideForecastHud:Ne,onExportPNG:i?Nb:void 0,onExportPDF:i?Db:void 0,onExportExcel:i?Sb:void 0,onExportCSV:i?Eb:void 0,onExportJSON:i?Mb:void 0,onExportMSProject:i?Pb:void 0,showCriticalPath:qt,onShowCriticalPathChange:Bt,showDependencies:pa,onShowDependenciesChange:pr,highlightWeekends:Ht,onHighlightWeekendsChange:ma,showBaseline:kt,onShowBaselineChange:F=>{F&&st!=="oracle"&&Ye("oracle"),!F&&st==="oracle"&&Ye("execution");},onCopySnapshotLink:je,hasDependencies:re});return V?createPortal(E,V):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:Vr,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Qn,className:"gantt-grid-scroll flex-shrink-0",style:{width:Si,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ul,{tasks:He,allTasks:Se,theme:Y,rowHeight:qe,availableUsers:d,templates:ye,showCriticalPath:qt,onTaskClick:ve,onTaskSelectionChange:U,selectedTaskId:We,onTaskDblClick:Wu,onTaskContextMenu:Re,onTaskToggle:jt,scrollTop:fe,columns:tn,onToggleColumn:ft,onColumnResize:ia,onTaskUpdate:ga,onBulkFill:Wt,onTaskIndent:Jt,onTaskOutdent:Et,onTaskMove:Aa,onMultiTaskDelete:sr,onTaskDuplicate:Nr,onTaskCreate:mr,onTaskRename:Ka,onCreateSubtask:$n,onOpenTaskModal:ve?E=>ve(E):void 0,onDeleteRequest:(E,F)=>Ce({taskIds:E,taskName:F}),onTaskReparent:At,scrollContainerRef:Qn})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Y.border,zIndex:15},onMouseDown:Fb}),jsx("div",{ref:or,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:sc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(yl,{tasks:He,theme:Y,rowHeight:qe,timeScale:R,startDate:Cn,endDate:nc,zoom:me,locale:w,templates:ye,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:ve,onTaskDblClick:Wu,onTaskContextMenu:Cb,onTaskDateChange:Co,onTaskProgressDrag:Is,onDependencyCreate:Gu,onDependencyDelete:Vu,showBaseline:kt,showCriticalPath:qt,showDependencies:pa,highlightWeekends:Ht,weekHeaderFormat:a.weekHeaderFormat,canEditTask:wt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),ee.task&&jsx(ps,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:Y,onClose:()=>De({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let F=Ee.findTaskById(be,E.id)||E,H=F.subtasks&&F.subtasks.length>0,K=wt?.canCreateTask!==false,ie=wt?.canDeleteTask!==false;if(H){let zt=[],la=wt?.canDuplicateTask!==false;return K&&zt.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:na.Add,onClick:()=>{Be?Be(F):$n(F.id);}}),la&&zt.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:na.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_(gr=>ai(gr,[F.id]).tasks),De({isOpen:false,x:0,y:0,task:null});}}),ie&&(zt.length>0&&zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),zt.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:na.Delete,onClick:()=>{Ce({taskIds:[F.id],taskName:F.name});}})),zt}let ge=wt?.canUpdateTask!==false,_e=wt?.canDuplicateTask!==false,Ke=[];return ge&&Ke.push({id:"edit",label:_a.contextMenu?.editTask||"Edit Task",icon:na.Pencil,onClick:()=>{Fe?Fe(F):W(F);}}),K&&Ke.push({id:"addSubtask",label:_a.contextMenu?.addSubtask||"Add Subtask",icon:na.Add,onClick:()=>{Be?Be(F):$n(F.id);}}),Ke.length>0&&ge&&Ke.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(Ke.push({id:"markIncomplete",label:_a.contextMenu?.markIncomplete||"Mark Incomplete",icon:na.MarkIncomplete,onClick:()=>{rt?rt(F):ga(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),Ke.push({id:"setInProgress",label:_a.contextMenu?.setInProgress||"Set In Progress",icon:na.SetInProgress,onClick:()=>{le?le(F):ga(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),Ke.push({id:"markComplete",label:_a.contextMenu?.markComplete||"Mark Complete",icon:na.MarkComplete,onClick:()=>{ga(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(_e||ge&&F.startDate&&F.endDate)&&Ke.length>0&&Ke.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),_e&&Ke.push({id:"duplicate",label:_a.contextMenu?.duplicateTask||"Duplicate Task",icon:na.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_(zt=>ai(zt,[F.id]).tasks),De({isOpen:false,x:0,y:0,task:null});}}),ge&&F.startDate&&F.endDate&&Ke.push({id:"split",label:_a.contextMenu?.splitTask||"Split Task",icon:na.Split,onClick:()=>{let zt=F.startDate.getTime(),la=F.endDate.getTime(),gr=zt+(la-zt)/2,Hr=new Date(gr);Tb(F,Hr);}}),ie&&(Ke.length>0&&Ke.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ke.push({id:"delete",label:_a.contextMenu?.deleteTask||"Delete Task",icon:na.Delete,onClick:()=>{Ce({taskIds:[F.id],taskName:F.name});}})),Ke})()}),jsx(Fo,{task:S,isOpen:!!S,onClose:()=>W(null),onTaskUpdate:E=>{S&&(ga(S.id,E),W(null));},theme:J==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:pe&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Ce(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Y.bgSecondary,border:`1px solid ${Y.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Y.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:Y.textPrimary,fontFamily:"Inter, sans-serif"},children:[_a.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Y.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Y.textSecondary,fontFamily:"Inter, sans-serif"},children:pe.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Y.textPrimary},children:[pe.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Y.textPrimary},children:['"',pe.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Y.bgPrimary,borderTop:`1px solid ${Y.border}`},children:[jsx("button",{onClick:()=>Ce(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Y.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Y.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{sr(pe.taskIds),Ce(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(wl,{tasks:be,theme:Y,config:x,onTasksUpdate:_,onTaskUpdate:ga,onTaskCreate:E=>{_(F=>[...F,E]);},onTaskDelete:E=>{sr([E]);},onDependencyCreate:(E,F)=>{let H=Ee.findTaskById(be,E);H&&Gu(H,F);},onDependencyDelete:Vu})]})})})});function Qw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Sd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ed=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Tg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...Sd,...i.filter(A=>!Sd.some(J=>J.id===A.id))],b=dt[c]||dt.dark,[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(false),[C,N]=useState(false),[P,T]=useState({top:0,left:0}),[V,O]=useState(null),[Q,L]=useState(new Date),[Le,G]=useState({top:0,left:0}),[Ne,$]=useState(false),[ve,U]=useState([]),[We,oe]=useState(false),[Re,Z]=useState(""),Pe=useRef(null),Ue=useRef(null),Fe=useRef(null),Be=useRef(null),rt=useRef(null),[le,Ve]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Qe,Ie]=useState({});useEffect(()=>{a?(Ve({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&$(true)):(Ve({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),$(false),U([]));},[a,e,v]),useEffect(()=>{let A=J=>{Pe.current&&!Pe.current.contains(J.target)&&x(false),Ue.current&&!Ue.current.contains(J.target)&&k(false),Fe.current&&!Fe.current.contains(J.target)&&I(false),Be.current&&!Be.current.contains(J.target)&&N(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let ht=()=>{let A={};return le.name.trim()||(A.name="El nombre es requerido"),le.startDate&&le.endDate&&le.startDate>le.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie(A),Object.keys(A).length===0},vt=async A=>{if(A.preventDefault(),!!ht())try{let J=l==="create"&&ve.length>0?{...le,pendingFiles:ve}:le;await s(J),U([]),t();}catch(J){console.error("Error submitting task:",J);}},ot=(A,J)=>{Ve(ke=>{let R={...ke,[A]:J};if(A==="status"){let q=J;q==="todo"?R.progress=0:q==="in-progress"?(ke.progress===0||ke.progress===100)&&(R.progress=50):q==="completed"||q==="closed"?R.progress=100:(q==="in-review"||q==="review")&&(R.progress=75);}if(A==="progress"){let q=typeof J=="number"?J:parseInt(J,10);q===100&&ke.status!=="completed"?R.status="completed":q>0&&q<100&&ke.status==="todo"?R.status="in-progress":q===0&&ke.status!=="todo"&&(R.status="todo");}return R}),Qe[A]&&Ie(ke=>{let R={...ke};return delete R[A],R});},Te=h.find(A=>A.id===le.status)??Sd[0],mt=Ed.find(A=>A.id===le.priority)??Ed[1],wt=Po.find(A=>A.value===le.color)??Po[0],je=c==="dark",ut={backgroundColor:je?"#1d1f27":b.bgSecondary,border:`1px solid ${je?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:je?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,border:`1px solid ${je?"rgba(65,71,84,0.1)":b.border}`,boxShadow:je?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxs("form",{onSubmit:vt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:le.name,onChange:A=>ot("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Qe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Qe.name]}),jsx("textarea",{value:le.description||"",onChange:A=>ot("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ut,borderColor:Te.color,backgroundColor:`${Te.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Te.color}}),jsx("span",{style:{color:Te.color},children:Te.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Te.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("status",A.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,le.status===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxs("div",{ref:Ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsx("span",{children:mt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Ed.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("priority",A.id),k(false);},children:[jsx("span",{children:A.icon}),A.label,le.priority===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&I(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[le.assignees&&le.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:le.assignees.slice(0,3).map((A,J)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},J))}),le.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",le.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:M&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let J=le.assignees?.some(ke=>ke.name===A.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ke=J?(le.assignees||[]).filter(R=>R.name!==A.name):[...le.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(R=>R[0]).join("").toUpperCase().slice(0,2),color:b.accent}];ot("assignees",ke);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:A.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:J&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)N(false);else {if(Be.current){let A=Be.current.getBoundingClientRect(),J=window.innerHeight,ke=120,q=J-A.bottom<ke?A.top-ke-8:A.bottom+8;T({top:q,left:A.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:le.color}}),jsx("span",{children:wt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(ca,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Po.slice(0,18).map(A=>{let J=le.color===A.value;return jsx("button",{type:"button",onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),ot("color",A.value),N(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:J?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),u.length>0||p?jsx(as,{selectedTags:le.tags||[],availableTags:u,onChange:A=>ot("tags",A),onCreateTag:p,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:je?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${je?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:rt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(V==="start")O(null);else {if(rt.current){let A=rt.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("start"),L(le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.startDate?le.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!le.isMilestone)if(V==="end")O(null);else {if(rt.current){let A=rt.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("end"),L(le.endDate||le.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:le.isMilestone?.5:1,cursor:le.isMilestone?"not-allowed":"pointer"},disabled:o||le.isMilestone,children:le.endDate?le.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:V&&jsxs(ca,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Le.top}px`,left:`${Le.left}px`,zIndex:99999,backgroundColor:je?"#0a0a0a":b.bgPrimary,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${je?"#262626":b.border}`},children:[(()=>{let A=new Date,J=new Date(A);J.setDate(A.getDate()+1);let ke=new Date(A);ke.setDate(A.getDate()+7);let R=new Date(A);return R.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:R}].map((we,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:me=>me.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(ot("startDate",we.date),(!le.endDate||we.date>le.endDate)&&ot("endDate",we.date),O("end")):(ot("endDate",we.date),(!le.startDate||we.date<le.startDate)&&ot("startDate",we.date),O(null));},children:we.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("startDate",void 0),ot("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>L(new Date(Q.getFullYear(),Q.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Q.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(Q.getFullYear(),Q.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,J)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},J))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=Q.getFullYear(),J=Q.getMonth(),ke=new Date(A,J,1).getDay(),R=new Date(A,J+1,0).getDate(),q=new Date,we=[];for(let me=ke-1;me>=0;me--)we.push({day:new Date(A,J,-me).getDate(),date:new Date(A,J-1,new Date(A,J,-me).getDate()),isCurrentMonth:false});for(let me=1;me<=R;me++)we.push({day:me,date:new Date(A,J,me),isCurrentMonth:true});let Oe=42-we.length;for(let me=1;me<=Oe;me++)we.push({day:me,date:new Date(A,J+1,me),isCurrentMonth:false});return we.map((me,et)=>{let ce=me.date.toDateString()===q.toDateString(),ue=le.startDate?.toDateString()===me.date.toDateString(),$e=le.endDate?.toDateString()===me.date.toDateString(),ct=le.startDate&&le.endDate&&me.date>=le.startDate&&me.date<=le.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:me.isCurrentMonth?ue||$e?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:ue?b.accent:$e?"#7C3AED":ct?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ce&&!ue&&!$e?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(ot("startDate",me.date),le.endDate&&me.date>le.endDate&&ot("endDate",me.date),O("end")):(ot("endDate",me.date),le.startDate&&me.date<le.startDate&&ot("startDate",me.date),O(null));},children:me.day},et)})})()})]})]})]})})]}),Qe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Qe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[le.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:je?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let J=A.currentTarget.getBoundingClientRect(),ke=Math.round((A.clientX-J.left)/J.width*100/5)*5;ot("progress",Math.max(0,Math.min(100,ke)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${le.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${je?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>$(!Ne),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ne?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ne&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:le.effortMinutes?Qw(le.effortMinutes):"",onChange:A=>{let J=Zw(A.target.value);ot("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:le.parentId||"",onChange:A=>ot("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:le.location||"",onChange:A=>ot("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:le.equipment||"",onChange:A=>ot("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||d.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?ve.length>0&&`(${ve.length})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsx(ss,{cardId:"pending",attachments:ve.map((A,J)=>({id:`pending-${J}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>U(J=>[...J,...A]),onDelete:A=>{let J=parseInt(A.replace("pending-",""),10);U(ke=>ke.filter((R,q)=>q!==J));},maxSizeMB:10,maxFiles:20}):jsx(ss,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?A=>m(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&ve.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[ve.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:le.isMilestone,onChange:A=>ot("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),le.dependencies&&le.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:le.dependencies.map(A=>{let J=r.find(ke=>ke.id===A);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[J?.name||A.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ke=(le.dependencies||[]).filter(R=>R!==A);ot("dependencies",ke);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{type:"button",onClick:()=>{oe(!We),Z("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:We&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{oe(false),Z("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:Re,onChange:A=>Z(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>Re===""||A.name.toLowerCase().includes(Re.toLowerCase())).map(A=>{let J=le.dependencies?.includes(A.id);return jsxs("button",{type:"button",onClick:()=>{let ke=le.dependencies||[],R;J?R=ke.filter(q=>q!==A.id):R=[...ke,A.id],ot("dependencies",R);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${b.accent}10`:"transparent"},onMouseEnter:ke=>{J||(ke.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:ke=>{ke.currentTarget.style.backgroundColor=J?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?b.accent:"transparent",borderColor:J?b.accent:b.borderLight},children:J&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:A.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${je?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:je?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Ng=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let H=K=>K.map(ie=>{if(ie.id===F){let ge=ie.dependencies||[];if(!ge.includes(E.id))return {...ie,dependencies:[...ge,E.id]}}return ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie});_r.current+=1,_(K=>H(K)),Ve?.(E.id,F);},[Ve,sr]),ao=useCallback((E,F)=>{let H=K=>K.map(ie=>{if(ie.id===E&&ie.dependencies){let ge=ie.dependencies.filter(_e=>_e!==F);return {...ie,dependencies:ge}}return ie.subtasks?{...ie,subtasks:H(ie.subtasks)}:ie});_r.current+=1,_(K=>H(K)),Qe?.(E,F);},[Qe]),{startDate:Rr,endDate:Un}=useMemo(()=>{let E=be.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,_e=new Date(ge);_e.setDate(_e.getDate()-30);let Ke=new Date(ge);return Ke.setDate(Ke.getDate()+60),{startDate:_e,endDate:Ke}}let F=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),H=new Date(Math.min(...F.map(ge=>ge.getTime()))),K=new Date(Math.max(...F.map(ge=>ge.getTime()))),ie=R==="day"?7:R==="week"?14:30;return H.setDate(H.getDate()-ie),K.setDate(K.getDate()+ie),{startDate:H,endDate:K}},[be,R]);useEffect(()=>{br.current?.(Rr,Un);},[Rr,Un]);let Nb=useCallback(async()=>{if(!Do.current||!Ir.current||!xr.current)return;await new Promise(Eo=>setTimeout(Eo,200));let E=Do.current,F=Ir.current,H=ts.current||F.querySelector(".gantt-grid-scroll"),K=xr.current,ie=H?.scrollTop||0,ge=H?.scrollLeft||0,_e=K.scrollTop,Ke=K.scrollLeft,na=E.style.overflow,zt=E.style.height,da=H?.style.overflow||"",mr=K.style.overflow,zr=F.style.overflow,ro=E.style.width,ns=K.style.width;try{let Eo=H?.querySelector(".gantt-taskgrid-content"),Nn=K.querySelector("svg"),gc=Nn?.getAttribute("height")?parseInt(Nn.getAttribute("height"),10):Nn?.getBoundingClientRect().height||0,os=Eo?.scrollHeight||H?.scrollHeight||600,Ii=Math.max(gc,K.scrollHeight),Gs=Nn?.getAttribute("width")?parseInt(Nn.getAttribute("width"),10):Nn?.getBoundingClientRect().width||K.scrollWidth,Ab=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,fc=Math.max(os,Ii,gc),Xu=Ab+fc+50,Ju=(H?.offsetWidth||F.offsetWidth||300)+Gs+10;H&&(H.scrollTop=0,H.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Xu}px`,E.style.width=`${Ju}px`,F.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${fc+50}px`),K.style.overflow="visible",K.style.height=`${fc+50}px`,K.style.width=`${Gs+10}px`,await new Promise(Ri=>setTimeout(Ri,150));let Ib=await toPng(E,{backgroundColor:Qt.bgPrimary,pixelRatio:2,width:Ju,height:Xu,skipFonts:!1,filter:Ri=>{if(!(Ri instanceof Element))return !0;let Qu=window.getComputedStyle(Ri),Zu=parseInt(Qu.zIndex,10);return !(!isNaN(Zu)&&Zu>=50||Qu.position==="fixed")}}),bc=document.createElement("a");bc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,bc.href=Ib,bc.click();}finally{E.style.overflow=na,E.style.height=zt,E.style.width=ro,F.style.overflow=zr,H&&(H.style.overflow=da,H.style.height="",H.scrollTop=ie,H.scrollLeft=ge),K.style.overflow=mr,K.style.height="",K.style.width=ns,K.scrollTop=_e,K.scrollLeft=Ke;}u?.("png");},[Qt,u]),Db=useCallback(async()=>{await Ee.exportToPDF(be),u?.("pdf");},[be,u]),uc=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});uc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Sb=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let E=new Date,F=ie=>String(ie).padStart(2,"0"),H=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,K=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ee.exportToExcel(be,`${K}_${H}.xlsx`,uc.current),u?.("excel");},[be,p,u,a.onExportExcel]),Eb=useCallback(()=>{let E=Ee.exportToCSV(be),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[be,u]),Mb=useCallback(()=>{let E=Ee.exportToJSON(be),F=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[be,u]),Pb=useCallback(()=>{Ee.exportToMSProject(be,"Gantt Project","project.xml"),u?.("msproject");},[be,u]),Fb=E=>{E.preventDefault(),ye(true);},rs=useRef(false),[pc,Ku]=useState(false),zs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=xr.current,F=Ir.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let H=()=>{if(rs.current)return;rs.current=true;let Ke=E.scrollTop;ut(Ke),F.scrollTop=Ke,requestAnimationFrame(()=>{rs.current=false;});},K=()=>{if(rs.current)return;rs.current=true;let Ke=F.scrollTop;ut(Ke),E.scrollTop=Ke,requestAnimationFrame(()=>{rs.current=false;});},ie=Ke=>{if(j&&F){let zt=F.parentElement?.getBoundingClientRect()?.left||0,da=Ke.clientX-zt,mr=200,zr=nn+Li,ro=window.innerWidth*On,ns=Math.max(zr,ro);da>=mr&&da<=ns&&B(da);}if(pc&&E){let na=Ke.clientX-zs.current.x,zt=Ke.clientY-zs.current.y;E.scrollLeft=zs.current.scrollLeft-na,E.scrollTop=zs.current.scrollTop-zt;}},ge=()=>{ye(false),Ku(false);},_e=Ke=>{if(Ke.button!==0)return;let na=Ke.target;na.closest("[data-task-bar]")||na.closest("[data-dependency-line]")||na.closest("button")||na.closest('[role="button"]')||na.tagName==="rect"&&na.getAttribute("data-clickable")==="true"||(Ku(true),zs.current={x:Ke.clientX,y:Ke.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},Ke.preventDefault());};return E.addEventListener("scroll",H),F.addEventListener("scroll",K),E.addEventListener("mousedown",_e),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",H),F.removeEventListener("scroll",K),E.removeEventListener("mousedown",_e),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge);}},[j,pc,nn]),So.current={startDate:Rr,timeScale:R,zoom:me};let mc=a.onTodayVisibilityChange,qu=useRef(null);useEffect(()=>{if(!mc)return;let E=xr.current;if(!E)return;let F=R==="day"?60:R==="week"?20:8,H=()=>{let ge=(new Date().getTime()-Rr.getTime())/(1e3*60*60*24)*F*me,_e=E.scrollLeft,Ke=_e+E.clientWidth,na=ge>=_e&&ge<=Ke;qu.current!==na&&(qu.current=na,mc(na));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[mc,Rr,R,me]);let Yu=useRef(false),Lb=useRef(null);return useLayoutEffect(()=>{if(Yu.current||be.length===0||!xr.current)return;Yu.current=true,Lb.current=Rr;let E=xr.current,F=new Date,H=R==="day"?60:R==="week"?20:8,K=(F.getTime()-Rr.getTime())/(1e3*60*60*24),ie=E.clientWidth,_e=K*H*me-ie/2;K>=0&&ie>0&&(E.scrollLeft=Math.max(0,_e));},[be.length,Rr,R,me]),useLayoutEffect(()=>{let E=Z.current;!E||So.current?.timeScale!==R||(Z.current=null,le(E));},[R,Rr,me]),jsx(ys.Provider,{value:Ka,children:jsx(wc.Provider,{value:dc,children:jsxs("div",{ref:Do,className:"flex flex-col h-full w-full",style:{backgroundColor:Qt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Qt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Qt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(gl,{enCabecera:!!V,theme:Qt,timeScale:R,onTimeScaleChange:q,zoom:me,onZoomChange:et,currentTheme:X,onThemeChange:nt,rowDensity:we,onRowDensityChange:Ue,showThemeSelector:c,showCreateTaskButton:M&&wt?.canCreateTask!==false&&!wt?.canCreateSubtaskOnly,createTaskLabel:I,onCreateTask:C,taskFilter:La,onTaskFilterChange:nr,hideCompleted:ka,onHideCompletedChange:Ar,toolbarRightContent:N,wbsLevel:de,onWbsLevelChange:O?void 0:Pi,maxWbsDepth:hr,viewMode:st,onViewModeChange:Le?qe:void 0,projectForecast:G,hideForecastHud:Ne,onExportPNG:i?Nb:void 0,onExportPDF:i?Db:void 0,onExportExcel:i?Sb:void 0,onExportCSV:i?Eb:void 0,onExportJSON:i?Mb:void 0,onExportMSProject:i?Pb:void 0,showCriticalPath:Yt,onShowCriticalPathChange:Bt,showDependencies:ma,onShowDependenciesChange:pr,highlightWeekends:Ht,onHighlightWeekendsChange:ga,showBaseline:kt,onShowBaselineChange:F=>{F&&st!=="oracle"&&qe("oracle"),!F&&st==="oracle"&&qe("execution");},onCopySnapshotLink:je,hasDependencies:Ws});return V?createPortal(E,V):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:Ir,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:ts,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ai,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(hl,{tasks:T,allTasks:Hn,theme:Qt,rowHeight:Y,availableUsers:d,templates:Us,showCriticalPath:Yt,onTaskClick:ve,onTaskSelectionChange:U,selectedTaskId:ze,onTaskDblClick:wr,onTaskContextMenu:Re,onTaskToggle:re,scrollTop:fe,columns:rn,onToggleColumn:he,onColumnResize:$e,onTaskUpdate:Se,onBulkFill:He,onTaskIndent:Xe,onTaskOutdent:Pt,onTaskMove:ft,onMultiTaskDelete:Zt,onTaskDuplicate:jt,onTaskCreate:qa,onTaskRename:Wt,onCreateSubtask:Kt,onOpenTaskModal:ve?E=>ve(E):void 0,onDeleteRequest:(E,F)=>Ce({taskIds:E,taskName:F}),onTaskReparent:pt,scrollContainerRef:ts})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Qt.border,zIndex:15},onMouseDown:Fb}),jsx("div",{ref:xr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:pc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Tl,{tasks:T,theme:Qt,rowHeight:Y,timeScale:R,startDate:Rr,endDate:Un,zoom:me,locale:w,templates:Us,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:ve,onTaskDblClick:wr,onTaskContextMenu:Aa,onTaskDateChange:At,onTaskProgressDrag:Et,onDependencyCreate:Ga,onDependencyDelete:ao,showBaseline:kt,showCriticalPath:Yt,showDependencies:ma,highlightWeekends:Ht,weekHeaderFormat:a.weekHeaderFormat,canEditTask:wt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),ee.task&&jsx(xs,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:Qt,onClose:()=>De({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let F=Ee.findTaskById(be,E.id)||E,H=F.subtasks&&F.subtasks.length>0,K=wt?.canCreateTask!==false,ie=wt?.canDeleteTask!==false;if(H){let zt=[],da=wt?.canDuplicateTask!==false;return K&&zt.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:sa.Add,onClick:()=>{Be?Be(F):Kt(F.id);}}),da&&zt.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:sa.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_(mr=>ci(mr,[F.id]).tasks),De({isOpen:false,x:0,y:0,task:null});}}),ie&&(zt.length>0&&zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),zt.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:sa.Delete,onClick:()=>{Ce({taskIds:[F.id],taskName:F.name});}})),zt}let ge=wt?.canUpdateTask!==false,_e=wt?.canDuplicateTask!==false,Ke=[];return ge&&Ke.push({id:"edit",label:Ka.contextMenu?.editTask||"Edit Task",icon:sa.Pencil,onClick:()=>{Fe?Fe(F):W(F);}}),K&&Ke.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:sa.Add,onClick:()=>{Be?Be(F):Kt(F.id);}}),Ke.length>0&&ge&&Ke.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(Ke.push({id:"markIncomplete",label:Ka.contextMenu?.markIncomplete||"Mark Incomplete",icon:sa.MarkIncomplete,onClick:()=>{rt?rt(F):Se(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),Ke.push({id:"setInProgress",label:Ka.contextMenu?.setInProgress||"Set In Progress",icon:sa.SetInProgress,onClick:()=>{ce?ce(F):Se(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),Ke.push({id:"markComplete",label:Ka.contextMenu?.markComplete||"Mark Complete",icon:sa.MarkComplete,onClick:()=>{Se(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(_e||ge&&F.startDate&&F.endDate)&&Ke.length>0&&Ke.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),_e&&Ke.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:sa.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):_(zt=>ci(zt,[F.id]).tasks),De({isOpen:false,x:0,y:0,task:null});}}),ge&&F.startDate&&F.endDate&&Ke.push({id:"split",label:Ka.contextMenu?.splitTask||"Split Task",icon:sa.Split,onClick:()=>{let zt=F.startDate.getTime(),da=F.endDate.getTime(),mr=zt+(da-zt)/2,zr=new Date(mr);vr(F,zr);}}),ie&&(Ke.length>0&&Ke.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ke.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:sa.Delete,onClick:()=>{Ce({taskIds:[F.id],taskName:F.name});}})),Ke})()}),jsx(Ro,{task:S,isOpen:!!S,onClose:()=>W(null),onTaskUpdate:E=>{S&&(Se(S.id,E),W(null));},theme:X==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:pe&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Ce(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Qt.bgSecondary,border:`1px solid ${Qt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Qt.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:Qt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ka.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:pe.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Qt.textPrimary},children:[pe.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Qt.textPrimary},children:['"',pe.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Qt.bgPrimary,borderTop:`1px solid ${Qt.border}`},children:[jsx("button",{onClick:()=>Ce(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Qt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Zt(pe.taskIds),Ce(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(Sl,{tasks:be,theme:Qt,config:x,onTasksUpdate:_,onTaskUpdate:Se,onTaskCreate:E=>{_(F=>[...F,E]);},onTaskDelete:E=>{Zt([E]);},onDependencyCreate:(E,F)=>{let H=Ee.findTaskById(be,E);H&&Ga(H,F);},onDependencyDelete:ao})]})})})});function Qw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Ad=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Id=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Dg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...Ad,...i.filter(A=>!Ad.some(X=>X.id===A.id))],b=ct[c]||ct.dark,[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(false),[C,D]=useState(false),[P,N]=useState({top:0,left:0}),[V,O]=useState(null),[J,L]=useState(new Date),[Le,G]=useState({top:0,left:0}),[Ne,$]=useState(false),[ve,U]=useState([]),[ze,oe]=useState(false),[Re,Q]=useState(""),Pe=useRef(null),We=useRef(null),Fe=useRef(null),Be=useRef(null),rt=useRef(null),[ce,Ve]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Qe,Ie]=useState({});useEffect(()=>{a?(Ve({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&$(true)):(Ve({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),$(false),U([]));},[a,e,v]),useEffect(()=>{let A=X=>{Pe.current&&!Pe.current.contains(X.target)&&x(false),We.current&&!We.current.contains(X.target)&&k(false),Fe.current&&!Fe.current.contains(X.target)&&I(false),Be.current&&!Be.current.contains(X.target)&&D(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let ht=()=>{let A={};return ce.name.trim()||(A.name="El nombre es requerido"),ce.startDate&&ce.endDate&&ce.startDate>ce.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie(A),Object.keys(A).length===0},vt=async A=>{if(A.preventDefault(),!!ht())try{let X=l==="create"&&ve.length>0?{...ce,pendingFiles:ve}:ce;await s(X),U([]),t();}catch(X){console.error("Error submitting task:",X);}},ot=(A,X)=>{Ve(ke=>{let R={...ke,[A]:X};if(A==="status"){let q=X;q==="todo"?R.progress=0:q==="in-progress"?(ke.progress===0||ke.progress===100)&&(R.progress=50):q==="completed"||q==="closed"?R.progress=100:(q==="in-review"||q==="review")&&(R.progress=75);}if(A==="progress"){let q=typeof X=="number"?X:parseInt(X,10);q===100&&ke.status!=="completed"?R.status="completed":q>0&&q<100&&ke.status==="todo"?R.status="in-progress":q===0&&ke.status!=="todo"&&(R.status="todo");}return R}),Qe[A]&&Ie(ke=>{let R={...ke};return delete R[A],R});},Te=h.find(A=>A.id===ce.status)??Ad[0],mt=Id.find(A=>A.id===ce.priority)??Id[1],wt=Io.find(A=>A.value===ce.color)??Io[0],je=c==="dark",dt={backgroundColor:je?"#1d1f27":b.bgSecondary,border:`1px solid ${je?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:je?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,border:`1px solid ${je?"rgba(65,71,84,0.1)":b.border}`,boxShadow:je?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxs("form",{onSubmit:vt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ce.name,onChange:A=>ot("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Qe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Qe.name]}),jsx("textarea",{value:ce.description||"",onChange:A=>ot("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...dt,borderColor:Te.color,backgroundColor:`${Te.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Te.color}}),jsx("span",{style:{color:Te.color},children:Te.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Te.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("status",A.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,ce.status===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxs("div",{ref:We,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:mt.color}}),jsx("span",{children:mt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Id.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("priority",A.id),k(false);},children:[jsx("span",{children:A.icon}),A.label,ce.priority===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&I(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[ce.assignees&&ce.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ce.assignees.slice(0,3).map((A,X)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},X))}),ce.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",ce.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:M&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let X=ce.assignees?.some(ke=>ke.name===A.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ke=X?(ce.assignees||[]).filter(R=>R.name!==A.name):[...ce.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(R=>R[0]).join("").toUpperCase().slice(0,2),color:b.accent}];ot("assignees",ke);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:A.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)D(false);else {if(Be.current){let A=Be.current.getBoundingClientRect(),X=window.innerHeight,ke=120,q=X-A.bottom<ke?A.top-ke-8:A.bottom+8;N({top:q,left:A.left});}D(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ce.color}}),jsx("span",{children:wt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(ua,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Io.slice(0,18).map(A=>{let X=ce.color===A.value;return jsx("button",{type:"button",onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),ot("color",A.value),D(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:X?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),u.length>0||p?jsx(cs,{selectedTags:ce.tags||[],availableTags:u,onChange:A=>ot("tags",A),onCreateTag:p,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:je?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${je?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:rt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!ce.isMilestone)if(V==="start")O(null);else {if(rt.current){let A=rt.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("start"),L(ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:o||ce.isMilestone,children:ce.startDate?ce.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!ce.isMilestone)if(V==="end")O(null);else {if(rt.current){let A=rt.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("end"),L(ce.endDate||ce.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ce.isMilestone?.5:1,cursor:ce.isMilestone?"not-allowed":"pointer"},disabled:o||ce.isMilestone,children:ce.endDate?ce.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:V&&jsxs(ua,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Le.top}px`,left:`${Le.left}px`,zIndex:99999,backgroundColor:je?"#0a0a0a":b.bgPrimary,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${je?"#262626":b.border}`},children:[(()=>{let A=new Date,X=new Date(A);X.setDate(A.getDate()+1);let ke=new Date(A);ke.setDate(A.getDate()+7);let R=new Date(A);return R.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:ke},{label:"2 semanas",date:R}].map((we,Ue)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:me=>me.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:me=>me.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(ot("startDate",we.date),(!ce.endDate||we.date>ce.endDate)&&ot("endDate",we.date),O("end")):(ot("endDate",we.date),(!ce.startDate||we.date<ce.startDate)&&ot("startDate",we.date),O(null));},children:we.label},Ue))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{ot("startDate",void 0),ot("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:J.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,X)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},X))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=J.getFullYear(),X=J.getMonth(),ke=new Date(A,X,1).getDay(),R=new Date(A,X+1,0).getDate(),q=new Date,we=[];for(let me=ke-1;me>=0;me--)we.push({day:new Date(A,X,-me).getDate(),date:new Date(A,X-1,new Date(A,X,-me).getDate()),isCurrentMonth:false});for(let me=1;me<=R;me++)we.push({day:me,date:new Date(A,X,me),isCurrentMonth:true});let Ue=42-we.length;for(let me=1;me<=Ue;me++)we.push({day:me,date:new Date(A,X+1,me),isCurrentMonth:false});return we.map((me,et)=>{let de=me.date.toDateString()===q.toDateString(),ue=ce.startDate?.toDateString()===me.date.toDateString(),Oe=ce.endDate?.toDateString()===me.date.toDateString(),lt=ce.startDate&&ce.endDate&&me.date>=ce.startDate&&me.date<=ce.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:me.isCurrentMonth?ue||Oe?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:ue?b.accent:Oe?"#7C3AED":lt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:de&&!ue&&!Oe?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(ot("startDate",me.date),ce.endDate&&me.date>ce.endDate&&ot("endDate",me.date),O("end")):(ot("endDate",me.date),ce.startDate&&me.date<ce.startDate&&ot("startDate",me.date),O(null));},children:me.day},et)})})()})]})]})]})})]}),Qe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Qe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ce.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:je?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let X=A.currentTarget.getBoundingClientRect(),ke=Math.round((A.clientX-X.left)/X.width*100/5)*5;ot("progress",Math.max(0,Math.min(100,ke)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ce.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${je?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>$(!Ne),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ne?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ne&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ce.effortMinutes?Qw(ce.effortMinutes):"",onChange:A=>{let X=Zw(A.target.value);ot("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ce.parentId||"",onChange:A=>ot("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ce.location||"",onChange:A=>ot("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ce.equipment||"",onChange:A=>ot("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||d.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?ve.length>0&&`(${ve.length})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsx(ms,{cardId:"pending",attachments:ve.map((A,X)=>({id:`pending-${X}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>U(X=>[...X,...A]),onDelete:A=>{let X=parseInt(A.replace("pending-",""),10);U(ke=>ke.filter((R,q)=>q!==X));},maxSizeMB:10,maxFiles:20}):jsx(ms,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?A=>m(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&ve.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[ve.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ce.isMilestone,onChange:A=>ot("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ce.dependencies&&ce.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ce.dependencies.map(A=>{let X$1=r.find(ke=>ke.id===A);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[X$1?.name||A.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ke=(ce.dependencies||[]).filter(R=>R!==A);ot("dependencies",ke);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{type:"button",onClick:()=>{oe(!ze),Q("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:ze&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{oe(false),Q("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:je?"#0a0a0a":b.bgPrimary,backdropFilter:je?"blur(16px)":void 0,border:`1px solid ${je?"#262626":b.border}`,boxShadow:je?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:Re,onChange:A=>Q(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>Re===""||A.name.toLowerCase().includes(Re.toLowerCase())).map(A=>{let X=ce.dependencies?.includes(A.id);return jsxs("button",{type:"button",onClick:()=>{let ke=ce.dependencies||[],R;X?R=ke.filter(q=>q!==A.id):R=[...ke,A.id],ot("dependencies",R);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${b.accent}10`:"transparent"},onMouseEnter:ke=>{X||(ke.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:ke=>{ke.currentTarget.style.backgroundColor=X?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?b.accent:"transparent",borderColor:X?b.accent:b.borderLight},children:X&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:A.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${je?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:je?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Sg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,40 +406,40 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
406
406
|
|
|
407
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
408
408
|
If you can't find a task by name, search through the provided task list.
|
|
409
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
410
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function Eg(e){return `CURRENT TASKS:
|
|
410
|
+
${Mg(e).map(r=>{let n=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",o=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${n} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Sg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Vn(e,t){let a=Sg(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function Md(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 d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(m!==void 0){let f=new Date(r),v=f.getDay(),h=m-v;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function Pd(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),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="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 Eg(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Mg(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),p=Vn(t,i),d=Md(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),p=Vn(t,i),d=Pd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),p=Vn(t,i),d=Fd(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),p=Vn(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=Vn(t,i),d=Vn(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Vn(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Pg(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 ek(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 tk(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Tl(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Tl(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),c=o(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:ek(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Fg(e,t=[]){let 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:tk(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Lg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Tl(r,e,t))}var Ld={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"}},Ad={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"}},Nl={en:Ld,es:Ad};function Id(e){return Nl[e]||Nl.en}function Dl(e,t){let a=Id(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 Rd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Ag(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 Ig({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Ag(e),i=Rd[0],u=Rd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(Ag(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Rd.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function bo(e,t,a=320){let[r,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!l&&c);},[t,a,e]),r}var Bd=[{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 Bg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null),c=bo(l,s,180);useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Bd.find(p=>p.value===e)??Bd[4],u=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.label[u]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.label[u]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Bd.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),o(false);},className:g("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===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function ci(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function $d(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],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-[#00E5CC]"}function Ml({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),p=useRef(null),d=bo(u,o);useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(a){if(f(h.name))a(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ci(h.name),color:h.color||$d(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,b]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:g("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((h,b)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&$d(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ci(h.name)},`${h.name}-${b}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:h=>{h.stopPropagation(),l(!o);},className:g("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:g("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("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((h,b)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&$d(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ci(h.name)},`${h.name}-${b}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),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:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color: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((h,b)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ci(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${h.name}-${b}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let b=f(h.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{b||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(y.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ci(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function zg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=useState(false),[p,d]=useState(n),[m,f]=useState(()=>{let T=n==="start"?e:t;if(T){let V=T instanceof Date?T:new Date(T);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),h=useRef(null),b=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let T=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useLayoutEffect(()=>{if(!i){x(null);return}let T=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,Q=360,L=window.innerHeight-V.bottom,Le=L<Q&&V.top>L,G=Le?V.top-4:V.bottom+4,Ne=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:G,left:Ne,flipUp:Le});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[i]),useEffect(()=>{i&&d(r?n:"start");},[i,r,n]);let M=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",I=useCallback(()=>{let T=m.getFullYear(),V=m.getMonth(),O=new Date(T,V,1),L=new Date(T,V+1,0).getDate(),Le=O.getDay(),G=[],$=new Date(T,V,0).getDate();for(let U=Le-1;U>=0;U--)G.push({date:new Date(T,V-1,$-U),isCurrentMonth:false});for(let U=1;U<=L;U++)G.push({date:new Date(T,V,U),isCurrentMonth:true});let ve=42-G.length;for(let U=1;U<=ve;U++)G.push({date:new Date(T,V+1,U),isCurrentMonth:false});return G},[m]),C=T=>{if(r)n==="start"?a(T,k||void 0):a(w||void 0,T),u(false);else if(p==="start"){let V=k&&T>k?T:k;a(T,V||void 0),d("end");}else {let V=w&&T<w?T:w;a(V||void 0,T),u(false);}},N=()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let Q=new Date(T);Q.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let L=new Date(T);L.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Le=new Date(T);Le.setDate(T.getDate()+14);let G=new Date(T);return G.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Q,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Le,display:Le.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=r&&n==="start"?w:k;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(T)})]})}let P=r&&n==="start"?w:k;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,onClick:T=>{T.stopPropagation(),u(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((T,V)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(T.date),children:[jsx("span",{children:T.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:T.display})]},V)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,k||void 0):a(w||void 0,void 0):a(void 0,void 0),u(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:p==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(T=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:I().map((T,V)=>{let O=T.date.toDateString()===new Date().toDateString(),Q=w?.toDateString()===T.date.toDateString(),L=k?.toDateString()===T.date.toDateString(),Le=Q||L,G=!r&&w&&k&&T.date>=w&&T.date<=k;return jsx("button",{onClick:()=>C(new Date(T.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",Q&&"bg-[#00E5CC] text-white",L&&!Q&&"bg-[#7C3AED] text-white",G&&!Le&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Le&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]}),document.body)]})}function Fl({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(zg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function vs(e=600){let[t,a]=useState(false),r=useRef(null),n=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:n}}function Ll(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=r/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function Gg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},a);},[a,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function jg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=vs(),{displayValue:m,isAnimating:f}=Ll(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,I=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,I));C!==e&&(t(C),s&&d());},h=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function qg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{l!==e&&t?.(l),o(false);},p=d=>{d.key==="Enter"?u():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("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 Jg({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=vs(),{displayValue:h,isAnimating:b}=Ll(e,{enabled:l&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);if(!isNaN(w)){let k=w;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&v());}u(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:r}):i?jsx("input",{ref:m,type:"number",value:p,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:g("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"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:r})}function Qg({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),c=useRef(null),i=bo(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!a?jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),l(!o);},className:g("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:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(i?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(u),l(false);},className:g("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===u&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:u}),e===u&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function e0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:u}=Gg(t,{delay:s}),p=m=>{m.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},d=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:p,disabled:r||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&d&&"ring-green-500/50",l&&!d&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("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 t0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=useState(false),u=useRef(null),p=bo(u,c,220);useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||a(x);},h=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:b=>{b.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(p?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(b=>{let y=e.includes(b),x=!y&&h;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:b}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function Vk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function n0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Vk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return r?jsxs("button",{onClick:c=>{c.stopPropagation(),r(s);},title:n.map(c=>c.name).join(`
|
|
414
|
-
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:l})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function i0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=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)),n>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function Kk(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 qk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function $r({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:u}){let[p,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:h,triggerFlash:b}=vs(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Kk(e,r);useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),useEffect(()=>{if(e){let C=Math.floor(e/60),N=e%60;C>0&&N>0?f(`${C}h ${N}m`):C>0?f(`${C}h`):f(`${N}m`);}else f("");},[e,p]);let k=()=>{let C=qk(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)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:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("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 I=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(I,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):p?jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),d(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",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",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(I,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function u0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color: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:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function m0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=a==="es",u=l==="financial"&&c>0,p=G=>u?`$${Math.round(G*c).toLocaleString("en-US")}`:`${G}h`,[d,m]=useState(false),[f,v]=useState(false),[h,b]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,I=Math.round(w/60*10)/10,C=w>0?x/w*100:0,N=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let G=Ne=>{y.current&&!y.current.contains(Ne.target)&&(v(false),b(null));};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[f,h]);let T=G=>{if(G.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){v(Ne=>!Ne),b(null);return}o&&o(e);},V=G=>{v(false),b(G);},O=async(G,Ne)=>{h==="log"&&r&&G?r(e,G,Ne):h==="estimate"&&n?n(e,G):h==="quoted"&&s&&s(e,G),b(null);},Q=r||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(G=>G.show),Le=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:G=>G.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&Q&&jsx("button",{onClick:T,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:Ne=>{Ne.stopPropagation(),V(G.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:Ne=>{Ne.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ne=>{Ne.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.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(Dn,{mode:h,locale:a,isDark:t,currentValue:Le||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:G=>G.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let G=x===0,$=(w>0?x/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:G?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(I)]}),N>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:$?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:$?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(N)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),Q&&jsx("button",{onClick:T,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:Ne=>{Ne.stopPropagation(),V(G.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:Ne=>{Ne.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ne=>{Ne.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.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(Dn,{mode:h,locale:a,isDark:t,currentValue:Le||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function t1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function a1(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 g0({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",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function f0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=t1(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsx(g0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?a1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(g0,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var r1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function h0({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",r1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function y1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function x1(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 T0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=useRef(null),y=r==="es"?v0.es:v0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),T=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-T&&(O=Math.max(T,e.y-P.height)),e.x+P.width>window.innerWidth-T&&(V=Math.max(T,window.innerWidth-P.width-T)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let N=T=>{b.current&&!b.current.contains(T.target)&&t();},P=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),l&&(N.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),N.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&N.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],O=T.some(Q=>Q.name===P.name)?T.filter(Q=>Q.name!==P.name):[...T,{name:P.name,initials:y1(P.name),color:P.color||x1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&N.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&N.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&N.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return i&&(N.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},I=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:I.map(N=>N.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsx(v1,{item:N,isDark:a},N.id):jsxs("button",{onClick:N.onClick,className:g("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",N.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(N.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function v1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var v0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var L0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},$1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function I0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),h=c==="es"?A0.es:A0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let Q=P.getBoundingClientRect();f({top:Q.bottom+4,right:window.innerWidth-Q.right});}let T=v.current.getBoundingClientRect(),O=window.innerHeight-T.top-20;d(Math.max(300,O));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},T=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let b=useMemo(()=>{let N=new Set([...$1]);return a.forEach(P=>{P.type&&P.type!=="assignees"&&N.add(P.type);}),Array.from(N)},[a]);if(!e)return null;let y=N=>{let P=h.columns[N];if(P)return P;let T=a.find(V=>V.type===N);return T?.label?T.label:N},x=N=>{if(N==="name")return;let P=a.map(T=>T.id===N?{...T,visible:!T.visible}:T);n(P);},w=(N,P)=>{let T=a.find(O=>O.type===N&&(!P||O.customFieldId===P));if(T){x(T.id);return}let V={id:P||N,type:N,label:P?r.find(O=>O.id===P)?.name||N:y(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...a,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&y(N).toLowerCase().includes(i.toLowerCase())),I=r.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:N=>u(N.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:N=>{N&&N.style.setProperty("--focus-border",C);},onFocus:N=>{N.currentTarget.style.borderColor=C,N.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.currentTarget.style.background=l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:N=>N.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(N=>{let P=a.find(O=>O.type===N&&!O.customFieldId),T=P?.visible??false,V=N==="name";return jsxs("button",{onClick:()=>{V||(P?x(P.id):w(N));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}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?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:L0[N]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(N),children:y(N)})]},N)})})]}),I.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:I.map(N=>{let T=a.find(V=>V.customFieldId===N.id)?.visible??false;return jsxs("button",{onClick:()=>w(N.type,N.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}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?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:L0[N.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:N.name})]},N.id)})})]})]})]})}var A0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var _1=[{type:"text",icon: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 $0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,u]=useState([""]),p=n==="es"?B0.es:B0.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(i.filter((b,y)=>y!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("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:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",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:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:_1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>v(b),className:g("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"})})]},b)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxs("div",{className:g("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:g("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:p.cancel}),jsx("button",{onClick:d,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:p.create})]})]})]}):null}var B0={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 U0={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 W0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?U0.es:U0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,d&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),r(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;r(m),m&&a("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function z0(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 vo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function G0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:vo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(I,C)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:vo(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:vo(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(I,C)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:vo(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:vo(u)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(v,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[m>=0?"+":"",vo(m),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[p>=0?`+${vo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${vo(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:z0(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:z0(i)})]}),i>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let u=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${c.name}-${i}`)})})]})]})}var lC=[{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 Y0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...Y0(n.subtasks,t+1,s));}return r}function cC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,n++;}return n>0?r/n:null}function Ds(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Ds(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Ns(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 dC({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?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 q0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function nu(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?nu(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function X0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:I=true,showCreateTaskButton:C=false,onCreateTask:N,persistFilter:P=false,financialBlur:T,healthSidebar:V,lens:O="hours",hourlyRate:Q=0,rateMap:L,aggregateParentHours:Le=false,showProjectTotals:G=false,totalsDollarOverride:Ne}=t,$=t.rowDensity==="compact",ve=Dl(f,v),U=m==="dark",We=D=>{if(!L||!D.assignees||D.assignees.length===0)return Q;let X=0,Y=0;for(let ye of D.assignees){let ze=ye.id?L[ye.id]:void 0;if(ze==null||ze<=0)continue;let re=typeof ye.estimatedMinutes=="number"?ye.estimatedMinutes:0;re>0&&(X+=ze*re,Y+=re);}if(Y>0)return X/Y;let de=D.assignees.map(ye=>ye.id?L[ye.id]:void 0).filter(ye=>ye!=null&&ye>0);return de.length===0?Q:de.reduce((ye,ze)=>ye+ze,0)/de.length},oe=D=>{let X=0,Y=0,de=0,ye=ze=>{for(let re of ze)if(re.subtasks&&re.subtasks.length>0){let Se={s:X,a:Y,q:de};if(ye(re.subtasks),X-Se.s+(Y-Se.a)+(de-Se.q)===0){let qe=We(re);X+=(re.timeLoggedMinutes??0)/60*qe,Y+=(re.effortMinutes??0)/60*qe,de+=(re.soldEffortMinutes??0)/60*qe;}}else {let Se=We(re);X+=(re.timeLoggedMinutes??0)/60*Se,Y+=(re.effortMinutes??0)/60*Se,de+=(re.soldEffortMinutes??0)/60*Se;}};return D.subtasks&&ye(D.subtasks),{dollarSpent:X,dollarAllocated:Y,dollarQuoted:de}},Re=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let D=localStorage.getItem(P);if(D){let X=JSON.parse(D);return {statusFilter:X.statusFilter||"all",hideCompleted:X.hideCompleted||!1}}}catch(D){console.error("Error loading persisted filter:",D);}return {statusFilter:"all",hideCompleted:false}},[P]),Z=useMemo(()=>{function D(X){let Y=0,de=0,ye=0,ze=0,re=0,Se=0;for(let He of X)if(He.subtasks&&He.subtasks.length>0){let qe=D(He.subtasks);if(qe.spent+qe.allocated+qe.quoted>0)Y+=qe.spent,de+=qe.allocated,ye+=qe.quoted,ze+=qe.dollarSpent,re+=qe.dollarAllocated,Se+=qe.dollarQuoted;else {let it=He.timeLoggedMinutes??0,ft=He.effortMinutes??0,ia=He.soldEffortMinutes??0;Y+=it,de+=ft,ye+=ia;let jt=We(He);ze+=it/60*jt,re+=ft/60*jt,Se+=ia/60*jt;}}else {let qe=He.timeLoggedMinutes??0,Pt=He.effortMinutes??0,it=He.soldEffortMinutes??0;Y+=qe,de+=Pt,ye+=it;let ft=We(He);ze+=qe/60*ft,re+=Pt/60*ft,Se+=it/60*ft;}return {spent:Y,allocated:de,quoted:ye,dollarSpent:ze,dollarAllocated:re,dollarQuoted:Se}}return D(e)},[e]),Pe=useMemo(()=>{let D=new Map;function X(Y){let de=0;for(let ye of Y)if(ye.subtasks&&ye.subtasks.length>0){let ze=X(ye.subtasks);D.set(ye.id,ze),de+=ze;}else de+=ye.weight||0;return de}return X(e),D},[e]),Ue=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Z.spent,totalHoursAllocatedMinutes:Z.allocated}},[V,Z]),[Fe,Be]=useState(true),[rt,le]=useState(null),[Ve,Qe]=useState("position"),[Ie,ht]=useState("asc"),[vt,ot]=useState(""),[Te,mt]=useState(()=>Re().statusFilter),[wt,je]=useState(()=>Re().hideCompleted),[ut,A]=useState(y||lC),[J,ke]=useState(false),[R,q]=useState(false),[we,Oe]=useState({isOpen:false,x:0,y:0,type:"task"}),[me,et]=useState(null),[ce,ue]=useState(false),[$e,ct]=useState(null),[st,Ye]=useState(null),[kt,qt]=useState(null),za=useRef(0),pa=useRef(false),Lt=!!(a.onTaskMove||a.onTaskReparent),[Ht,ja]=useState(null),[Bt,pr]=useState(null),ma=D=>{let X=D.type;return D.customFieldId?X==="file"?null:{kind:"customField",fieldId:D.customFieldId}:X==="assignees"||X==="teamLoad"?"assignees":X==="startDate"?"startDate":X==="endDate"?"endDate":null},hr=(D,X)=>typeof D=="string"||typeof X=="string"?D===X:D.fieldId===X.fieldId,Xe=useRef([]),Ze=useCallback((D,X)=>{Lt&&(X.preventDefault(),za.current=X.clientY,et(D),pa.current=false,ue(false),qt({x:X.clientX,y:X.clientY}));},[Lt]),Fa=useCallback(D=>{if(!me||(Math.abs(D.clientY-za.current)>5&&!pa.current&&(pa.current=true,ue(true)),qt({x:D.clientX,y:D.clientY}),!pa.current))return;let Y=document.querySelectorAll("[data-listview-row]"),de=null,ye=null;Y.forEach(ze=>{let re=ze.getBoundingClientRect(),Se=ze.getAttribute("data-listview-row");if(Se&&Se!==me&&D.clientY>=re.top&&D.clientY<=re.bottom){de=Se;let He=D.clientY-re.top,qe=re.height;ye=He<qe*.25?"above":He>qe*.75?"below":"child";}}),ct(de),Ye(ye);},[me]),La=useCallback(()=>{if(pa.current&&me&&$e&&st){if(st==="child"&&a.onTaskReparent)a.onTaskReparent(me,$e);else if(st==="above"||st==="below"){let D=(de,ye,ze=null)=>{for(let re of de){if(re.id===ye)return ze;if(re.subtasks){let Se=D(re.subtasks,ye,re.id);if(Se!==void 0)return Se}}},X=D(e,me,null),Y=D(e,$e,null);if(a.onTaskReparent){let de=(qe,Pt)=>{if(Pt===null)return qe;for(let it of qe){if(it.id===Pt)return it.subtasks||[];if(it.subtasks){let ft=de(it.subtasks,Pt);if(ft.length>0||it.subtasks.some(ia=>ia.id===Pt))return ft}}return []},ye=de(e,Y??null),ze=ye.findIndex(qe=>qe.id===$e),re=X===Y,Se=re?ye.findIndex(qe=>qe.id===me):-1,He=st==="below"?ze+1:ze;re&&Se!==-1&&Se<ze&&(He-=1),a.onTaskReparent(me,Y??null,Math.max(0,He));}}}et(null),ct(null),Ye(null),qt(null),pa.current=false,ue(false);},[me,$e,st,e,a]),rr=(D,X)=>typeof X!="string"?D.customFields?.find(de=>de.fieldId===X.fieldId)?.value:X==="assignees"?D.assignees:X==="startDate"?D.startDate:D.endDate,ka=(D,X,Y,de)=>{D.preventDefault(),D.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ye=Array.from(document.querySelectorAll("[data-listview-row]")),ze=ye.map(Et=>Et.getAttribute("data-listview-row")||""),re=Math.max(0,ze.indexOf(X)),Se=Et=>ze.slice(re,Et+1);pr({sourceTaskId:X,column:Y,sourceIndex:de,targetIndex:de,rangeIds:new Set([X])});let qe=(Et=>{let At=Et?.parentElement??null;for(;At;){let Nr=window.getComputedStyle(At).overflowY;if((Nr==="auto"||Nr==="scroll")&&At.scrollHeight>At.clientHeight)return At;At=At.parentElement;}let Aa=document.scrollingElement;return Aa&&Aa.scrollHeight>Aa.clientHeight?Aa:null})(D.currentTarget),Pt=Et=>{let At=re,Aa=false;ye.forEach((Nr,mr)=>{let Ka=Nr.getBoundingClientRect();Et>=Ka.top&&Et<=Ka.bottom&&(At=mr,Aa=true);});let sr=ye[ye.length-1];if(!Aa&&sr){let Nr=sr.getBoundingClientRect();Et>Nr.bottom&&(At=ye.length-1);}return At<re&&(At=re),At},it=D.clientY,ft=null,ia=()=>{ft!==null&&(cancelAnimationFrame(ft),ft=null);},jt=()=>{let Et=Pt(it),At=new Set(Se(Et));pr(Aa=>Aa&&{...Aa,targetIndex:Et,rangeIds:At});},ga=()=>{if(ia(),!qe)return;let Et=qe,Aa=Et===document.scrollingElement?{top:0,bottom:window.innerHeight}:Et.getBoundingClientRect(),sr=60,Nr=12,mr=it-Aa.top,Ka=Aa.bottom-it,$n=Et.scrollHeight-Et.clientHeight;if(Ka<sr&&Et.scrollTop<$n){let Is=Math.max(1,Math.round(Nr*(1-Math.max(0,Ka)/sr))),Co=()=>{Et.scrollTop+=Is,jt(),Et.scrollTop<Et.scrollHeight-Et.clientHeight&&(ft=requestAnimationFrame(Co));};ft=requestAnimationFrame(Co);}else if(mr<sr&&Et.scrollTop>0){let Is=Math.max(1,Math.round(Nr*(1-Math.max(0,mr)/sr))),Co=()=>{Et.scrollTop-=Is,jt(),Et.scrollTop>0&&(ft=requestAnimationFrame(Co));};ft=requestAnimationFrame(Co);}},Wt=Et=>{it=Et.clientY,jt(),ga();},Jt=Et=>{window.removeEventListener("mousemove",Wt),window.removeEventListener("mouseup",Jt),ia(),document.body.style.cursor="",document.body.style.userSelect="",pr(null);let At=Pt(Et.clientY),Aa=new Map(Xe.current.map(Ka=>[Ka.id,Ka])),sr=Aa.get(X);if(!sr)return;let Nr=rr(sr,Y),mr=[];for(let Ka of Se(At)){if(Ka===X)continue;let $n=Aa.get(Ka);$n&&($n.subtasks&&$n.subtasks.length>0||mr.push(Ka));}mr.length>0&&a.onBulkFill?.(mr,Y,Nr);};window.addEventListener("mousemove",Wt),window.addEventListener("mouseup",Jt);},Lr=D=>Bt?Bt.rangeIds.has(D):false;useEffect(()=>{if(me)return document.addEventListener("mousemove",Fa),document.addEventListener("mouseup",La),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Fa),document.removeEventListener("mouseup",La),document.body.style.cursor="",document.body.style.userSelect="";}},[me,Fa,La]);let[se,fe]=useState("all"),[pt,j]=useState(false),he=useRef(null),ae=useRef(null),B=useMemo(()=>{let D=0;function X(Y,de){for(let ye of Y)de>D&&(D=de),ye.subtasks?.length&&X(ye.subtasks,de+1);}return X(e,1),D},[e]);useEffect(()=>{if(!pt)return;let D=X=>{he.current?.contains(X.target)||ae.current?.contains(X.target)||j(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[pt]),useEffect(()=>{if(se==="all"){let Y=function(de){for(let ye of de)ye.subtasks?.length&&(ye.isExpanded===false&&a.onTaskToggleExpand?.(ye.id),Y(ye.subtasks));};Y(e);}else {let Y=function(de,ye){for(let ze of de)if(ze.subtasks?.length){let re=ye<se,Se=ze.isExpanded!==false;re!==Se&&a.onTaskToggleExpand?.(ze.id),Y(ze.subtasks,ye+1);}};Y(e,1);}},[se]);let[ee,De]=useState(null),[S,W]=useState(0),[pe,Ce]=useState(0),nt=useRef(null),[be,_]=useState(null),[gt,bt]=useState(null);useEffect(()=>{y&&A(D=>{if(D.length===y.length){let X=true;for(let Y=0;Y<D.length;Y++){let de=D[Y],ye=y[Y];if(!de||!ye||de.id!==ye.id||de.visible!==ye.visible||de.width!==ye.width||de.label!==ye.label){X=false;break}}if(X)return D}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Te,hideCompleted:wt}));}catch(D){console.error("Error persisting filter state:",D);}},[P,Te,wt]);let Ut=useMemo(()=>{let D=new Set;function X(Y){for(let de of Y)de.subtasks?.length&&(de.isExpanded!==false&&D.add(de.id),X(de.subtasks));}return X(e),D},[e]),Vt=useMemo(()=>ut.filter(D=>D.visible),[ut]),nr=useCallback(D=>{a.onTaskToggleExpand?.(D);},[a]),yr=useCallback(D=>{Ve===D?ht(X=>X==="asc"?"desc":"asc"):(Qe(D),ht("asc")),a.onSortChange?.({column:D,direction:Ie==="asc"?"desc":"asc"});},[Ve,Ie,a]),Tr=useCallback(D=>{A(D),a.onColumnsChange?.(D);},[a]),ta=useCallback(D=>{let X=ut.map(Y=>Y.id===D?{...Y,visible:false}:Y);Tr(X);},[ut,Tr]),qo=useCallback((D,X)=>{Qe(D),ht(X);},[]),Rn=useCallback((D,X,Y)=>{I&&(D.preventDefault(),Oe({isOpen:true,x:D.clientX,y:D.clientY,type:X?"task":"header",task:X,columnId:Y}));},[I]),Gr=useCallback(()=>{Oe(D=>({...D,isOpen:false}));},[]),Yn=useCallback((D,X)=>{if(!M)return;D.preventDefault(),D.stopPropagation();let Y=ut.find(de=>de.id===X);Y&&(De(X),W(D.clientX),Ce(Y.width));},[ut,M]);useEffect(()=>{if(!ee)return;let D=ut,X=de=>{let ye=de.clientX-S,ze=Math.max(50,pe+ye);D=D.map(re=>re.id===ee?{...re,width:ze}:re),A(D);},Y=()=>{a.onColumnsChange?.(D),De(null);};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",Y);}},[ee,S,pe,a]);let Xn=useCallback((D,X)=>{if(X==="name"){D.preventDefault();return}_(X),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",X),D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="0.5");},[]),Ci=useCallback(D=>{D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="1"),_(null),bt(null);},[]),Yo=useCallback((D,X)=>{D.preventDefault(),X!=="name"&&(D.dataTransfer.dropEffect="move",bt(X));},[]),Ti=useCallback(()=>{bt(null);},[]),_a=useCallback((D,X)=>{if(D.preventDefault(),!be||be===X||X==="name")return;let Y=[...ut],de=Y.findIndex(re=>re.id===be),ye=Y.findIndex(re=>re.id===X);if(de===-1||ye===-1)return;let ze=Y.splice(de,1);ze[0]&&(Y.splice(ye,0,ze[0]),Tr(Y),_(null),bt(null));},[be,ut,Tr]),Ps=useCallback(async D=>{if(a.onCreateCustomField){let X={...D,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(X);}q(false);},[a]),Jn=useCallback(D=>D.progress===100||D.status==="completed"?"completed":D.progress&&D.progress>0||D.status==="in-progress"?"in-progress":"todo",[]),Fs=t.groupBy==="status",xr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[tn,Bn]=useState(()=>{let D=new Set(t.defaultCollapsedGroups??["completed"]);if(!xr)return D;try{let X=localStorage.getItem(xr);return X?new Set(JSON.parse(X)):D}catch{return D}}),Ls=useCallback(D=>{Bn(X=>{let Y=new Set(X);if(Y.has(D)?Y.delete(D):Y.add(D),xr)try{localStorage.setItem(xr,JSON.stringify([...Y]));}catch{}return Y});},[xr]),{lista:kn,cabeceras:Ni,todas:As}=useMemo(()=>{let D=Y0(e);if(vt.trim()){let Y=vt.toLowerCase();D=D.filter(de=>de.name.toLowerCase().includes(Y));}let X=t.showStatusFilter!==false;if(X&&Te!=="all"){let Y=new Set(D.filter(de=>Jn(de)===Te).flatMap(de=>de.parentPath));D=D.filter(de=>Y.has(de.id));}if(X&&wt){let Y=new Set(D.filter(de=>Jn(de)!=="completed").flatMap(de=>de.parentPath));D=D.filter(de=>Y.has(de.id));}if(Fs){let Y=["todo","in-progress","completed"],de=new Map,ye=[];for(let He of D){let qe=He.parentPath[0]??He.id;He.level===0&&ye.push(He),de.has(qe)||de.set(qe,[]),de.get(qe).push(He);}let ze=He=>He.endDate?new Date(He.endDate).getTime():1/0,re=[],Se=new Map;for(let He of Y){let qe=ye.filter(jt=>Jn(jt)===He).sort((jt,ga)=>ze(jt)-ze(ga)),Pt=qe.flatMap(jt=>de.get(jt.id)??[jt]),it=Pt.filter(jt=>!jt.hasChildren).length;if(it===0&&qe.length===0)continue;let ft=tn.has(He),ia=re.length;Se.set(ia,[...Se.get(ia)??[],{clave:He,cuenta:it,plegado:ft}]),ft||re.push(...Pt);}return {lista:re,cabeceras:Se,todas:D}}return D.sort((Y,de)=>{let ye,ze;switch(Ve){case "name":ye=Y.name.toLowerCase(),ze=de.name.toLowerCase();break;case "startDate":ye=Y.startDate?.getTime()||0,ze=de.startDate?.getTime()||0;break;case "endDate":ye=Y.endDate?.getTime()||0,ze=de.endDate?.getTime()||0;break;case "progress":ye=Y.progress||0,ze=de.progress||0;break;case "status":ye=Y.status||"todo",ze=de.status||"todo";break;case "priority":let re={urgent:0,high:1,medium:2,low:3,none:4};ye=re[Y.priority]??4,ze=re[de.priority]??4;break;case "position":return 0;default:return 0}return ye<ze?Ie==="asc"?-1:1:ye>ze?Ie==="asc"?1:-1:0}),{lista:D,cabeceras:new Map,todas:D}},[e,vt,Te,wt,Ve,Ie,Jn,t.showStatusFilter,Fs,tn]);Xe.current=kn;let Di={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Si=(D,X)=>{let Y=Ni.get(D);if(!Y?.length)return X;let de=Y.map(ye=>jsx("div",{"data-grupo-de-estado":ye.clave,"data-plegado":ye.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",U?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>Ls(ye.clave),"aria-expanded":!ye.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",U?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[ye.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),Di[ye.clave]?.[f==="es"?"es":"en"]??ye.clave,jsx("span",{className:g("font-normal tabular-nums",U?"text-white/40":"text-gray-400"),children:ye.cuenta})]})},`grupo-${ye.clave}`));return X?[...de,X]:de},Vr=useCallback((D,X)=>{let Y=ze=>{a.onTaskUpdate?.({...D,...ze});},de=ze=>ze?D.customFields?.find(Se=>Se.fieldId===ze)?.value:void 0,ye=(ze,re)=>{if(!ze)return;let He=[...D.customFields||[]],qe=He.findIndex(Pt=>Pt.fieldId===ze);qe>=0?He[qe]={fieldId:ze,value:re}:He.push({fieldId:ze,value:re}),Y({customFields:He});};switch(X.type){case "name":return null;case "status":return jsx(Ig,{value:D.status||(D.progress===100?"completed":D.progress&&D.progress>0?"in-progress":"todo"),onChange:re=>{Y({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:U,locale:f,translations:ve.status});case "priority":return jsx(Bg,{value:D.priority,onChange:re=>Y({priority:re}),isDark:U,locale:f});case "assignees":{let re=D.hasChildren,Se=D.assignees||[];if(re&&D.subtasks?.length){let He=new Map,qe=Pt=>{(Pt||[]).forEach(it=>{(it.assignees||[]).forEach(ft=>{He.has(ft.name)||He.set(ft.name,ft);}),it.subtasks?.length&&qe(it.subtasks);});};qe(D.subtasks),Se=Array.from(He.values());}else re&&(Se=[]);return jsx(Ml,{value:Se,availableUsers:l,onChange:He=>Y({assignees:He}),isDark:U,locale:f,disabled:re})}case "startDate":return jsx(Fl,{value:D.startDate,onChange:re=>Y({startDate:re}),isDark:U,locale:f,dateField:"start",startDate:D.startDate,endDate:D.endDate});case "endDate":{let re=jsx(Fl,{value:D.endDate,onChange:Se=>Y({endDate:Se}),isDark:U,locale:f,dateField:"end",startDate:D.startDate,endDate:D.endDate});return t.isTaskOverdue?.(D)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:U?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),re]}):re}case "progress":{let re=!!(D.subtasks&&D.subtasks.length>0),Se=re?q0(nu(D.subtasks||[])):D.progress||0;return jsx(jg,{value:Se,onChange:re?void 0:He=>{let qe=He===100?"completed":He>0?"in-progress":"todo";Y({progress:He,status:qe});},isDark:U,disabled:re})}case "tags":return jsx(i0,{value:D.tags||[],isDark:U});case "text":return jsx(qg,{value:de(X.customFieldId)||"",onChange:re=>ye(X.customFieldId,re),isDark:U});case "number":return jsx(Jg,{value:de(X.customFieldId)||0,onChange:re=>ye(X.customFieldId,re),isDark:U});case "date":let ze=de(X.customFieldId);return jsx(Fl,{value:ze?new Date(ze):void 0,onChange:re=>ye(X.customFieldId,re),isDark:U,locale:f});case "dropdown":return jsx(Qg,{value:de(X.customFieldId)||"",options:X.options||[],onChange:re=>ye(X.customFieldId,re),isDark:U});case "checkbox":return jsx(e0,{value:de(X.customFieldId)||false,onChange:re=>ye(X.customFieldId,re),isDark:U});case "multiselect":return jsx(t0,{value:de(X.customFieldId)||[],options:X.options||[],onChange:re=>ye(X.customFieldId,re),isDark:U,maxSelectable:X.maxSelectable});case "person":{let re=de(X.customFieldId)||[];return jsx(Ml,{value:re.map(Se=>({name:Se.name,avatar:Se.avatar,initials:Se.initials||(Se.name||"?").slice(0,2).toUpperCase(),color:Se.color||"#00E5CC"})),availableUsers:l,onChange:Se=>ye(X.customFieldId,Se),isDark:U,locale:f})}case "file":return jsx(n0,{value:de(X.customFieldId),isDark:U,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=D.status==="completed"||D.progress===100;return jsx($r,{value:D.estimatedTime,onChange:Se=>Y({estimatedTime:Se}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:We(D)})}case "quotedTime":{let re=D.status==="completed"||D.progress===100,Se=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx($r,{value:D.quotedTime,onChange:He=>Y({quotedTime:He}),isDark:U,locale:f,disabled:re,isBlurred:Se,lens:O,hourlyRate:We(D)})}case "elapsedTime":{let re=D.status==="completed"||D.progress===100,Se=D.executedDollarsCanonical;return jsx($r,{value:D.elapsedTime,onChange:He=>Y({elapsedTime:He}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:We(D),financialOverride:Se})}case "effortMinutes":{if(Le&&D.subtasks&&D.subtasks.length>0){let{allocated:Pt}=Ds(D);if(O==="financial"){let it=oe(D),ft=Math.round(it.dollarAllocated),ia=Math.round(it.dollarQuoted),jt=ia-ft;return jsxs("div",{className:"flex flex-col",children:[ft>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",ft.toLocaleString("es-CO")]}):null,jt!==0&&ft>0&&ia>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",jt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[jt>0?"+":"",Math.abs(jt)>=1e3?`$${(jt/1e3).toFixed(1)}K`:`$${jt}`]})]})}return jsx($r,{value:Pt>0?Pt:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:Q})}let re=D.status==="completed"||D.progress===100,Se=D.effortMinutes||0,He=D.soldEffortMinutes||0,qe=We(D);if(O==="financial"&&qe&&Se>0&&He>0){let Pt=Math.round(Se/60*qe),ft=Math.round(He/60*qe)-Pt;return jsxs("div",{className:"flex flex-col",children:[jsx($r,{value:Se,onChange:ia=>Y({effortMinutes:ia}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:We(D)}),ft!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ft>0?"+":"",Math.abs(ft)>=1e3?`$${(ft/1e3).toFixed(1)}K`:`$${ft}`]})]})}return jsx($r,{value:Se,onChange:Pt=>Y({effortMinutes:Pt}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:We(D)})}case "timeLoggedMinutes":{let re=D.executedDollarsCanonical;if(Le&&D.subtasks&&D.subtasks.length>0){let{spent:He}=Ds(D);return jsx($r,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:We(D),financialOverride:re})}let Se=D.status==="completed"||D.progress===100;return jsx($r,{value:D.timeLoggedMinutes,onChange:a.onLogTime?He=>{a.onLogTime?.(D,He);}:void 0,isDark:U,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Se,lens:O,hourlyRate:We(D),financialOverride:re})}case "soldEffortMinutes":{if(Le&&D.subtasks&&D.subtasks.length>0){let{quoted:He}=Ds(D),qe=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx($r,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,isBlurred:qe,lens:O,hourlyRate:We(D)})}let re=D.status==="completed"||D.progress===100,Se=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx($r,{value:D.soldEffortMinutes,onChange:He=>Y({soldEffortMinutes:He}),isDark:U,locale:f,disabled:re,isBlurred:Se,lens:O,hourlyRate:We(D)})}case "scheduleVariance":{let re=D.effortMinutes||0,Se=D.soldEffortMinutes||0,He=D.timeLoggedMinutes||0,qe=re>0||Se>0||He>0;return jsx(u0,{startDate:D.startDate,endDate:D.endDate,scheduleVariance:D.scheduleVariance,isDark:U,locale:f,hasTimeAllocated:qe})}case "hoursBar":{if(Le&&D.hasChildren){let{spent:re,allocated:Se,quoted:He}=Ds(D),qe=re>Se&&Se>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",U?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",qe?"text-[#FF453A]":U?"text-white/80":"text-gray-800"),children:Ns(re)}),Se>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-white/60":"text-gray-600",children:Ns(Se)})]}),He>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-amber-400/70":"text-amber-600",children:Ns(He)})]})]})}return jsx(m0,{task:D,isDark:U,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:O,hourlyRate:We(D)})}case "teamLoad":return D.hasChildren||D.subtasks&&D.subtasks.length>0?jsx(f0,{task:D,isDark:U,locale:f}):jsx(Ml,{value:D.assignees||[],availableUsers:l,onChange:Se=>{a.onTaskUpdate?.({...D,assignees:Se});},isDark:U,locale:f});case "blockers":return jsx(h0,{blockers:D.blockers,isDark:U,locale:f});case "weight":{let re=Pe.get(D.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?U?"text-white/50":"text-gray-400":U?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let Se=D.weight||0;return jsx(dC,{value:Se,onChange:He=>Y({weight:He}),isDark:U})}default:return jsx("span",{className:g("text-sm",U?"text-white/60":"text-gray-500"),children:"-"})}},[a,U,f,l,ve,Le,Pe]),Qn=useCallback(D=>{let Y={name:ve.columns.name,status:ve.columns.status,priority:ve.columns.priority,assignees:ve.columns.assignees,startDate:ve.columns.startDate,endDate:ve.columns.endDate,progress:ve.columns.progress,tags:ve.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:ve.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:ve.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:ve.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:ve.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:ve.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:ve.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:ve.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:ve.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:ve.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ve.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ve.columns.weight||(f==="es"?"Peso":"Weight")}[D.type]||D.label;return typeof Y=="string"?Y:String(Y||D.type)},[ve,f]),or=useMemo(()=>{let Y=Vt.reduce((ye,ze)=>ye+ze.width,0)+(k?48:0),de={};for(let ye of Vt)de[ye.id]=`${ye.width/Y*100}%`;return de},[Vt,k]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:[ve.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:ve.empty.noTasks}),jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:ve.empty.addFirstTask})]})}):jsxs("div",{ref:nt,className:g(U?"bg-[#0D0D0D]":"bg-white",ee&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let D=!!t.toolbarContainer,X=jsx("div",{className:D?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",U?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:D?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",U?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let Y=As.filter(ze=>(ze.subtasks?.length??0)>0).length,de=As.length-Y,ye=f==="es";return jsxs(Fragment,{children:[de," ",ve.pagination.tasks,Y>0&&jsxs(Fragment,{children:[" \xB7 ",Y," ",ye?Y===1?"tarea padre":"tareas padre":Y===1?"parent task":"parent tasks"]})]})})()}),h&&!D&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",U?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:vt,onChange:Y=>ot(Y.target.value),placeholder:ve.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",U?"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")})]}),!D&&jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&B>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:he,onClick:()=>j(!pt),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",U?pt?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":pt?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),se==="all"?f==="es"?"Todos":"All":`L${se}`]}),pt&&jsx("div",{ref:ae,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",U?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(Y,de)=>({value:de+1,label:`L${de+1}`}))].map(Y=>jsxs("button",{onClick:()=>{fe(Y.value),j(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",U?se===Y.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":se===Y.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:Y.label}),se===Y.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(Y.value)))})]}),t.showStatusFilter!==false&&jsx(W0,{value:Te,hideCompleted:wt,onChange:mt,onHideCompletedChange:je,isDark:U,locale:f}),Ue?.enabled&&Ue.data&&!Fe&&jsx("button",{onClick:()=>Be(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",U?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,C&&N&&!D&&jsxs(motion.button,{onClick:N,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:ve.toolbar.newTask})]})]})});return D?createPortal(X,t.toolbarContainer):X})(),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",U?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(D=>{let X=D.id!=="name",Y=gt===D.id&&be!==D.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",U?"text-white/60":"text-gray-500",X&&"cursor-grab",D.type!=="name"&&"justify-center",be===D.id&&"opacity-50",Y&&(U?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:or[D.id],minWidth:D.minWidth},draggable:X,onDragStart:X?de=>Xn(de,D.id):void 0,onDragEnd:X?Ci:void 0,onDragOver:X?de=>Yo(de,D.id):void 0,onDragLeave:X?Ti:void 0,onDrop:X?de=>_a(de,D.id):void 0,onContextMenu:de=>Rn(de,void 0,D.id),children:[X&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",U?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:de=>{let ye=de.currentTarget.getBoundingClientRect();u(D.id,ye);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Qn(D),p?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Ve===D.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):D.sortable?jsxs("button",{draggable:false,onClick:()=>yr(D.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Qn(D),p?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ve===D.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Qn(D),p?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&D.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:de=>Yn(de,D.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",ee===D.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},D.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:D=>{D.stopPropagation(),ke(X=>!X);},className:g("p-0.5 rounded transition-colors",U?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",J&&(U?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(I0,{isOpen:J,onClose:()=>ke(false),columns:ut,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Tr,onCreateCustomField:()=>{ke(false),q(true);},isDark:U,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[kn.map((D,X)=>Si(X,(()=>{let Y=Ut.has(D.id),de=Math.min(X*.01,.2),ye=D.hasChildren&&D.level===0,ze=D.subtasks?.length||0;if(ye){let{spent:it,allocated:ft,quoted:ia}=Ds(D),jt=cC(D);return jsxs(motion.div,{"data-task-id":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:de},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",U?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",rt===D.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(D),children:[Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(ga=>jsx("div",{className:g("flex items-center px-4",$?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ga.type!=="name"&&"justify-center"),style:{width:or[ga.id],minWidth:ga.minWidth},children:ga.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Wt=>{Wt.stopPropagation(),nr(D.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Y?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Wt=>{Wt.stopPropagation(),nr(D.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Y?jsx(FolderOpen,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}})}),D.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:U?"#FFD60A":"#B45309"},children:D.wbsCode}),jsxs("div",{className:g("flex min-w-0",$?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",$&&"truncate",U?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:D.name}),jsxs("span",{className:g($?"text-[12px] flex-shrink-0":"text-[10px] font-mono",U?"text-white/30":"text-gray-500"),children:["(",ze," ",f==="es"?ze===1?"Tarea":"Tareas":ze===1?"Item":"Items",")"]}),jt!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",jt>=1?"text-[#32D74B] bg-[#32D74B]/10":jt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",jt.toFixed(2)]})]})]}):ga.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Wt=D.executedDollarsCanonical,Jt=Wt!=null?Math.round(Wt):Math.round(oe(D).dollarSpent);return Jt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("en-US")]}):null})():jsx($r,{value:it>0?it:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:We(D)}):ga.type==="soldEffortMinutes"?O==="financial"?(()=>{let Wt=oe(D),Jt=Math.round(Wt.dollarQuoted);return Jt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("en-US")]}):null})():jsx($r,{value:ia>0?ia:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:We(D)}):ga.type==="effortMinutes"?O==="financial"?(()=>{let Wt=oe(D),Jt=Math.round(Wt.dollarAllocated),Et=Math.round(Wt.dollarQuoted),At=Et-Jt;return jsxs("div",{className:"flex flex-col",children:[Jt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("es-CO")]}):null,At!==0&&Jt>0&&Et>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`]})]})})():jsx($r,{value:ft>0?ft:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:We(D)}):Vr(D,ga)},ga.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)}let re=me===D.id,Se=$e===D.id,He=Se&&st==="above",qe=Se&&st==="below",Pt=Se&&st==="child";return jsxs(motion.div,{"data-task-id":D.id,"data-listview-row":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:de},className:g("flex items-center border-b transition-colors relative group",U?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",rt===D.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:Pt?U?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Pt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),onContextMenu:it=>Rn(it,D),onMouseEnter:()=>ja(D.id),onMouseLeave:()=>ja(it=>it===D.id?null:it),children:[He&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),qe&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Lt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:it=>Ze(D.id,it),style:{color:U?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Vt.map(it=>{let ft=!!(D.subtasks&&D.subtasks.length>0),ia=ma(it),ga=!!ia&&!ft&&Ht===D.id&&!Bt,Wt=!!Bt&&!!ia&&hr(Bt.column,ia)&&Lr(D.id);return jsx("div",{className:g("flex items-center px-4",$?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",it.type!=="name"&&"justify-center"),style:{width:or[it.id],minWidth:it.minWidth,position:"relative",backgroundColor:Wt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Wt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:it.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&D.level>0&&jsx("div",{style:{width:`${D.level*24}px`},className:"flex-shrink-0"}),b&&D.hasChildren&&jsx("button",{onClick:Jt=>{Jt.stopPropagation(),nr(D.id);},className:g("p-0.5 rounded flex-shrink-0",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Y?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")})}),b&&!D.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",$?"flex-row items-center gap-2":"flex-col"),children:[(D.wbsCode||D.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[D.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),children:D.wbsCode}),D.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g($?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",U?"text-white/40":"text-gray-400"),style:$&&!U?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:D.taskCode})]}),jsx("span",{className:g("truncate",D.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",D.progress===100?t.completedStyle==="dim"?U?"text-white/45":"text-gray-400":U?"line-through text-white/50":"line-through text-gray-400":D.hasChildren?U?"text-white":"text-gray-900":U?"text-[#D1D5DB]":"text-gray-600"),children:D.name}),D.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",$&&"flex-shrink-0"),style:{backgroundColor:`${D.tags[0].color}20`,color:D.tags[0].color},children:D.tags[0].name})]})]}):ga&&ia?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[Vr(D,it),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Jt=>ka(Jt,D.id,ia,X),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):Vr(D,it)},it.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)})())),Si(kn.length,null)]}),G&&kn.length>0&&(()=>{let{spent:D,allocated:X,quoted:Y}=Z,de=X-D,ye=de<0,ze=ye?`+${Ns(Math.abs(de))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Ns(de)} ${f==="es"?"AHORRADO":"SAVED"}`,re=O==="financial"&&Q>0,Se=Ne?.breakdown,He=!!Se&&((Se.equipment??0)>0||(Se.travel??0)>0),qe=Se?.laborSpent!=null?Se.laborSpent:Ne?.spent!=null?Ne.spent:Z.dollarSpent,Pt=Se?.laborAllocated!=null?Se.laborAllocated:Ne?.allocated!=null?Ne.allocated:Z.dollarAllocated,it=Ne?.quoted!=null?Ne.quoted:Z.dollarQuoted,ft=(Wt,Jt)=>{if(re){let Et=Jt??Wt/60*Q;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Ns(Wt)},ia=re?Math.abs(Pt-qe):0,jt=re?`+$${ia.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${ye?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:ze,ga=re&&He?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",U?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:U?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(Wt=>jsx("div",{className:g("flex items-center px-4 py-3",Wt.type!=="name"&&"justify-center"),style:{width:or[Wt.id],minWidth:Wt.minWidth},children:Wt.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),ga&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",U?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),ga]})]}):Wt.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(D,re?qe:void 0)}),jsx("span",{className:g("text-[11px]",U?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",U?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(X,re?Pt:void 0)})]}),X>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ye?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?jt:ze})]}):Wt.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?ft(Y,re?it:void 0):"\u2013"}):Wt.type==="effortMinutes"?(()=>{if(re&&Y>0&&X>0){let Jt=Math.round(it),Et=Math.round(Pt),At=Jt-Et,Aa=Jt>0?Math.round(At/Jt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(X,Pt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>=0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Aa,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?ft(X,re?Pt:void 0):"\u2013"})})():Wt.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:D>0?ft(D,re?qe:void 0):"\u2013"}):Wt.type==="progress"?(()=>{let Jt=q0(nu(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Jt,"%"]})})():Wt.type==="weight"?(()=>{let Jt=e||[],Et=[],At=mr=>{for(let Ka of mr)Et.push(Ka),Ka.subtasks?.length&&At(Ka.subtasks);};At(Jt);let sr=Et.filter(mr=>!mr.subtasks?.length||mr.subtasks.length===0).reduce((mr,Ka)=>mr+(Ka.weight||0),0),Nr=Math.abs(sr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Nr?U?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(sr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",U?"text-white/30":"text-gray-300"),children:"\u2013"})},Wt.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),kn.length===0&&vt&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",U?"text-white/30":"text-gray-400")}),jsx("p",{className:g(U?"text-white/60":"text-gray-600"),children:ve.empty.noResults})]})})]})}),Ue?.enabled&&Ue.data&&Fe&&jsx(G0,{data:Ue.data,isDark:U,locale:f,onClose:()=>Be(false),lens:t?.lens,onUnassignedTaskClick:D=>{let X=document.querySelector(`[data-task-id="${D}"]`);X&&(X.scrollIntoView({behavior:"smooth",block:"center"}),le(D),setTimeout(()=>le(null),2e3));}})]}),jsx(T0,{state:we,onClose:Gr,isDark:U,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ta,onColumnSort:qo,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),ce&&kt&&me&&createPortal(jsx("div",{style:{position:"fixed",left:kt.x+12,top:kt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let X=Ee.flattenTasks(e).find(Y=>Y.id===me);return X?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:U?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${U?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:U?"#e6edf3":"#111827"},children:X.name})]}):null})()}),document.body),jsx($0,{isOpen:R,onClose:()=>q(false),onSave:Ps,isDark:U,locale:f})]})}var J0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],Q0=[{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"}],Z0=[{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 ou={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},su={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},iu={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"},Wl={dark:ou,light:su,neutral:iu};function ef(e){return Wl[e]||Wl.dark}function zl(e,t,a,r,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],u=[],p={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var uC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],pC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function tf(e){return e==="es"?uC:pC}function af(e){return (e.getDay()+6)%7}function rf(e,t){let a=new Date(e,t,1),r=af(a),n=new Date(e,t,1-r),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(n);return d.setDate(n.getDate()+(p-1)),d},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(a),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function gi(e,t){return af(e.serialToDate(t))>=5}function mC(e){let t=[],a=(r,n,s)=>{for(let o of r){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&a(o.subtasks,l,c);}};return a(e,"",""),t}function nf(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function of(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Gl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=mC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=nf(u.startDate),f=nf(u.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),h=a.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?of(x):of(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?bC(k.name):void 0),I=u.displayId||u.wbsCode||"",C=fC(I||u.id)?"":I||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var gC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fC(e){return gC.test(e)||/^task-\d+/.test(e)}function bC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var hC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],yC=["January","February","March","April","May","June","July","August","September","October","November","December"];function sf(e,t,a){return `${(a==="es"?hC:yC)[t]} ${e}`}var lu=26,xC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Vl({locale:e}){let t=tf(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function jl({bar:e,ws:t,money:a,projColor:r,slotH:n=lu}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=a==="$"?s.cost:`${s.hrs}h`,u={"--proj":e.color??s.color??r,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:u,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function _l({chip:e,ws:t,slotH:a=lu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:xC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Kl({more:e,ws:t,slotH:a=lu,onClick:r}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:"cal-more",style:s,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," m\xE1s"]})}function lf({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var CC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function cu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=CC.filter(p=>!c.includes(p.id));return l?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:u.map(p=>jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${i?p.en:p.es} (${p.key})`,children:i?p.en:p.es},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]}):jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:u.map(p=>jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[i?p.en:p.es,jsx("span",{className:"key",children:p.key})]},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function cf({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),h=u==="es";useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,p,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var TC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function df({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:TC.map(r=>{let n=a.includes(r.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:r.nm}),jsx("div",{className:"sub",children:r.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var EC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},MC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function pf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let l=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let i=a.length+t.length,p=r||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${i} ${l?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:MC[d.type]},children:EC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var uf={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function mf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r}){let n=uf[a]||uf.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function ff(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function LC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var gf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function AC(e){return gf[e%gf.length]}function IC(e){return e>1?"over":e>=.9?"warn":"ok"}var du="\xA0";function zo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function bf(e,t,a){let r=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(ff(l.date));if(n.size===0)return r;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:AC(c),initials:LC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:a}}),u=i.reduce((p,d)=>p+d.hours,0);r.set(l,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:i});}return r}function hf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=ff(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,p="cal-cap-cell "+(o?"off":IC(i))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:p,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${du}/${du}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[zo(l.assigned),"h"]}),jsxs("span",{children:["/",du,zo(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function yf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let i=p=>{p.key==="Escape"&&a();},u=p=>{n.current&&!n.current.contains(p.target)&&a();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...r},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[zo(s),"h asignadas / ",zo(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",zo(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[zo(i.hours),"h / ",zo(i.capacity),"h"]})]},i.name)})})]})}var uu=28,BC=182;function vf({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=l==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx($C,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),c&&c[v]?jsx(hf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function $C({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=useMemo(()=>zl(r,n,t,a),[r,n,t,a]),p=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${BC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return gi(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(jl,{bar:f,ws:t,money:s,projColor:o,slotH:uu})},`b${v}`)),u.chips.map((f,v)=>jsx(_l,{chip:f,ws:t,slotH:uu},`c${v}`)),u.more.map((f,v)=>jsx(Kl,{more:f,ws:t,slotH:uu,onClick:()=>i(f.day,f.items,r.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var OC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function HC(e){return OC.test(e)||/^task-\d+/.test(e)}function UC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function wf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function WC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function kf(e,t){let a=WC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?wf(l):wf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?UC(i.name):void 0),p=n.displayId||n.wbsCode||"",d=HC(p||n.id)?"":p||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return r}function Cf({items:e,onItemClick:t,onCollapse:a,money:r,projColor:n,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(l=>{let c=r==="$"?l.cost:`${l.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxs("div",{className:"row1",children:[l.id?jsx("span",{className:"tk",children:l.id}):null,jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsx("div",{className:"nom",children:l.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsx("span",{children:c}),l.who?jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function Tf({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function Es(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Nf({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=a.wasCritical,p=a.projectEndDeltaDays,d=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Es(a.oldProjectEnd,n)} \u2192 ${Es(a.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Es(a.oldStart,n)," \u2013 ",Es(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[Es(a.newStart,n)," \u2013 ",Es(a.newEnd,n)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?i?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:p>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?i?"Sigue en CPM":"Stays critical":a.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var jC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Df({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let u=p=>p.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(p=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>l?.(d.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:d.color??n,flex:"none"}}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:r==="$"?d.cost:`${d.hrs}h`})]},d.uid)),p.items.map((d,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:jC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function _C(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ql(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function pu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Sf(e,t){let a=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of e)for(let u of ql(i))r.has(u)||r.set(u,[]),r.get(u).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let u=a.get(i);if(!u)return o.delete(i),0;let p=ql(u).filter(f=>a.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=pu(u)*864e5;return n.set(i,d),s.set(i,d+m),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function Ef(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of ql(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,a);else {let u=1/0;for(let p of i){let d=s.get(p),m=r.get(p);d!=null&&m&&(u=Math.min(u,d-pu(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&ql(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Yl(e,t,a,r){let n=_C(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=Sf(n,new Map),i=Ef(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:a,endDate:r}:b),p=Sf(u,new Map([[t,a.getTime()]])),d=Ef(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=pu(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function Mf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var XC=132,Xl=26,JC="#5B7FD4";function Pf({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=useState("mes"),[I,C]=useState(()=>{let ce=new Date,ue={y:ce.getFullYear(),m:ce.getMonth()},$e=(e??[]).map(Ye=>Ye.startDate?new Date(Ye.startDate):null).filter(Ye=>!!Ye&&!isNaN(Ye.getTime()));if($e.length===0||(e??[]).some(Ye=>{let kt=Ye.startDate?new Date(Ye.startDate):null,qt=Ye.endDate?new Date(Ye.endDate):kt;if(!kt||isNaN(kt.getTime()))return false;let za=new Date(ue.y,ue.m,1),pa=new Date(ue.y,ue.m+1,0,23,59,59);return kt<=pa&&(qt??kt)>=za}))return ue;let st=$e.reduce((Ye,kt)=>Ye<kt?Ye:kt);return {y:st.getFullYear(),m:st.getMonth()}}),[N,P]=useState(false),[T,V]=useState([]),[O,Q]=useState("all"),[L,Le]=useState(null),[G,Ne]=useState(null),[$,ve]=useState(false),[U,We]=useState(null),[oe,Re]=useState(false),Z=useMemo(()=>rf(I.y,I.m),[I.y,I.m]),Pe=r||JC,Ue=useMemo(()=>{let ce=new Set;for(let ue of y){let $e=new Date(`${ue}T12:00:00`),ct=Z.dateToSerial($e);ct>=1&&ct<=42&&ce.add(ct);}return ce},[y,Z]);useEffect(()=>{w?.({start:Mf(Z.serialToDate(1)),end:Mf(Z.serialToDate(42))});},[I.y,I.m]);let Fe=b.length,Be=useMemo(()=>{let ce=x?.hoursPerDay;if(!ce)return 8;let ue=[ce.monday,ce.tuesday,ce.wednesday,ce.thursday,ce.friday].map($e=>$e||0).filter($e=>$e>0);return ue.length?Math.round(ue.reduce(($e,ct)=>$e+ct,0)/ue.length*10)/10:8},[x]),rt=useMemo(()=>Gl({tasks:e,grid:Z,projectColor:()=>Pe,hourlyRate:o,projectId:a}),[e,Z,Pe,o,a]),le=useMemo(()=>{if(d===false)return [];let ce=new Map;for(let ue of rt.calTasks)ue.phaseId&&ue.phaseName&&ce.set(ue.phaseId,ue.phaseName);return [...ce.entries()].map(([ue,$e])=>({id:ue,name:$e})).sort((ue,$e)=>ue.name.localeCompare($e.name))},[rt.calTasks,d]),Ve=!T.includes("tareas"),Qe=!T.includes("cpm"),Ie=useMemo(()=>{let ce=Ve?rt.calTasks:[];return O!=="all"&&(ce=ce.filter(ue=>ue.phaseId===O)),Qe||(ce=ce.map(ue=>ue.critical?{...ue,critical:false}:ue)),ce},[rt.calTasks,Ve,Qe,O]),ht=useMemo(()=>{let ce=new Set;return T.includes("hitos")&&(ce.add("hito"),ce.add("desembolso")),T.includes("ext")&&ce.add("ext"),T.includes("aus")&&ce.add("aus"),rt.dayItems.filter(ue=>!ce.has(ue.type))},[rt.dayItems,T]),vt=!T.includes("festivos"),ot=new Date,Te=Z.dateToSerial(new Date(ot.getFullYear(),ot.getMonth(),ot.getDate())),mt=ce=>V(ue=>ue.includes(ce)?ue.filter($e=>$e!==ce):[...ue,ce]),wt=()=>C(ce=>{let ue=new Date(ce.y,ce.m-1,1);return {y:ue.getFullYear(),m:ue.getMonth()}}),je=()=>C(ce=>{let ue=new Date(ce.y,ce.m+1,1);return {y:ue.getFullYear(),m:ue.getMonth()}}),ut=()=>{let ce=new Date;C({y:ce.getFullYear(),m:ce.getMonth()});},A=(ce,ue,$e)=>{if(!v||ue===0)return;let ct=rt.calTasks.find(za=>za.uid===ce);if(!ct)return;let st=ue*864e5,Ye=new Date(ct.realStart.getTime()+st),kt=new Date(ct.realEnd.getTime()+st),qt=Yl(e,ce,Ye,kt);qt&&We({uid:ce,taskId:ct.id,taskName:ct.name,sim:qt,anchor:$e});},J=async()=>{if(!U||!h)return;Re(true);let ce=[{id:U.uid,startDate:U.sim.newStart,endDate:U.sim.newEnd},...U.sim.movedSuccessors.map($e=>({id:$e.id,startDate:$e.newStart,endDate:$e.newEnd}))],ue=await h(ce);Re(false),ue&&We(null);},ke=sf(I.y,I.m,n),R=[{id:"",name:t,color:Pe}],q=useMemo(()=>kf(e,o),[e,o]),we=useMemo(()=>{if(k==="lookahead"){let ce=Z.weeks.find($e=>Te>=$e.ws&&Te<=$e.we)??Z.weeks[0],ue=Z.weeks.indexOf(ce);return Z.weeks.slice(ue,ue+2)}return k==="semana"?[Z.weeks.find(ue=>Te>=ue.ws&&Te<=ue.we)??Z.weeks[0]]:[]},[k,Z.weeks,Te]),Oe=useMemo(()=>{let ce={};return we.forEach((ue,$e)=>{let ct=[];for(let Ye=ue.ws;Ye<=ue.we;Ye++)ct.push({serial:Ye,date:Z.serialToDate(Ye),isWeekend:gi(Z,Ye),isHoliday:Ue.has(Ye)});let st=bf(b,ct,Be);ce[$e]={days:ct,capByDay:st};}),ce},[we,Z,Ue,b,Be]),me=k==="semana"||k==="lookahead",et=k==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(cu,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ce=>c(ce==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsx(cu,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ce=>c(ce==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsx(cf,{monthLabel:ke,onPrev:wt,onNext:je,onToday:ut,layersOpen:N,onToggleLayers:()=>P(ce=>!ce),layersOff:T,phases:le,phaseFilter:O,onPhaseChange:Q,locale:n,children:N?jsx(df,{off:T,onToggle:mt}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:et?"hidden":void 0},children:[et?jsx(Df,{grid:Z,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,locale:n,onTaskOpen:i}):me?jsxs(Fragment,{children:[jsx(Vl,{locale:n}),jsx(vf,{grid:Z,weeks:we,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,locale:n,capRows:Oe,teamSize:Fe,onTaskOpen:i,onMore:(ce,ue,$e)=>Le({day:ce,items:ue,tasks:$e}),onCapDay:(ce,ue,$e)=>{for(let ct of Object.keys(Oe)){let st=Oe[+ct].capByDay.get(ce);if(st){Ne({dayLabel:ue,perPerson:st.perPerson,anchor:$e.getBoundingClientRect()});break}}}})]}):rt.isEmpty?jsxs(Fragment,{children:[jsx(Vl,{locale:n}),jsx("div",{className:"cal-weeks",children:Z.weeks.map(ce=>jsx(Ff,{grid:Z,ws:ce.ws,we:ce.we,todaySerial:Te,showFestivos:vt,holidaySerials:Ue,locale:n,deadlineDays:new Set},ce.ws))}),jsx(mf,{monthLabel:ke,locale:n,onCreateTask:f})]}):jsxs(Fragment,{children:[jsx(Vl,{locale:n}),jsx("div",{className:"cal-weeks",children:Z.weeks.map(ce=>jsx(QC,{grid:Z,ws:ce.ws,we:ce.we,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,showFestivos:vt,holidaySerials:Ue,locale:n,onTaskOpen:i,onMore:(ue,$e,ct)=>Le({day:ue,items:$e,tasks:ct}),canReschedule:v,onDragReschedule:A,pendingGhost:U?{uid:U.uid,days:Math.round((U.sim.newStart.getTime()-U.sim.oldStart.getTime())/864e5)}:null},ce.ws))})]}),L?jsx(pf,{dayLabel:`${Z.serialToDate(L.day).getDate()}`,items:L.items,tasks:L.tasks.map(ce=>({swatch:Pe,taskId:ce.id,label:ce.name,critical:ce.critical,value:l==="$"?ce.cost:`${ce.hrs}h`})),onClose:()=>Le(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,G?jsx(yf,{dayLabel:G.dayLabel,perPerson:G.perPerson,onClose:()=>Ne(null),style:{position:"fixed",top:`${G.anchor.top-8}px`,left:`${G.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,U?jsx(Nf,{taskName:U.taskName,taskId:U.sim.taskId,sim:U.sim,busy:oe,locale:n,onConfirm:J,onCancel:()=>We(null),style:{position:"fixed",top:`${U.anchor.top+12}px`,left:`${Math.min(U.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),$?jsx(Cf,{items:q,money:l,projColor:Pe,onItemClick:ce=>i?.(ce),onCollapse:()=>ve(false),locale:n==="en"?"en":"es"}):jsx(Tf,{onExpand:()=>ve(true),locale:n==="en"?"en":"es"})]}),jsx(lf,{projects:R,locale:n==="en"?"en":"es"})]})}function Ff({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=a;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return gi(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function QC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=useMemo(()=>zl(r,n,t,a),[r,n,t,a]),b=useMemo(()=>new Set(n.filter(I=>I.type==="deadline").map(I=>I.serial)),[n]),y=Math.max(XC,h.laneCount*Xl+36),x=useRef(null),[w,k]=useState(null),M=(I,C)=>{if(!m||!f){p?.(C);return}I.preventDefault();let N=x.current;if(!N)return;let P=N.getBoundingClientRect().width/7,T=I.clientX,V=0,O=L=>{let Le=Math.round((L.clientX-T)/P);V=Le,k({id:C,days:Le});},Q=L=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",Q),k(null),V===0){p?.(C);return}let Le=new DOMRect(L.clientX,L.clientY,0,0);f(C,V,Le);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",Q);};return jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(Ff,{grid:e,ws:t,we:a,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((I,C)=>{let N=w?.id===I.t.uid?w.days:null,P=v?.uid===I.t.uid?v.days:null,T=N??P??0,V=N==null&&P!=null,O=T!==0?{...I,s:I.s+T,e:I.e+T}:I;return jsx("div",{onPointerDown:Q=>M(Q,I.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(jl,{bar:O,ws:t,money:s,projColor:o,slotH:Xl})},`b${C}`)}),h.chips.map((I,C)=>jsx(_l,{chip:I,ws:t,slotH:Xl},`c${C}`)),h.more.map((I,C)=>jsx(Kl,{more:I,ws:t,slotH:Xl,onClick:()=>d(I.day,I.items,r.filter(N=>N.startSerial<=I.day&&N.endSerial>=I.day))},`m${C}`))]})]})}function e2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=useState(false),u=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=useMemo(()=>{let m=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:p.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:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var Af={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function bi(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 hi(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 If(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Rf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...Af,...o}),[o]),[i,u]=useState(new Set),p=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{u(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),I=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:I<7?`${I}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[hi(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,children:d.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((x,w)=>{let k=i.has(x.id),M=s===x.id,I=If(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:hi(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:bi(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,N])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},C)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([C,N])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function $f({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],p=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&hi(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&bi(p)}),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:p&&p.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:m=>l(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:bi(m)},m.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),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:p&&p.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function gu(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function fu(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 Of(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 Hf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function s2(e,t,a,r,n,s=100){let o=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})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(u=>{let p=a/2,d=r/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function Uf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=s2(e,t,a.width,a.height,a,150);p(O);},[e,t,a]);let M=useCallback((O,Q)=>{a.enableDragging&&(Q.stopPropagation(),m(O));},[a.enableDragging]),I=useCallback(O=>{if(!d||!i.current)return;let L=i.current.getBoundingClientRect(),Le=(O.clientX-L.left-w.x)/y,G=(O.clientY-L.top-w.y)/y;p(Ne=>Ne.map($=>$.id===d?{...$,x:Le,y:G,fx:Le,fy:G}:$));},[d,y,w]),C=useCallback(()=>{m(null);},[]),N=useCallback((O,Q)=>{Q.stopPropagation(),l?.({type:"node-click",node:O,position:{x:Q.clientX,y:Q.clientY}});},[l]),P=useCallback((O,Q)=>{Q.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:Q.clientX,y:Q.clientY}});},[l]),T=useCallback(O=>{let Q=u.find(L=>L.id===O);return Q?{x:Q.x,y:Q.y}:{x:0,y:0}},[u]),V=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Q=O.card.priority;return Q==="URGENT"?"#ef4444":Q==="HIGH"?"#f59e0b":Q==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:g("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:gu(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Of(O)," ",fu(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let Q=T(typeof O.source=="string"?O.source:O.source.id),L=T(typeof O.target=="string"?O.target:O.target.id),Le=Hf(O.type),G=h===O.id,Ne=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",G&&"hovered",Ne&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:$=>P(O,$),children:[jsx("line",{x1:Q.x,y1:Q.y,x2:L.x,y2:L.y,stroke:gu(O.type),strokeWidth:Ne?a.edgeWidth*2:a.edgeWidth,strokeOpacity:G?1:.6,markerEnd:Le?"url(#arrowhead)":void 0}),a.showEdgeLabels&&G&&jsx("text",{x:(Q.x+L.x)/2,y:(Q.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:fu(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let Q=f===O.id,L=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",Q&&"hovered",L&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Le=>M(O.id,Le),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Le=>N(O,Le),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:V(O),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:Q?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 Gf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=l||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(a(p),v());};return e?jsxs(ca,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:v,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?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!"})]}),p.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},x)),p.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,value:s,onChange:y=>o(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,x)=>jsx("button",{onClick:()=>o(y),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:v,disabled:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),p?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var bu={"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 l2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},c2={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 d2(e,t,a){let r=bu[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function yi(e){return `$${e.toFixed(4)}`}var hu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=d2(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(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,n=a.reduce((p,d)=>p+d.cost,0),s=a.reduce((p,d)=>p+d.inputTokens,0),o=a.reduce((p,d)=>p+d.outputTokens,0),l=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),i={},u={};return a.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Vo=new hu;function _f({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Vo.getStats()),[s,o]=useState(Vo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Vo.getStats()),o(Vo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=Vo.getRecentOperations(5);return jsxs(ca,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",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:yi(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-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,p=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:yi(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:yi(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 Yf({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(null),w=useRef(null),k=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=T=>{T.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},I=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(a(h),M());};if(!e)return null;let N=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ca,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",N,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,T)=>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:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:P=>p(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,T)=>jsx("button",{onClick:()=>l(P),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},T))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:C,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:I,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Zl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(h=>{t&&Ai(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{r(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},I=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===b){let T=I.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:T.map(V=>V.id)}}return P}),N={...x,cards:I,columns:C};return n(N),N});},[n]),o=useCallback(async(h,b)=>{r(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{r(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(I=>I!==h)}:M),k={...b,cards:x,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=useCallback(async(h,b)=>{r(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=useCallback(async h=>{r(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Jf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=Zl({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var xi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Zf={by:"none",order:"asc"};function eb({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...xi,...e}),[s,o]=useState({...Zf,...t}),l=useCallback(v=>{n(h=>({...h,...v}));},[]),c=useCallback(v=>{o(h=>({...h,...v}));},[]),i=useCallback(()=>{n(xi),o(Zf);},[]),u=useCallback(()=>{a&&n({...xi,assignees:[a]});},[a]),p=useCallback(()=>{n({...xi,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...xi,priorities:["HIGH","URGENT"]});},[]),m=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]),f=useCallback(v=>{let h=[...v];if(r.search){let b=r.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let I=M.endDate||M.dueDate;if(!I)return false;let C;if(typeof I=="string")C=I.split("T")[0]||I;else {let N=I.getUTCFullYear(),P=String(I.getUTCMonth()+1).padStart(2,"0"),T=String(I.getUTCDate()).padStart(2,"0");C=`${N}-${P}-${T}`;}switch(r.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let N=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),T=new Date(N);return T.setDate(T.getDate()+7),P>=N&&P<=T;case "custom":if(r.dateRange){let V=typeof I=="string"?new Date(I):I;return V>=r.dateRange.start&&V<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let x=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=I-C;break;case "dueDate":let N=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!N)return 1;if(!P)return -1;let T=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,Q=y.estimatedTime||0;x=O-Q;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var ab,rb;if(typeof window<"u")try{let e=Pi("ai");ab=e.generateObject,rb=e.generateText;}catch{}function nb(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(ab&&rb&&e.apiKey),o=useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",p),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{a(false);}},[s]),l=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{a(false);}},[s]),c=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{a(false);}},[s]),i=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),u=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function xu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function ob(e){let{cards:t}=e,[a,r]=xu(),n=useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=useCallback((p,d)=>{if(!d){r({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,N)=>C.position-N.position),y=b.findIndex(C=>C.id===a.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),I=Array.from(new Set([...a.selectedCardIds,...M]));r({selectedCardIds:I,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),o=useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(p=>{a.selectedCardIds.includes(p)?o(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,o,r]),u=useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var sb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function ib(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...sb,...a}),[a]),[s,o]=useState([]),l=useCallback((v,h,b,y,x)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=useCallback(async v=>{let h=t.filter(k=>k.columnId===v);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${I} ${M} Priority`,cardIds:k.map(C=>C.id),columnId:v,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let k of h){let I=(await r.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(I.length>=n.minCardsPerStack-1){let C=[k.id,...I.map(P=>P.card.id)],N=I.reduce((P,T)=>P+T.similarity,0)/I.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:N});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var lb=createContext(null);function cb({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=Pi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Pi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Pi("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(lb.Provider,{value:{store:n},children:e})}function ec(){let e=useContext(lb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function wi(){let e=ec(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),p=useCallback(y=>e.getColumn(y),[e]),d=useCallback(y=>{e.addCard(y);},[e]),m=useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),v=useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function ub(e){let{cards:t}=wi();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!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(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function pb(e="position",t="asc"){let{cards:a}=wi();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var tc=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ep.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 n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},S2=new tc;function gb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:d,className:n,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(v,f.index)},h)})})})}function fb(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 hb({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),p=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function yb(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 xb(e,t=10){return e>t}var Cu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Tu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Nu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Du={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Su={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Eu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Mu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Pu={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Fu={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},Lu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Au={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}},Iu={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}},ac={spacing:Cu,borderRadius:Tu,fontSize:Nu,fontWeight:Du,lineHeight:Su,zIndex:Eu,duration:Mu,easing:Pu,shadows:Fu,opacity:Lu,kanban:Au,gantt:Iu};function vb(e,t,a){return e[t]??a}function Ru(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Ru(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function P2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Bu(e="asakaa"){let t=Ru(ac),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=P2(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Mg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Kn(e,t){let a=Mg(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function Rd(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 d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(m!==void 0){let f=new Date(r),v=f.getDay(),h=m-v;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}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 d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function Bd(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),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function $d(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 Pg(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Fg(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),p=Kn(t,i),d=Rd(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),p=Kn(t,i),d=Bd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),p=Kn(t,i),d=$d(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),p=Kn(t,i);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=Kn(t,i),d=Kn(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Kn(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function Lg(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 ek(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 tk(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Pl(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Pl(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),c=o(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:ek(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Ag(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:tk(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Ig(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Pl(r,e,t))}var Od={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Hd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Fl={en:Od,es:Hd};function Ud(e){return Fl[e]||Fl.en}function Ll(e,t){let a=Ud(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 Wd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Rg(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 Bg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Rg(e),i=Wd[0],u=Wd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(Rg(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function vo(e,t,a=320){let[r,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!l&&c);},[t,a,e]),r}var zd=[{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 Og({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null),c=vo(l,s,180);useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=zd.find(p=>p.value===e)??zd[4],u=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.label[u]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.label[u]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:zd.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),o(false);},className:g("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===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function bi(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],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-[#00E5CC]"}function Rl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),p=useRef(null),d=vo(u,o);useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(a){if(f(h.name))a(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:bi(h.name),color:h.color||Gd(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,b]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:g("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((h,b)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Gd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||bi(h.name)},`${h.name}-${b}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:h=>{h.stopPropagation(),l(!o);},className:g("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:g("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("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((h,b)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!h.avatar&&Gd(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||bi(h.name)},`${h.name}-${b}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),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:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color: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((h,b)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||bi(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==h.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${h.name}-${b}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let b=f(h.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{b||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(y.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):bi(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function Vg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=useState(false),[p,d]=useState(n),[m,f]=useState(()=>{let N=n==="start"?e:t;if(N){let V=N instanceof Date?N:new Date(N);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),h=useRef(null),b=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useLayoutEffect(()=>{if(!i){x(null);return}let N=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,J=360,L=window.innerHeight-V.bottom,Le=L<J&&V.top>L,G=Le?V.top-4:V.bottom+4,Ne=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:G,left:Ne,flipUp:Le});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[i]),useEffect(()=>{i&&d(r?n:"start");},[i,r,n]);let M=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",I=useCallback(()=>{let N=m.getFullYear(),V=m.getMonth(),O=new Date(N,V,1),L=new Date(N,V+1,0).getDate(),Le=O.getDay(),G=[],$=new Date(N,V,0).getDate();for(let U=Le-1;U>=0;U--)G.push({date:new Date(N,V-1,$-U),isCurrentMonth:false});for(let U=1;U<=L;U++)G.push({date:new Date(N,V,U),isCurrentMonth:true});let ve=42-G.length;for(let U=1;U<=ve;U++)G.push({date:new Date(N,V+1,U),isCurrentMonth:false});return G},[m]),C=N=>{if(r)n==="start"?a(N,k||void 0):a(w||void 0,N),u(false);else if(p==="start"){let V=k&&N>k?N:k;a(N,V||void 0),d("end");}else {let V=w&&N<w?N:w;a(V||void 0,N),u(false);}},D=()=>{let N=new Date,V=new Date(N);V.setDate(N.getDate()+1);let O=new Date(N);O.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let J=new Date(N);J.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let L=new Date(N);L.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Le=new Date(N);Le.setDate(N.getDate()+14);let G=new Date(N);return G.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:J,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Le,display:Le.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let N=r&&n==="start"?w:k;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(N)})]})}let P=r&&n==="start"?w:k;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,onClick:N=>{N.stopPropagation(),u(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:M(P)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((N,V)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>C(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},V)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,k||void 0):a(w||void 0,void 0):a(void 0,void 0),u(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:p==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:I().map((N,V)=>{let O=N.date.toDateString()===new Date().toDateString(),J=w?.toDateString()===N.date.toDateString(),L=k?.toDateString()===N.date.toDateString(),Le=J||L,G=!r&&w&&k&&N.date>=w&&N.date<=k;return jsx("button",{onClick:()=>C(new Date(N.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",J&&"bg-[#00E5CC] text-white",L&&!J&&"bg-[#7C3AED] text-white",G&&!Le&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Le&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},V)})})]})]}),document.body)]})}function $l({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Vg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function Ss(e=600){let[t,a]=useState(false),r=useRef(null),n=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:n}}function Ol(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=r/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function jg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},a);},[a,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function Kg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=Ss(),{displayValue:m,isAnimating:f}=Ol(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,I=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,I));C!==e&&(t(C),s&&d());},h=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Xg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{l!==e&&t?.(l),o(false);},p=d=>{d.key==="Enter"?u():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("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 Zg({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=Ss(),{displayValue:h,isAnimating:b}=Ol(e,{enabled:l&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);if(!isNaN(w)){let k=w;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&v());}u(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:r}):i?jsx("input",{ref:m,type:"number",value:p,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:g("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"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:r})}function e0({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),c=useRef(null),i=vo(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!a?jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),l(!o);},className:g("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:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(i?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(u),l(false);},className:g("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===u&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:u}),e===u&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function a0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:u}=jg(t,{delay:s}),p=m=>{m.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},d=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:p,disabled:r||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&d&&"ring-green-500/50",l&&!d&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("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 r0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=useState(false),u=useRef(null),p=vo(u,c,220);useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||a(x);},h=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:b=>{b.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(p?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(b=>{let y=e.includes(b),x=!y&&h;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:b}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function Vk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function s0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Vk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return r?jsxs("button",{onClick:c=>{c.stopPropagation(),r(s);},title:n.map(c=>c.name).join(`
|
|
414
|
+
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:l})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),l]})}function c0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=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)),n>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function Kk(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 qk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+c}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Ur({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:u}){let[p,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:h,triggerFlash:b}=Ss(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Kk(e,r);useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),useEffect(()=>{if(e){let C=Math.floor(e/60),D=e%60;C>0&&D>0?f(`${C}h ${D}m`):C>0?f(`${C}h`):f(`${D}m`);}else f("");},[e,p]);let k=()=>{let C=qk(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)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:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("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 I=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(I,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):p?jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.stopPropagation(),d(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",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",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(I,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function m0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color: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:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function f0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=a==="es",u=l==="financial"&&c>0,p=G=>u?`$${Math.round(G*c).toLocaleString("en-US")}`:`${G}h`,[d,m]=useState(false),[f,v]=useState(false),[h,b]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,I=Math.round(w/60*10)/10,C=w>0?x/w*100:0,D=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let G=Ne=>{y.current&&!y.current.contains(Ne.target)&&(v(false),b(null));};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[f,h]);let N=G=>{if(G.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){v(Ne=>!Ne),b(null);return}o&&o(e);},V=G=>{v(false),b(G);},O=async(G,Ne)=>{h==="log"&&r&&G?r(e,G,Ne):h==="estimate"&&n?n(e,G):h==="quoted"&&s&&s(e,G),b(null);},J=r||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(G=>G.show),Le=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:G=>G.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&J&&jsx("button",{onClick:N,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:Ne=>{Ne.stopPropagation(),V(G.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:Ne=>{Ne.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ne=>{Ne.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.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(Sn,{mode:h,locale:a,isDark:t,currentValue:Le||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:G=>G.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let G=x===0,$=(w>0?x/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:G?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(I)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:$?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:$?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(D)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),J&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:Ne=>{Ne.stopPropagation(),V(G.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:Ne=>{Ne.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ne=>{Ne.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.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(Sn,{mode:h,locale:a,isDark:t,currentValue:Le||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function t1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function a1(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 b0({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",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function h0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=t1(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsx(b0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?a1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(b0,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var r1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function x0({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",r1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function y1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function x1(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 D0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=useRef(null),y=r==="es"?k0.es:k0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=b.current;if(!D)return;let P=D.getBoundingClientRect(),N=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-N&&(O=Math.max(N,e.y-P.height)),e.x+P.width>window.innerWidth-N&&(V=Math.max(N,window.innerWidth-P.width-N)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=N=>{b.current&&!b.current.contains(N.target)&&t();},P=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),l&&(D.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],O=N.some(J=>J.name===P.name)?N.filter(J=>J.name!==P.name):[...N,{name:P.name,initials:y1(P.name),color:P.color||x1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&D.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&D.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&D.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&D.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&D.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},M=()=>{if(!e.columnId)return [];let D=[];return i&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),D},I=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:I.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(v1,{item:D,isDark:a},D.id):jsxs("button",{onClick:D.onClick,className:g("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",D.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function v1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var k0={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var I0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},$1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function B0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),h=c==="es"?R0.es:R0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let D=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let J=P.getBoundingClientRect();f({top:J.bottom+4,right:window.innerWidth-J.right});}let N=v.current.getBoundingClientRect(),O=window.innerHeight-N.top-20;d(Math.max(300,O));};return requestAnimationFrame(D),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[e]),useEffect(()=>{if(!e)return;let D=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},N=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",N),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(D),v._cleanup&&v._cleanup();}},[e,t]);let b=useMemo(()=>{let D=new Set([...$1]);return a.forEach(P=>{P.type&&P.type!=="assignees"&&D.add(P.type);}),Array.from(D)},[a]);if(!e)return null;let y=D=>{let P=h.columns[D];if(P)return P;let N=a.find(V=>V.type===D);return N?.label?N.label:D},x=D=>{if(D==="name")return;let P=a.map(N=>N.id===D?{...N,visible:!N.visible}:N);n(P);},w=(D,P)=>{let N=a.find(O=>O.type===D&&(!P||O.customFieldId===P));if(N){x(N.id);return}let V={id:P||D,type:D,label:P?r.find(O=>O.id===P)?.name||D:y(D),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...a,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(D=>D!=="assignees"&&(o||!k.includes(D))&&y(D).toLowerCase().includes(i.toLowerCase())),I=r.filter(D=>D.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",D.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:D=>u(D.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:D=>{D&&D.style.setProperty("--focus-border",C);},onFocus:D=>{D.currentTarget.style.borderColor=C,D.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:D=>{D.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",D.currentTarget.style.background=l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:D=>D.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(D=>{let P=a.find(O=>O.type===D&&!O.customFieldId),N=P?.visible??false,V=D==="name";return jsxs("button",{onClick:()=>{V||(P?x(P.id):w(D));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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:N?C:"transparent",border:N?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${C}40`:"none"},children:N&&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:N?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:I0[D]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:N?500:400,color:N?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(D),children:y(D)})]},D)})})]}),I.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:I.map(D=>{let N=a.find(V=>V.customFieldId===D.id)?.visible??false;return jsxs("button",{onClick:()=>w(D.type,D.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:N?C:"transparent",border:N?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${C}40`:"none"},children:N&&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:N?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:I0[D.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:D.name})]},D.id)})})]})]})]})}var R0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",multiselect:"Multi-select",person:"Person",file:"File",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var _1=[{type:"text",icon: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 H0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,u]=useState([""]),p=n==="es"?O0.es:O0.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(i.filter((b,y)=>y!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("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:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:p.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",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:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:_1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>v(b),className:g("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"})})]},b)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxs("div",{className:g("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:g("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:p.cancel}),jsx("button",{onClick:d,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:p.create})]})]})]}):null}var O0={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 z0={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 G0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?z0.es:z0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",d&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,d&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),r(false),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;r(m),m&&a("all"),l(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function V0(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 To(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function j0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:To(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(I,C)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:To(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:To(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(I,C)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:To(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:To(u)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(v,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[m>=0?"+":"",To(m),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[p>=0?`+${To(p)} ${o?"disponible (caja)":"available (cash)"}`:`${To(Math.abs(p))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:V0(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:V0(i)})]}),i>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(c=>jsxs("button",{onClick:()=>s?.(c.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:c.name})]},c.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${c} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let u=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(c.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${c.name}-${i}`)})})]})]})}var lC=[{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 J0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...J0(n.subtasks,t+1,s));}return r}function cC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,n++;}return n>0?r/n:null}function Ls(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Ls(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Fs(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 dC({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?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 X0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function du(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?du(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function Q0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:I=true,showCreateTaskButton:C=false,onCreateTask:D,persistFilter:P=false,financialBlur:N,healthSidebar:V,lens:O="hours",hourlyRate:J=0,rateMap:L,aggregateParentHours:Le=false,showProjectTotals:G=false,totalsDollarOverride:Ne}=t,$=t.rowDensity==="compact",ve=Ll(f,v),U=m==="dark",ze=T=>{if(!L||!T.assignees||T.assignees.length===0)return J;let Y=0,Z=0;for(let he of T.assignees){let $e=he.id?L[he.id]:void 0;if($e==null||$e<=0)continue;let re=typeof he.estimatedMinutes=="number"?he.estimatedMinutes:0;re>0&&(Y+=$e*re,Z+=re);}if(Z>0)return Y/Z;let le=T.assignees.map(he=>he.id?L[he.id]:void 0).filter(he=>he!=null&&he>0);return le.length===0?J:le.reduce((he,$e)=>he+$e,0)/le.length},oe=T=>{let Y=0,Z=0,le=0,he=$e=>{for(let re of $e)if(re.subtasks&&re.subtasks.length>0){let Se={s:Y,a:Z,q:le};if(he(re.subtasks),Y-Se.s+(Z-Se.a)+(le-Se.q)===0){let Xe=ze(re);Y+=(re.timeLoggedMinutes??0)/60*Xe,Z+=(re.effortMinutes??0)/60*Xe,le+=(re.soldEffortMinutes??0)/60*Xe;}}else {let Se=ze(re);Y+=(re.timeLoggedMinutes??0)/60*Se,Z+=(re.effortMinutes??0)/60*Se,le+=(re.soldEffortMinutes??0)/60*Se;}};return T.subtasks&&he(T.subtasks),{dollarSpent:Y,dollarAllocated:Z,dollarQuoted:le}},Re=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let T=localStorage.getItem(P);if(T){let Y=JSON.parse(T);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(T){console.error("Error loading persisted filter:",T);}return {statusFilter:"all",hideCompleted:false}},[P]),Q=useMemo(()=>{function T(Y){let Z=0,le=0,he=0,$e=0,re=0,Se=0;for(let He of Y)if(He.subtasks&&He.subtasks.length>0){let Xe=T(He.subtasks);if(Xe.spent+Xe.allocated+Xe.quoted>0)Z+=Xe.spent,le+=Xe.allocated,he+=Xe.quoted,$e+=Xe.dollarSpent,re+=Xe.dollarAllocated,Se+=Xe.dollarQuoted;else {let pt=He.timeLoggedMinutes??0,ft=He.effortMinutes??0,Zt=He.soldEffortMinutes??0;Z+=pt,le+=ft,he+=Zt;let jt=ze(He);$e+=pt/60*jt,re+=ft/60*jt,Se+=Zt/60*jt;}}else {let Xe=He.timeLoggedMinutes??0,Pt=He.effortMinutes??0,pt=He.soldEffortMinutes??0;Z+=Xe,le+=Pt,he+=pt;let ft=ze(He);$e+=Xe/60*ft,re+=Pt/60*ft,Se+=pt/60*ft;}return {spent:Z,allocated:le,quoted:he,dollarSpent:$e,dollarAllocated:re,dollarQuoted:Se}}return T(e)},[e]),Pe=useMemo(()=>{let T=new Map;function Y(Z){let le=0;for(let he of Z)if(he.subtasks&&he.subtasks.length>0){let $e=Y(he.subtasks);T.set(he.id,$e),le+=$e;}else le+=he.weight||0;return le}return Y(e),T},[e]),We=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Q.spent,totalHoursAllocatedMinutes:Q.allocated}},[V,Q]),[Fe,Be]=useState(true),[rt,ce]=useState(null),[Ve,Qe]=useState("position"),[Ie,ht]=useState("asc"),[vt,ot]=useState(""),[Te,mt]=useState(()=>Re().statusFilter),[wt,je]=useState(()=>Re().hideCompleted),[dt,A]=useState(y||lC),[X,ke]=useState(false),[R,q]=useState(false),[we,Ue]=useState({isOpen:false,x:0,y:0,type:"task"}),[me,et]=useState(null),[de,ue]=useState(false),[Oe,lt]=useState(null),[st,qe]=useState(null),[kt,Yt]=useState(null),za=useRef(0),ma=useRef(false),Lt=!!(a.onTaskMove||a.onTaskReparent),[Ht,_a]=useState(null),[Bt,pr]=useState(null),ga=T=>{let Y=T.type;return T.customFieldId?Y==="file"?null:{kind:"customField",fieldId:T.customFieldId}:Y==="assignees"||Y==="teamLoad"?"assignees":Y==="startDate"?"startDate":Y==="endDate"?"endDate":null},br=(T,Y)=>typeof T=="string"||typeof Y=="string"?T===Y:T.fieldId===Y.fieldId,Ye=useRef([]),Ze=useCallback((T,Y)=>{Lt&&(Y.preventDefault(),za.current=Y.clientY,et(T),ma.current=false,ue(false),Yt({x:Y.clientX,y:Y.clientY}));},[Lt]),Fa=useCallback(T=>{if(!me||(Math.abs(T.clientY-za.current)>5&&!ma.current&&(ma.current=true,ue(true)),Yt({x:T.clientX,y:T.clientY}),!ma.current))return;let Z=document.querySelectorAll("[data-listview-row]"),le=null,he=null;Z.forEach($e=>{let re=$e.getBoundingClientRect(),Se=$e.getAttribute("data-listview-row");if(Se&&Se!==me&&T.clientY>=re.top&&T.clientY<=re.bottom){le=Se;let He=T.clientY-re.top,Xe=re.height;he=He<Xe*.25?"above":He>Xe*.75?"below":"child";}}),lt(le),qe(he);},[me]),La=useCallback(()=>{if(ma.current&&me&&Oe&&st){if(st==="child"&&a.onTaskReparent)a.onTaskReparent(me,Oe);else if(st==="above"||st==="below"){let T=(le,he,$e=null)=>{for(let re of le){if(re.id===he)return $e;if(re.subtasks){let Se=T(re.subtasks,he,re.id);if(Se!==void 0)return Se}}},Y=T(e,me,null),Z=T(e,Oe,null);if(a.onTaskReparent){let le=(Xe,Pt)=>{if(Pt===null)return Xe;for(let pt of Xe){if(pt.id===Pt)return pt.subtasks||[];if(pt.subtasks){let ft=le(pt.subtasks,Pt);if(ft.length>0||pt.subtasks.some(Zt=>Zt.id===Pt))return ft}}return []},he=le(e,Z??null),$e=he.findIndex(Xe=>Xe.id===Oe),re=Y===Z,Se=re?he.findIndex(Xe=>Xe.id===me):-1,He=st==="below"?$e+1:$e;re&&Se!==-1&&Se<$e&&(He-=1),a.onTaskReparent(me,Z??null,Math.max(0,He));}}}et(null),lt(null),qe(null),Yt(null),ma.current=false,ue(false);},[me,Oe,st,e,a]),nr=(T,Y)=>typeof Y!="string"?T.customFields?.find(le=>le.fieldId===Y.fieldId)?.value:Y==="assignees"?T.assignees:Y==="startDate"?T.startDate:T.endDate,ka=(T,Y,Z,le)=>{T.preventDefault(),T.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let he=Array.from(document.querySelectorAll("[data-listview-row]")),$e=he.map(Et=>Et.getAttribute("data-listview-row")||""),re=Math.max(0,$e.indexOf(Y)),Se=Et=>$e.slice(re,Et+1);pr({sourceTaskId:Y,column:Z,sourceIndex:le,targetIndex:le,rangeIds:new Set([Y])});let Xe=(Et=>{let At=Et?.parentElement??null;for(;At;){let wr=window.getComputedStyle(At).overflowY;if((wr==="auto"||wr==="scroll")&&At.scrollHeight>At.clientHeight)return At;At=At.parentElement;}let Aa=document.scrollingElement;return Aa&&Aa.scrollHeight>Aa.clientHeight?Aa:null})(T.currentTarget),Pt=Et=>{let At=re,Aa=false;he.forEach((wr,sr)=>{let Ga=wr.getBoundingClientRect();Et>=Ga.top&&Et<=Ga.bottom&&(At=sr,Aa=true);});let vr=he[he.length-1];if(!Aa&&vr){let wr=vr.getBoundingClientRect();Et>wr.bottom&&(At=he.length-1);}return At<re&&(At=re),At},pt=T.clientY,ft=null,Zt=()=>{ft!==null&&(cancelAnimationFrame(ft),ft=null);},jt=()=>{let Et=Pt(pt),At=new Set(Se(Et));pr(Aa=>Aa&&{...Aa,targetIndex:Et,rangeIds:At});},qa=()=>{if(Zt(),!Xe)return;let Et=Xe,Aa=Et===document.scrollingElement?{top:0,bottom:window.innerHeight}:Et.getBoundingClientRect(),vr=60,wr=12,sr=pt-Aa.top,Ga=Aa.bottom-pt,ao=Et.scrollHeight-Et.clientHeight;if(Ga<vr&&Et.scrollTop<ao){let Rr=Math.max(1,Math.round(wr*(1-Math.max(0,Ga)/vr))),Un=()=>{Et.scrollTop+=Rr,jt(),Et.scrollTop<Et.scrollHeight-Et.clientHeight&&(ft=requestAnimationFrame(Un));};ft=requestAnimationFrame(Un);}else if(sr<vr&&Et.scrollTop>0){let Rr=Math.max(1,Math.round(wr*(1-Math.max(0,sr)/vr))),Un=()=>{Et.scrollTop-=Rr,jt(),Et.scrollTop>0&&(ft=requestAnimationFrame(Un));};ft=requestAnimationFrame(Un);}},Wt=Et=>{pt=Et.clientY,jt(),qa();},Kt=Et=>{window.removeEventListener("mousemove",Wt),window.removeEventListener("mouseup",Kt),Zt(),document.body.style.cursor="",document.body.style.userSelect="",pr(null);let At=Pt(Et.clientY),Aa=new Map(Ye.current.map(Ga=>[Ga.id,Ga])),vr=Aa.get(Y);if(!vr)return;let wr=nr(vr,Z),sr=[];for(let Ga of Se(At)){if(Ga===Y)continue;let ao=Aa.get(Ga);ao&&(ao.subtasks&&ao.subtasks.length>0||sr.push(Ga));}sr.length>0&&a.onBulkFill?.(sr,Z,wr);};window.addEventListener("mousemove",Wt),window.addEventListener("mouseup",Kt);},Ar=T=>Bt?Bt.rangeIds.has(T):false;useEffect(()=>{if(me)return document.addEventListener("mousemove",Fa),document.addEventListener("mouseup",La),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Fa),document.removeEventListener("mouseup",La),document.body.style.cursor="",document.body.style.userSelect="";}},[me,Fa,La]);let[se,fe]=useState("all"),[ut,j]=useState(false),ye=useRef(null),ne=useRef(null),B=useMemo(()=>{let T=0;function Y(Z,le){for(let he of Z)le>T&&(T=le),he.subtasks?.length&&Y(he.subtasks,le+1);}return Y(e,1),T},[e]);useEffect(()=>{if(!ut)return;let T=Y=>{ye.current?.contains(Y.target)||ne.current?.contains(Y.target)||j(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[ut]),useEffect(()=>{if(se==="all"){let Z=function(le){for(let he of le)he.subtasks?.length&&(he.isExpanded===false&&a.onTaskToggleExpand?.(he.id),Z(he.subtasks));};Z(e);}else {let Z=function(le,he){for(let $e of le)if($e.subtasks?.length){let re=he<se,Se=$e.isExpanded!==false;re!==Se&&a.onTaskToggleExpand?.($e.id),Z($e.subtasks,he+1);}};Z(e,1);}},[se]);let[ee,De]=useState(null),[S,W]=useState(0),[pe,Ce]=useState(0),nt=useRef(null),[be,_]=useState(null),[gt,bt]=useState(null);useEffect(()=>{y&&A(T=>{if(T.length===y.length){let Y=true;for(let Z=0;Z<T.length;Z++){let le=T[Z],he=y[Z];if(!le||!he||le.id!==he.id||le.visible!==he.visible||le.width!==he.width||le.label!==he.label){Y=false;break}}if(Y)return T}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Te,hideCompleted:wt}));}catch(T){console.error("Error persisting filter state:",T);}},[P,Te,wt]);let Ut=useMemo(()=>{let T=new Set;function Y(Z){for(let le of Z)le.subtasks?.length&&(le.isExpanded!==false&&T.add(le.id),Y(le.subtasks));}return Y(e),T},[e]),Vt=useMemo(()=>dt.filter(T=>T.visible),[dt]),or=useCallback(T=>{a.onTaskToggleExpand?.(T);},[a]),hr=useCallback(T=>{Ve===T?ht(Y=>Y==="asc"?"desc":"asc"):(Qe(T),ht("asc")),a.onSortChange?.({column:T,direction:Ie==="asc"?"desc":"asc"});},[Ve,Ie,a]),Dr=useCallback(T=>{A(T),a.onColumnsChange?.(T);},[a]),ra=useCallback(T=>{let Y=dt.map(Z=>Z.id===T?{...Z,visible:false}:Z);Dr(Y);},[dt,Dr]),Zo=useCallback((T,Y)=>{Qe(T),ht(Y);},[]),Bn=useCallback((T,Y,Z)=>{I&&(T.preventDefault(),Ue({isOpen:true,x:T.clientX,y:T.clientY,type:Y?"task":"header",task:Y,columnId:Z}));},[I]),_r=useCallback(()=>{Ue(T=>({...T,isOpen:false}));},[]),Zn=useCallback((T,Y)=>{if(!M)return;T.preventDefault(),T.stopPropagation();let Z=dt.find(le=>le.id===Y);Z&&(De(Y),W(T.clientX),Ce(Z.width));},[dt,M]);useEffect(()=>{if(!ee)return;let T=dt,Y=le=>{let he=le.clientX-S,$e=Math.max(50,pe+he);T=T.map(re=>re.id===ee?{...re,width:$e}:re),A(T);},Z=()=>{a.onColumnsChange?.(T),De(null);};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Z);}},[ee,S,pe,a]);let eo=useCallback((T,Y)=>{if(Y==="name"){T.preventDefault();return}_(Y),T.dataTransfer.effectAllowed="move",T.dataTransfer.setData("text/plain",Y),T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity="0.5");},[]),Pi=useCallback(T=>{T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity="1"),_(null),bt(null);},[]),es=useCallback((T,Y)=>{T.preventDefault(),Y!=="name"&&(T.dataTransfer.dropEffect="move",bt(Y));},[]),Fi=useCallback(()=>{bt(null);},[]),Ka=useCallback((T,Y)=>{if(T.preventDefault(),!be||be===Y||Y==="name")return;let Z=[...dt],le=Z.findIndex(re=>re.id===be),he=Z.findIndex(re=>re.id===Y);if(le===-1||he===-1)return;let $e=Z.splice(le,1);$e[0]&&(Z.splice(he,0,$e[0]),Dr(Z),_(null),bt(null));},[be,dt,Dr]),Bs=useCallback(async T=>{if(a.onCreateCustomField){let Y={...T,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}q(false);},[a]),to=useCallback(T=>T.progress===100||T.status==="completed"?"completed":T.progress&&T.progress>0||T.status==="in-progress"?"in-progress":"todo",[]),$s=t.groupBy==="status",yr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[rn,$n]=useState(()=>{let T=new Set(t.defaultCollapsedGroups??["completed"]);if(!yr)return T;try{let Y=localStorage.getItem(yr);return Y?new Set(JSON.parse(Y)):T}catch{return T}}),Os=useCallback(T=>{$n(Y=>{let Z=new Set(Y);if(Z.has(T)?Z.delete(T):Z.add(T),yr)try{localStorage.setItem(yr,JSON.stringify([...Z]));}catch{}return Z});},[yr]),nn=!!t.selectable,[Hs,Li]=useState(new Set),On=useMemo(()=>t.selectedIds?new Set(t.selectedIds):Hs,[t.selectedIds,Hs]),Ai=useRef(null),{lista:Ir,cabeceras:ts,todas:xr}=useMemo(()=>{let T=J0(e);if(vt.trim()){let Z=vt.toLowerCase();T=T.filter(le=>le.name.toLowerCase().includes(Z));}let Y=t.showStatusFilter!==false;if(Y&&Te!=="all"){let Z=new Set(T.filter(le=>to(le)===Te).flatMap(le=>le.parentPath));T=T.filter(le=>Z.has(le.id));}if(Y&&wt){let Z=new Set(T.filter(le=>to(le)!=="completed").flatMap(le=>le.parentPath));T=T.filter(le=>Z.has(le.id));}if($s){let Z=["todo","in-progress","completed"],le=new Map,he=[];for(let He of T){let Xe=He.parentPath[0]??He.id;He.level===0&&he.push(He),le.has(Xe)||le.set(Xe,[]),le.get(Xe).push(He);}let $e=He=>He.endDate?new Date(He.endDate).getTime():1/0,re=[],Se=new Map;for(let He of Z){let Xe=he.filter(jt=>to(jt)===He).sort((jt,qa)=>$e(jt)-$e(qa)),Pt=Xe.flatMap(jt=>le.get(jt.id)??[jt]),pt=Pt.filter(jt=>!jt.hasChildren).length;if(pt===0&&Xe.length===0)continue;let ft=rn.has(He),Zt=re.length;Se.set(Zt,[...Se.get(Zt)??[],{clave:He,cuenta:pt,plegado:ft}]),ft||re.push(...Pt);}return {lista:re,cabeceras:Se,todas:T}}return T.sort((Z,le)=>{let he,$e;switch(Ve){case "name":he=Z.name.toLowerCase(),$e=le.name.toLowerCase();break;case "startDate":he=Z.startDate?.getTime()||0,$e=le.startDate?.getTime()||0;break;case "endDate":he=Z.endDate?.getTime()||0,$e=le.endDate?.getTime()||0;break;case "progress":he=Z.progress||0,$e=le.progress||0;break;case "status":he=Z.status||"todo",$e=le.status||"todo";break;case "priority":let re={urgent:0,high:1,medium:2,low:3,none:4};he=re[Z.priority]??4,$e=re[le.priority]??4;break;case "position":return 0;default:return 0}return he<$e?Ie==="asc"?-1:1:he>$e?Ie==="asc"?1:-1:0}),{lista:T,cabeceras:new Map,todas:T}},[e,vt,Te,wt,Ve,Ie,to,t.showStatusFilter,$s,rn]);Ye.current=Ir;let Do=(T,Y)=>{let Z=new Set(On),le=Ai.current,he=Ye.current.map($e=>$e.id);if(Y&&le&&le!==T&&he.includes(le)&&he.includes(T)){let $e=he.indexOf(le),re=he.indexOf(T),Se=Math.min($e,re),He=Math.max($e,re),Xe=!On.has(T);for(let Pt of he.slice(Se,He+1))Xe?Z.add(Pt):Z.delete(Pt);}else Z.has(T)?Z.delete(T):Z.add(T);Ai.current=T,t.selectedIds||Li(Z),a.onSelectionChange?.([...Z]);},So=On.size>0,Qt=T=>jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:Y=>Y.stopPropagation(),children:jsx("input",{type:"checkbox","data-casilla-fila":T,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:On.has(T),onChange:()=>{},onClick:Y=>{Y.stopPropagation(),Do(T,Y.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",So?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),dc={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Us=(T,Y)=>{let Z=ts.get(T);if(!Z?.length)return Y;let le=Z.map(he=>jsx("div",{"data-grupo-de-estado":he.clave,"data-plegado":he.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",U?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>Os(he.clave),"aria-expanded":!he.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",U?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[he.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),dc[he.clave]?.[f==="es"?"es":"en"]??he.clave,jsx("span",{className:g("font-normal tabular-nums",U?"text-white/40":"text-gray-400"),children:he.cuenta})]})},`grupo-${he.clave}`));return Y?[...le,Y]:le},as=useCallback((T,Y)=>{let Z=$e=>{a.onTaskUpdate?.({...T,...$e});},le=$e=>$e?T.customFields?.find(Se=>Se.fieldId===$e)?.value:void 0,he=($e,re)=>{if(!$e)return;let He=[...T.customFields||[]],Xe=He.findIndex(Pt=>Pt.fieldId===$e);Xe>=0?He[Xe]={fieldId:$e,value:re}:He.push({fieldId:$e,value:re}),Z({customFields:He});};switch(Y.type){case "name":return null;case "status":return jsx(Bg,{value:T.status||(T.progress===100?"completed":T.progress&&T.progress>0?"in-progress":"todo"),onChange:re=>{Z({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:U,locale:f,translations:ve.status});case "priority":return jsx(Og,{value:T.priority,onChange:re=>Z({priority:re}),isDark:U,locale:f});case "assignees":{let re=T.hasChildren,Se=T.assignees||[];if(re&&T.subtasks?.length){let He=new Map,Xe=Pt=>{(Pt||[]).forEach(pt=>{(pt.assignees||[]).forEach(ft=>{He.has(ft.name)||He.set(ft.name,ft);}),pt.subtasks?.length&&Xe(pt.subtasks);});};Xe(T.subtasks),Se=Array.from(He.values());}else re&&(Se=[]);return jsx(Rl,{value:Se,availableUsers:l,onChange:He=>Z({assignees:He}),isDark:U,locale:f,disabled:re})}case "startDate":return jsx($l,{value:T.startDate,onChange:re=>Z({startDate:re}),isDark:U,locale:f,dateField:"start",startDate:T.startDate,endDate:T.endDate});case "endDate":{let re=jsx($l,{value:T.endDate,onChange:Se=>Z({endDate:Se}),isDark:U,locale:f,dateField:"end",startDate:T.startDate,endDate:T.endDate});return t.isTaskOverdue?.(T)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:U?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),re]}):re}case "progress":{let re=!!(T.subtasks&&T.subtasks.length>0),Se=re?X0(du(T.subtasks||[])):T.progress||0;return jsx(Kg,{value:Se,onChange:re?void 0:He=>{let Xe=He===100?"completed":He>0?"in-progress":"todo";Z({progress:He,status:Xe});},isDark:U,disabled:re})}case "tags":return jsx(c0,{value:T.tags||[],isDark:U});case "text":return jsx(Xg,{value:le(Y.customFieldId)||"",onChange:re=>he(Y.customFieldId,re),isDark:U});case "number":return jsx(Zg,{value:le(Y.customFieldId)||0,onChange:re=>he(Y.customFieldId,re),isDark:U});case "date":let $e=le(Y.customFieldId);return jsx($l,{value:$e?new Date($e):void 0,onChange:re=>he(Y.customFieldId,re),isDark:U,locale:f});case "dropdown":return jsx(e0,{value:le(Y.customFieldId)||"",options:Y.options||[],onChange:re=>he(Y.customFieldId,re),isDark:U});case "checkbox":return jsx(a0,{value:le(Y.customFieldId)||false,onChange:re=>he(Y.customFieldId,re),isDark:U});case "multiselect":return jsx(r0,{value:le(Y.customFieldId)||[],options:Y.options||[],onChange:re=>he(Y.customFieldId,re),isDark:U,maxSelectable:Y.maxSelectable});case "person":{let re=le(Y.customFieldId)||[];return jsx(Rl,{value:re.map(Se=>({name:Se.name,avatar:Se.avatar,initials:Se.initials||(Se.name||"?").slice(0,2).toUpperCase(),color:Se.color||"#00E5CC"})),availableUsers:l,onChange:Se=>he(Y.customFieldId,Se),isDark:U,locale:f})}case "file":return jsx(s0,{value:le(Y.customFieldId),isDark:U,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=T.status==="completed"||T.progress===100;return jsx(Ur,{value:T.estimatedTime,onChange:Se=>Z({estimatedTime:Se}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:ze(T)})}case "quotedTime":{let re=T.status==="completed"||T.progress===100,Se=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(Ur,{value:T.quotedTime,onChange:He=>Z({quotedTime:He}),isDark:U,locale:f,disabled:re,isBlurred:Se,lens:O,hourlyRate:ze(T)})}case "elapsedTime":{let re=T.status==="completed"||T.progress===100,Se=T.executedDollarsCanonical;return jsx(Ur,{value:T.elapsedTime,onChange:He=>Z({elapsedTime:He}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:ze(T),financialOverride:Se})}case "effortMinutes":{if(Le&&T.subtasks&&T.subtasks.length>0){let{allocated:Pt}=Ls(T);if(O==="financial"){let pt=oe(T),ft=Math.round(pt.dollarAllocated),Zt=Math.round(pt.dollarQuoted),jt=Zt-ft;return jsxs("div",{className:"flex flex-col",children:[ft>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",ft.toLocaleString("es-CO")]}):null,jt!==0&&ft>0&&Zt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",jt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[jt>0?"+":"",Math.abs(jt)>=1e3?`$${(jt/1e3).toFixed(1)}K`:`$${jt}`]})]})}return jsx(Ur,{value:Pt>0?Pt:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:J})}let re=T.status==="completed"||T.progress===100,Se=T.effortMinutes||0,He=T.soldEffortMinutes||0,Xe=ze(T);if(O==="financial"&&Xe&&Se>0&&He>0){let Pt=Math.round(Se/60*Xe),ft=Math.round(He/60*Xe)-Pt;return jsxs("div",{className:"flex flex-col",children:[jsx(Ur,{value:Se,onChange:Zt=>Z({effortMinutes:Zt}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:ze(T)}),ft!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ft>0?"+":"",Math.abs(ft)>=1e3?`$${(ft/1e3).toFixed(1)}K`:`$${ft}`]})]})}return jsx(Ur,{value:Se,onChange:Pt=>Z({effortMinutes:Pt}),isDark:U,locale:f,disabled:re,lens:O,hourlyRate:ze(T)})}case "timeLoggedMinutes":{let re=T.executedDollarsCanonical;if(Le&&T.subtasks&&T.subtasks.length>0){let{spent:He}=Ls(T);return jsx(Ur,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:ze(T),financialOverride:re})}let Se=T.status==="completed"||T.progress===100;return jsx(Ur,{value:T.timeLoggedMinutes,onChange:a.onLogTime?He=>{a.onLogTime?.(T,He);}:void 0,isDark:U,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Se,lens:O,hourlyRate:ze(T),financialOverride:re})}case "soldEffortMinutes":{if(Le&&T.subtasks&&T.subtasks.length>0){let{quoted:He}=Ls(T),Xe=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Ur,{value:He>0?He:void 0,isDark:U,locale:f,disabled:true,isBlurred:Xe,lens:O,hourlyRate:ze(T)})}let re=T.status==="completed"||T.progress===100,Se=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Ur,{value:T.soldEffortMinutes,onChange:He=>Z({soldEffortMinutes:He}),isDark:U,locale:f,disabled:re,isBlurred:Se,lens:O,hourlyRate:ze(T)})}case "scheduleVariance":{let re=T.effortMinutes||0,Se=T.soldEffortMinutes||0,He=T.timeLoggedMinutes||0,Xe=re>0||Se>0||He>0;return jsx(m0,{startDate:T.startDate,endDate:T.endDate,scheduleVariance:T.scheduleVariance,isDark:U,locale:f,hasTimeAllocated:Xe})}case "hoursBar":{if(Le&&T.hasChildren){let{spent:re,allocated:Se,quoted:He}=Ls(T),Xe=re>Se&&Se>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",U?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",Xe?"text-[#FF453A]":U?"text-white/80":"text-gray-800"),children:Fs(re)}),Se>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-white/60":"text-gray-600",children:Fs(Se)})]}),He>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-amber-400/70":"text-amber-600",children:Fs(He)})]})]})}return jsx(f0,{task:T,isDark:U,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:O,hourlyRate:ze(T)})}case "teamLoad":return T.hasChildren||T.subtasks&&T.subtasks.length>0?jsx(h0,{task:T,isDark:U,locale:f}):jsx(Rl,{value:T.assignees||[],availableUsers:l,onChange:Se=>{a.onTaskUpdate?.({...T,assignees:Se});},isDark:U,locale:f});case "blockers":return jsx(x0,{blockers:T.blockers,isDark:U,locale:f});case "weight":{let re=Pe.get(T.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?U?"text-white/50":"text-gray-400":U?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let Se=T.weight||0;return jsx(dC,{value:Se,onChange:He=>Z({weight:He}),isDark:U})}default:return jsx("span",{className:g("text-sm",U?"text-white/60":"text-gray-500"),children:"-"})}},[a,U,f,l,ve,Le,Pe]),Ws=useCallback(T=>{let Z={name:ve.columns.name,status:ve.columns.status,priority:ve.columns.priority,assignees:ve.columns.assignees,startDate:ve.columns.startDate,endDate:ve.columns.endDate,progress:ve.columns.progress,tags:ve.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:ve.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:ve.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:ve.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:ve.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:ve.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:ve.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:ve.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:ve.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:ve.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ve.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ve.columns.weight||(f==="es"?"Peso":"Weight")}[T.type]||T.label;return typeof Z=="string"?Z:String(Z||T.type)},[ve,f]),Hn=useMemo(()=>{let Z=Vt.reduce((he,$e)=>he+$e.width,0)+(k?48:0),le={};for(let he of Vt)le[he.id]=`${he.width/Z*100}%`;return le},[Vt,k]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:[ve.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",U?"text-white":"text-gray-900"),children:ve.empty.noTasks}),jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:ve.empty.addFirstTask})]})}):jsxs("div",{ref:nt,className:g(U?"bg-[#0D0D0D]":"bg-white",ee&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let T=!!t.toolbarContainer,Y=jsx("div",{className:T?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",U?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:T?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",U?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let Z=xr.filter($e=>($e.subtasks?.length??0)>0).length,le=xr.length-Z,he=f==="es";return jsxs(Fragment,{children:[le," ",ve.pagination.tasks,Z>0&&jsxs(Fragment,{children:[" \xB7 ",Z," ",he?Z===1?"tarea padre":"tareas padre":Z===1?"parent task":"parent tasks"]})]})})()}),h&&!T&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",U?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:vt,onChange:Z=>ot(Z.target.value),placeholder:ve.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",U?"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")})]}),!T&&jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&B>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:ye,onClick:()=>j(!ut),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",U?ut?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":ut?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),se==="all"?f==="es"?"Todos":"All":`L${se}`]}),ut&&jsx("div",{ref:ne,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",U?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(Z,le)=>({value:le+1,label:`L${le+1}`}))].map(Z=>jsxs("button",{onClick:()=>{fe(Z.value),j(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",U?se===Z.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":se===Z.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:Z.label}),se===Z.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(Z.value)))})]}),t.showStatusFilter!==false&&jsx(G0,{value:Te,hideCompleted:wt,onChange:mt,onHideCompletedChange:je,isDark:U,locale:f}),We?.enabled&&We.data&&!Fe&&jsx("button",{onClick:()=>Be(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",U?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,C&&D&&!T&&jsxs(motion.button,{onClick:D,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:ve.toolbar.newTask})]})]})});return T?createPortal(Y,t.toolbarContainer):Y})(),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",U?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[nn&&jsx("div",{className:"w-6 flex-shrink-0"}),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(T=>{let Y=T.id!=="name",Z=gt===T.id&&be!==T.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",U?"text-white/60":"text-gray-500",Y&&"cursor-grab",T.type!=="name"&&"justify-center",be===T.id&&"opacity-50",Z&&(U?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Hn[T.id],minWidth:T.minWidth},draggable:Y,onDragStart:Y?le=>eo(le,T.id):void 0,onDragEnd:Y?Pi:void 0,onDragOver:Y?le=>es(le,T.id):void 0,onDragLeave:Y?Fi:void 0,onDrop:Y?le=>Ka(le,T.id):void 0,onContextMenu:le=>Bn(le,void 0,T.id),children:[Y&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",U?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:le=>{let he=le.currentTarget.getBoundingClientRect();u(T.id,he);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ws(T),p?.includes(T.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Ve===T.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):T.sortable?jsxs("button",{draggable:false,onClick:()=>hr(T.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ws(T),p?.includes(T.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ve===T.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ws(T),p?.includes(T.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&T.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:le=>Zn(le,T.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",ee===T.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},T.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:T=>{T.stopPropagation(),ke(Y=>!Y);},className:g("p-0.5 rounded transition-colors",U?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",X&&(U?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(B0,{isOpen:X,onClose:()=>ke(false),columns:dt,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Dr,onCreateCustomField:()=>{ke(false),q(true);},isDark:U,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[Ir.map((T,Y)=>Us(Y,(()=>{let Z=Ut.has(T.id),le=Math.min(Y*.01,.2),he=T.hasChildren&&T.level===0,$e=T.subtasks?.length||0;if(he){let{spent:pt,allocated:ft,quoted:Zt}=Ls(T),jt=cC(T);return jsxs(motion.div,{"data-task-id":T.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:le},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",U?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",rt===T.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(T),children:[nn&&Qt(T.id),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(qa=>jsx("div",{className:g("flex items-center px-4",$?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",qa.type!=="name"&&"justify-center"),style:{width:Hn[qa.id],minWidth:qa.minWidth},children:qa.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Wt=>{Wt.stopPropagation(),or(T.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Z?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Wt=>{Wt.stopPropagation(),or(T.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:Z?jsx(FolderOpen,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}})}),T.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:U?"#FFD60A":"#B45309"},children:T.wbsCode}),jsxs("div",{className:g("flex min-w-0",$?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",$&&"truncate",U?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:T.name}),jsxs("span",{className:g($?"text-[12px] flex-shrink-0":"text-[10px] font-mono",U?"text-white/30":"text-gray-500"),children:["(",$e," ",f==="es"?$e===1?"Tarea":"Tareas":$e===1?"Item":"Items",")"]}),jt!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",jt>=1?"text-[#32D74B] bg-[#32D74B]/10":jt>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",jt.toFixed(2)]})]})]}):qa.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Wt=T.executedDollarsCanonical,Kt=Wt!=null?Math.round(Wt):Math.round(oe(T).dollarSpent);return Kt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ur,{value:pt>0?pt:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:ze(T)}):qa.type==="soldEffortMinutes"?O==="financial"?(()=>{let Wt=oe(T),Kt=Math.round(Wt.dollarQuoted);return Kt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("en-US")]}):null})():jsx(Ur,{value:Zt>0?Zt:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:ze(T)}):qa.type==="effortMinutes"?O==="financial"?(()=>{let Wt=oe(T),Kt=Math.round(Wt.dollarAllocated),Et=Math.round(Wt.dollarQuoted),At=Et-Kt;return jsxs("div",{className:"flex flex-col",children:[Kt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Kt.toLocaleString("es-CO")]}):null,At!==0&&Kt>0&&Et>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`]})]})})():jsx(Ur,{value:ft>0?ft:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:ze(T)}):as(T,qa)},qa.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},T.id)}let re=me===T.id,Se=Oe===T.id,He=Se&&st==="above",Xe=Se&&st==="below",Pt=Se&&st==="child";return jsxs(motion.div,{"data-task-id":T.id,"data-listview-row":T.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:le},className:g("flex items-center border-b transition-colors relative group",U?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",rt===T.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100"),nn&&On.has(T.id)&&(U?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":nn&&On.has(T.id)?"true":void 0,style:{opacity:re?.4:1,backgroundColor:Pt?U?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Pt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),onContextMenu:pt=>Bn(pt,T),onMouseEnter:()=>_a(T.id),onMouseLeave:()=>_a(pt=>pt===T.id?null:pt),children:[He&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Xe&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),nn&&Qt(T.id),Lt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:pt=>Ze(T.id,pt),style:{color:U?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Vt.map(pt=>{let ft=!!(T.subtasks&&T.subtasks.length>0),Zt=ga(pt),qa=!!Zt&&!ft&&Ht===T.id&&!Bt,Wt=!!Bt&&!!Zt&&br(Bt.column,Zt)&&Ar(T.id);return jsx("div",{className:g("flex items-center px-4",$?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",pt.type!=="name"&&"justify-center"),style:{width:Hn[pt.id],minWidth:pt.minWidth,position:"relative",backgroundColor:Wt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Wt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:pt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&T.level>0&&jsx("div",{style:{width:`${T.level*24}px`},className:"flex-shrink-0"}),b&&T.hasChildren&&jsx("button",{onClick:Kt=>{Kt.stopPropagation(),or(T.id);},className:g("p-0.5 rounded flex-shrink-0",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:Z?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")})}),b&&!T.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",$?"flex-row items-center gap-2":"flex-col"),children:[(T.wbsCode||T.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[T.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),children:T.wbsCode}),T.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g($?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",U?"text-white/40":"text-gray-400"),style:$&&!U?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:T.taskCode})]}),jsx("span",{className:g("truncate",T.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",T.progress===100?t.completedStyle==="dim"?U?"text-white/45":"text-gray-400":U?"line-through text-white/50":"line-through text-gray-400":T.hasChildren?U?"text-white":"text-gray-900":U?"text-[#D1D5DB]":"text-gray-600"),children:T.name}),T.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",$&&"flex-shrink-0"),style:{backgroundColor:`${T.tags[0].color}20`,color:T.tags[0].color},children:T.tags[0].name})]})]}):qa&&Zt?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[as(T,pt),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Kt=>ka(Kt,T.id,Zt,Y),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):as(T,pt)},pt.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},T.id)})())),Us(Ir.length,null)]}),G&&Ir.length>0&&(()=>{let{spent:T,allocated:Y,quoted:Z}=Q,le=Y-T,he=le<0,$e=he?`+${Fs(Math.abs(le))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Fs(le)} ${f==="es"?"AHORRADO":"SAVED"}`,re=O==="financial"&&J>0,Se=Ne?.breakdown,He=!!Se&&((Se.equipment??0)>0||(Se.travel??0)>0),Xe=Se?.laborSpent!=null?Se.laborSpent:Ne?.spent!=null?Ne.spent:Q.dollarSpent,Pt=Se?.laborAllocated!=null?Se.laborAllocated:Ne?.allocated!=null?Ne.allocated:Q.dollarAllocated,pt=Ne?.quoted!=null?Ne.quoted:Q.dollarQuoted,ft=(Wt,Kt)=>{if(re){let Et=Kt??Wt/60*J;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Fs(Wt)},Zt=re?Math.abs(Pt-Xe):0,jt=re?`+$${Zt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${he?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:$e,qa=re&&He?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",U?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:U?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[nn&&jsx("div",{className:"w-6 flex-shrink-0"}),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),Vt.map(Wt=>jsx("div",{className:g("flex items-center px-4 py-3",Wt.type!=="name"&&"justify-center"),style:{width:Hn[Wt.id],minWidth:Wt.minWidth},children:Wt.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),qa&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",U?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),qa]})]}):Wt.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(T,re?Xe:void 0)}),jsx("span",{className:g("text-[11px]",U?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",U?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(Y,re?Pt:void 0)})]}),Y>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",he?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?jt:$e})]}):Wt.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Z>0?ft(Z,re?pt:void 0):"\u2013"}):Wt.type==="effortMinutes"?(()=>{if(re&&Z>0&&Y>0){let Kt=Math.round(pt),Et=Math.round(Pt),At=Kt-Et,Aa=Kt>0?Math.round(At/Kt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ft(Y,Pt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>=0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Aa,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?ft(Y,re?Pt:void 0):"\u2013"})})():Wt.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:T>0?ft(T,re?Xe:void 0):"\u2013"}):Wt.type==="progress"?(()=>{let Kt=X0(du(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Kt,"%"]})})():Wt.type==="weight"?(()=>{let Kt=e||[],Et=[],At=sr=>{for(let Ga of sr)Et.push(Ga),Ga.subtasks?.length&&At(Ga.subtasks);};At(Kt);let vr=Et.filter(sr=>!sr.subtasks?.length||sr.subtasks.length===0).reduce((sr,Ga)=>sr+(Ga.weight||0),0),wr=Math.abs(vr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",wr?U?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(vr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",U?"text-white/30":"text-gray-300"),children:"\u2013"})},Wt.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ir.length===0&&vt&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",U?"text-white/30":"text-gray-400")}),jsx("p",{className:g(U?"text-white/60":"text-gray-600"),children:ve.empty.noResults})]})})]})}),We?.enabled&&We.data&&Fe&&jsx(j0,{data:We.data,isDark:U,locale:f,onClose:()=>Be(false),lens:t?.lens,onUnassignedTaskClick:T=>{let Y=document.querySelector(`[data-task-id="${T}"]`);Y&&(Y.scrollIntoView({behavior:"smooth",block:"center"}),ce(T),setTimeout(()=>ce(null),2e3));}})]}),jsx(D0,{state:we,onClose:_r,isDark:U,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ra,onColumnSort:Zo,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),de&&kt&&me&&createPortal(jsx("div",{style:{position:"fixed",left:kt.x+12,top:kt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=Ee.flattenTasks(e).find(Z=>Z.id===me);return Y?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:U?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${U?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:U?"#e6edf3":"#111827"},children:Y.name})]}):null})()}),document.body),jsx(H0,{isOpen:R,onClose:()=>q(false),onSave:Bs,isDark:U,locale:f})]})}var Z0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],ef=[{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"}],tf=[{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 uu={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},pu={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},mu={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"},Kl={dark:uu,light:pu,neutral:mu};function af(e){return Kl[e]||Kl.dark}function ql(e,t,a,r,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],u=[],p={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var uC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],pC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function rf(e){return e==="es"?uC:pC}function nf(e){return (e.getDay()+6)%7}function of(e,t){let a=new Date(e,t,1),r=nf(a),n=new Date(e,t,1-r),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(n);return d.setDate(n.getDate()+(p-1)),d},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(a),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function wi(e,t){return nf(e.serialToDate(t))>=5}function mC(e){let t=[],a=(r,n,s)=>{for(let o of r){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&a(o.subtasks,l,c);}};return a(e,"",""),t}function sf(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function lf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Yl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=mC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=sf(u.startDate),f=sf(u.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),h=a.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?lf(x):lf(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?bC(k.name):void 0),I=u.displayId||u.wbsCode||"",C=fC(I||u.id)?"":I||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var gC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fC(e){return gC.test(e)||/^task-\d+/.test(e)}function bC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var hC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],yC=["January","February","March","April","May","June","July","August","September","October","November","December"];function cf(e,t,a){return `${(a==="es"?hC:yC)[t]} ${e}`}var gu=26,xC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Xl({locale:e}){let t=rf(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Jl({bar:e,ws:t,money:a,projColor:r,slotH:n=gu}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=a==="$"?s.cost:`${s.hrs}h`,u={"--proj":e.color??s.color??r,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:u,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function Ql({chip:e,ws:t,slotH:a=gu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:xC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Zl({more:e,ws:t,slotH:a=gu,onClick:r}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:"cal-more",style:s,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," m\xE1s"]})}function df({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var CC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function fu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=CC.filter(p=>!c.includes(p.id));return l?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:u.map(p=>jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${i?p.en:p.es} (${p.key})`,children:i?p.en:p.es},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]}):jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:u.map(p=>jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[i?p.en:p.es,jsx("span",{className:"key",children:p.key})]},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function uf({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),h=u==="es";useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,p,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var TC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function pf({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:TC.map(r=>{let n=a.includes(r.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:r.nm}),jsx("div",{className:"sub",children:r.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var EC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},MC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function gf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let l=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let i=a.length+t.length,p=r||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${i} ${l?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:MC[d.type]},children:EC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var mf={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function ff({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r}){let n=mf[a]||mf.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function hf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function LC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var bf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function AC(e){return bf[e%bf.length]}function IC(e){return e>1?"over":e>=.9?"warn":"ok"}var bu="\xA0";function Ko(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function yf(e,t,a){let r=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(hf(l.date));if(n.size===0)return r;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:AC(c),initials:LC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=e.map(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:a}}),u=i.reduce((p,d)=>p+d.hours,0);r.set(l,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:i});}return r}function xf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=hf(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,p="cal-cap-cell "+(o?"off":IC(i))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:p,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${bu}/${bu}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ko(l.assigned),"h"]}),jsxs("span",{children:["/",bu,Ko(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function vf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let i=p=>{p.key==="Escape"&&a();},u=p=>{n.current&&!n.current.contains(p.target)&&a();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.capacity,0),l=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...r},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Ko(s),"h asignadas / ",Ko(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ko(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ko(i.hours),"h / ",Ko(i.capacity),"h"]})]},i.name)})})]})}var hu=28,BC=182;function kf({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=l==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx($C,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),c&&c[v]?jsx(xf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function $C({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=useMemo(()=>ql(r,n,t,a),[r,n,t,a]),p=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${BC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return wi(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Jl,{bar:f,ws:t,money:s,projColor:o,slotH:hu})},`b${v}`)),u.chips.map((f,v)=>jsx(Ql,{chip:f,ws:t,slotH:hu},`c${v}`)),u.more.map((f,v)=>jsx(Zl,{more:f,ws:t,slotH:hu,onClick:()=>i(f.day,f.items,r.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var OC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function HC(e){return OC.test(e)||/^task-\d+/.test(e)}function UC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Cf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function WC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Tf(e,t){let a=WC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?Cf(l):Cf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?UC(i.name):void 0),p=n.displayId||n.wbsCode||"",d=HC(p||n.id)?"":p||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return r}function Nf({items:e,onItemClick:t,onCollapse:a,money:r,projColor:n,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(l=>{let c=r==="$"?l.cost:`${l.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxs("div",{className:"row1",children:[l.id?jsx("span",{className:"tk",children:l.id}):null,jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsx("div",{className:"nom",children:l.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsx("span",{children:c}),l.who?jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function Df({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function Is(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Sf({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=a.wasCritical,p=a.projectEndDeltaDays,d=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Is(a.oldProjectEnd,n)} \u2192 ${Is(a.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Is(a.oldStart,n)," \u2013 ",Is(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[Is(a.newStart,n)," \u2013 ",Is(a.newEnd,n)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?i?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:p>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?i?"Sigue en CPM":"Stays critical":a.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var jC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Ef({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let u=p=>p.toLocaleDateString(c?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(p=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>l?.(d.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:d.color??n,flex:"none"}}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:r==="$"?d.cost:`${d.hrs}h`})]},d.uid)),p.items.map((d,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:jC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function _C(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ec(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function yu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Mf(e,t){let a=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of e)for(let u of ec(i))r.has(u)||r.set(u,[]),r.get(u).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let u=a.get(i);if(!u)return o.delete(i),0;let p=ec(u).filter(f=>a.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=yu(u)*864e5;return n.set(i,d),s.set(i,d+m),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function Pf(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of ec(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,a);else {let u=1/0;for(let p of i){let d=s.get(p),m=r.get(p);d!=null&&m&&(u=Math.min(u,d-yu(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&ec(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function tc(e,t,a,r){let n=_C(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=Mf(n,new Map),i=Pf(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:a,endDate:r}:b),p=Mf(u,new Map([[t,a.getTime()]])),d=Pf(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=yu(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function Ff(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var XC=132,ac=26,JC="#5B7FD4";function Lf({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=useState("mes"),[I,C]=useState(()=>{let de=new Date,ue={y:de.getFullYear(),m:de.getMonth()},Oe=(e??[]).map(qe=>qe.startDate?new Date(qe.startDate):null).filter(qe=>!!qe&&!isNaN(qe.getTime()));if(Oe.length===0||(e??[]).some(qe=>{let kt=qe.startDate?new Date(qe.startDate):null,Yt=qe.endDate?new Date(qe.endDate):kt;if(!kt||isNaN(kt.getTime()))return false;let za=new Date(ue.y,ue.m,1),ma=new Date(ue.y,ue.m+1,0,23,59,59);return kt<=ma&&(Yt??kt)>=za}))return ue;let st=Oe.reduce((qe,kt)=>qe<kt?qe:kt);return {y:st.getFullYear(),m:st.getMonth()}}),[D,P]=useState(false),[N,V]=useState([]),[O,J]=useState("all"),[L,Le]=useState(null),[G,Ne]=useState(null),[$,ve]=useState(false),[U,ze]=useState(null),[oe,Re]=useState(false),Q=useMemo(()=>of(I.y,I.m),[I.y,I.m]),Pe=r||JC,We=useMemo(()=>{let de=new Set;for(let ue of y){let Oe=new Date(`${ue}T12:00:00`),lt=Q.dateToSerial(Oe);lt>=1&<<=42&&de.add(lt);}return de},[y,Q]);useEffect(()=>{w?.({start:Ff(Q.serialToDate(1)),end:Ff(Q.serialToDate(42))});},[I.y,I.m]);let Fe=b.length,Be=useMemo(()=>{let de=x?.hoursPerDay;if(!de)return 8;let ue=[de.monday,de.tuesday,de.wednesday,de.thursday,de.friday].map(Oe=>Oe||0).filter(Oe=>Oe>0);return ue.length?Math.round(ue.reduce((Oe,lt)=>Oe+lt,0)/ue.length*10)/10:8},[x]),rt=useMemo(()=>Yl({tasks:e,grid:Q,projectColor:()=>Pe,hourlyRate:o,projectId:a}),[e,Q,Pe,o,a]),ce=useMemo(()=>{if(d===false)return [];let de=new Map;for(let ue of rt.calTasks)ue.phaseId&&ue.phaseName&&de.set(ue.phaseId,ue.phaseName);return [...de.entries()].map(([ue,Oe])=>({id:ue,name:Oe})).sort((ue,Oe)=>ue.name.localeCompare(Oe.name))},[rt.calTasks,d]),Ve=!N.includes("tareas"),Qe=!N.includes("cpm"),Ie=useMemo(()=>{let de=Ve?rt.calTasks:[];return O!=="all"&&(de=de.filter(ue=>ue.phaseId===O)),Qe||(de=de.map(ue=>ue.critical?{...ue,critical:false}:ue)),de},[rt.calTasks,Ve,Qe,O]),ht=useMemo(()=>{let de=new Set;return N.includes("hitos")&&(de.add("hito"),de.add("desembolso")),N.includes("ext")&&de.add("ext"),N.includes("aus")&&de.add("aus"),rt.dayItems.filter(ue=>!de.has(ue.type))},[rt.dayItems,N]),vt=!N.includes("festivos"),ot=new Date,Te=Q.dateToSerial(new Date(ot.getFullYear(),ot.getMonth(),ot.getDate())),mt=de=>V(ue=>ue.includes(de)?ue.filter(Oe=>Oe!==de):[...ue,de]),wt=()=>C(de=>{let ue=new Date(de.y,de.m-1,1);return {y:ue.getFullYear(),m:ue.getMonth()}}),je=()=>C(de=>{let ue=new Date(de.y,de.m+1,1);return {y:ue.getFullYear(),m:ue.getMonth()}}),dt=()=>{let de=new Date;C({y:de.getFullYear(),m:de.getMonth()});},A=(de,ue,Oe)=>{if(!v||ue===0)return;let lt=rt.calTasks.find(za=>za.uid===de);if(!lt)return;let st=ue*864e5,qe=new Date(lt.realStart.getTime()+st),kt=new Date(lt.realEnd.getTime()+st),Yt=tc(e,de,qe,kt);Yt&&ze({uid:de,taskId:lt.id,taskName:lt.name,sim:Yt,anchor:Oe});},X=async()=>{if(!U||!h)return;Re(true);let de=[{id:U.uid,startDate:U.sim.newStart,endDate:U.sim.newEnd},...U.sim.movedSuccessors.map(Oe=>({id:Oe.id,startDate:Oe.newStart,endDate:Oe.newEnd}))],ue=await h(de);Re(false),ue&&ze(null);},ke=cf(I.y,I.m,n),R=[{id:"",name:t,color:Pe}],q=useMemo(()=>Tf(e,o),[e,o]),we=useMemo(()=>{if(k==="lookahead"){let de=Q.weeks.find(Oe=>Te>=Oe.ws&&Te<=Oe.we)??Q.weeks[0],ue=Q.weeks.indexOf(de);return Q.weeks.slice(ue,ue+2)}return k==="semana"?[Q.weeks.find(ue=>Te>=ue.ws&&Te<=ue.we)??Q.weeks[0]]:[]},[k,Q.weeks,Te]),Ue=useMemo(()=>{let de={};return we.forEach((ue,Oe)=>{let lt=[];for(let qe=ue.ws;qe<=ue.we;qe++)lt.push({serial:qe,date:Q.serialToDate(qe),isWeekend:wi(Q,qe),isHoliday:We.has(qe)});let st=yf(b,lt,Be);de[Oe]={days:lt,capByDay:st};}),de},[we,Q,We,b,Be]),me=k==="semana"||k==="lookahead",et=k==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(fu,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:de=>c(de==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsx(fu,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:de=>c(de==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsx(uf,{monthLabel:ke,onPrev:wt,onNext:je,onToday:dt,layersOpen:D,onToggleLayers:()=>P(de=>!de),layersOff:N,phases:ce,phaseFilter:O,onPhaseChange:J,locale:n,children:D?jsx(pf,{off:N,onToggle:mt}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:et?"hidden":void 0},children:[et?jsx(Ef,{grid:Q,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,locale:n,onTaskOpen:i}):me?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx(kf,{grid:Q,weeks:we,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,locale:n,capRows:Ue,teamSize:Fe,onTaskOpen:i,onMore:(de,ue,Oe)=>Le({day:de,items:ue,tasks:Oe}),onCapDay:(de,ue,Oe)=>{for(let lt of Object.keys(Ue)){let st=Ue[+lt].capByDay.get(de);if(st){Ne({dayLabel:ue,perPerson:st.perPerson,anchor:Oe.getBoundingClientRect()});break}}}})]}):rt.isEmpty?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(de=>jsx(Af,{grid:Q,ws:de.ws,we:de.we,todaySerial:Te,showFestivos:vt,holidaySerials:We,locale:n,deadlineDays:new Set},de.ws))}),jsx(ff,{monthLabel:ke,locale:n,onCreateTask:f})]}):jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(de=>jsx(QC,{grid:Q,ws:de.ws,we:de.we,tasks:Ie,items:ht,money:l,projColor:Pe,todaySerial:Te,showFestivos:vt,holidaySerials:We,locale:n,onTaskOpen:i,onMore:(ue,Oe,lt)=>Le({day:ue,items:Oe,tasks:lt}),canReschedule:v,onDragReschedule:A,pendingGhost:U?{uid:U.uid,days:Math.round((U.sim.newStart.getTime()-U.sim.oldStart.getTime())/864e5)}:null},de.ws))})]}),L?jsx(gf,{dayLabel:`${Q.serialToDate(L.day).getDate()}`,items:L.items,tasks:L.tasks.map(de=>({swatch:Pe,taskId:de.id,label:de.name,critical:de.critical,value:l==="$"?de.cost:`${de.hrs}h`})),onClose:()=>Le(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,G?jsx(vf,{dayLabel:G.dayLabel,perPerson:G.perPerson,onClose:()=>Ne(null),style:{position:"fixed",top:`${G.anchor.top-8}px`,left:`${G.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,U?jsx(Sf,{taskName:U.taskName,taskId:U.sim.taskId,sim:U.sim,busy:oe,locale:n,onConfirm:X,onCancel:()=>ze(null),style:{position:"fixed",top:`${U.anchor.top+12}px`,left:`${Math.min(U.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),$?jsx(Nf,{items:q,money:l,projColor:Pe,onItemClick:de=>i?.(de),onCollapse:()=>ve(false),locale:n==="en"?"en":"es"}):jsx(Df,{onExpand:()=>ve(true),locale:n==="en"?"en":"es"})]}),jsx(df,{projects:R,locale:n==="en"?"en":"es"})]})}function Af({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=a;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return wi(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function QC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=useMemo(()=>ql(r,n,t,a),[r,n,t,a]),b=useMemo(()=>new Set(n.filter(I=>I.type==="deadline").map(I=>I.serial)),[n]),y=Math.max(XC,h.laneCount*ac+36),x=useRef(null),[w,k]=useState(null),M=(I,C)=>{if(!m||!f){p?.(C);return}I.preventDefault();let D=x.current;if(!D)return;let P=D.getBoundingClientRect().width/7,N=I.clientX,V=0,O=L=>{let Le=Math.round((L.clientX-N)/P);V=Le,k({id:C,days:Le});},J=L=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",J),k(null),V===0){p?.(C);return}let Le=new DOMRect(L.clientX,L.clientY,0,0);f(C,V,Le);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",J);};return jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(Af,{grid:e,ws:t,we:a,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((I,C)=>{let D=w?.id===I.t.uid?w.days:null,P=v?.uid===I.t.uid?v.days:null,N=D??P??0,V=D==null&&P!=null,O=N!==0?{...I,s:I.s+N,e:I.e+N}:I;return jsx("div",{onPointerDown:J=>M(J,I.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(Jl,{bar:O,ws:t,money:s,projColor:o,slotH:ac})},`b${C}`)}),h.chips.map((I,C)=>jsx(Ql,{chip:I,ws:t,slotH:ac},`c${C}`)),h.more.map((I,C)=>jsx(Zl,{more:I,ws:t,slotH:ac,onClick:()=>d(I.day,I.items,r.filter(D=>D.startSerial<=I.day&&D.endSerial>=I.day))},`m${C}`))]})]})}function e2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=useState(false),u=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=useMemo(()=>{let m=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:p.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:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var Rf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ci(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Ti(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 Bf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function $f({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...Rf,...o}),[o]),[i,u]=useState(new Set),p=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],k=y.get(w);k?k.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{u(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),I=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:I<7?`${I}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[Ti(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>a({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,children:d.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((x,w)=>{let k=i.has(x.id),M=s===x.id,I=Bf(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:I},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Ti(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:Ci(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},C)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([C,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Hf({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],p=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&Ti(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&Ci(p)}),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:p&&p.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:m=>l(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:Ci(m)},m.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),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:p&&p.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function vu(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function wu(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 Uf(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 Wf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function s2(e,t,a,r,n,s=100){let o=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})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(u=>{let p=a/2,d=r/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function zf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=s2(e,t,a.width,a.height,a,150);p(O);},[e,t,a]);let M=useCallback((O,J)=>{a.enableDragging&&(J.stopPropagation(),m(O));},[a.enableDragging]),I=useCallback(O=>{if(!d||!i.current)return;let L=i.current.getBoundingClientRect(),Le=(O.clientX-L.left-w.x)/y,G=(O.clientY-L.top-w.y)/y;p(Ne=>Ne.map($=>$.id===d?{...$,x:Le,y:G,fx:Le,fy:G}:$));},[d,y,w]),C=useCallback(()=>{m(null);},[]),D=useCallback((O,J)=>{J.stopPropagation(),l?.({type:"node-click",node:O,position:{x:J.clientX,y:J.clientY}});},[l]),P=useCallback((O,J)=>{J.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:J.clientX,y:J.clientY}});},[l]),N=useCallback(O=>{let J=u.find(L=>L.id===O);return J?{x:J.x,y:J.y}:{x:0,y:0}},[u]),V=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let J=O.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:g("relationships-graph",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:vu(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Uf(O)," ",wu(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let J=N(typeof O.source=="string"?O.source:O.source.id),L=N(typeof O.target=="string"?O.target:O.target.id),Le=Wf(O.type),G=h===O.id,Ne=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",G&&"hovered",Ne&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:$=>P(O,$),children:[jsx("line",{x1:J.x,y1:J.y,x2:L.x,y2:L.y,stroke:vu(O.type),strokeWidth:Ne?a.edgeWidth*2:a.edgeWidth,strokeOpacity:G?1:.6,markerEnd:Le?"url(#arrowhead)":void 0}),a.showEdgeLabels&&G&&jsx("text",{x:(J.x+L.x)/2,y:(J.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:wu(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let J=f===O.id,L=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",J&&"hovered",L&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Le=>M(O.id,Le),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Le=>D(O,Le),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:V(O),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:J?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 jf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=l||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(a(p),v());};return e?jsxs(ua,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:v,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:p?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!"})]}),p.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:p.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((y,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((y,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.priority})]})},x)),p.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,value:s,onChange:y=>o(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,x)=>jsx("button",{onClick:()=>o(y),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:y},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:v,disabled:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),p?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ku={"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 l2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},c2={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 d2(e,t,a){let r=ku[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Ni(e){return `$${e.toFixed(4)}`}var Cu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=d2(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(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,n=a.reduce((p,d)=>p+d.cost,0),s=a.reduce((p,d)=>p+d.inputTokens,0),o=a.reduce((p,d)=>p+d.outputTokens,0),l=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),i={},u={};return a.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Yo=new Cu;function qf({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Yo.getStats()),[s,o]=useState(Yo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Yo.getStats()),o(Yo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=Yo.getRecentOperations(5);return jsxs(ua,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",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:Ni(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-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let u=r.costsByFeature[c]||0,p=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(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 Jf({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(null),w=useRef(null),k=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=N=>{N.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},I=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(a(h),M());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ua,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:M,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",D,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,N)=>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:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:k}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:P=>p(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,N)=>jsx("button",{onClick:()=>l(P),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},N))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:C,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:I,disabled:!o.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function oc({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(h=>{t&&Hi(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{r(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},I=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(N=>N!==h)};if(P.id===b){let N=I.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:N.map(V=>V.id)}}return P}),D={...x,cards:I,columns:C};return n(D),D});},[n]),o=useCallback(async(h,b)=>{r(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{r(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(I=>I!==h)}:M),k={...b,cards:x,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=useCallback(async(h,b)=>{r(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=useCallback(async h=>{r(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Zf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=oc({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},tb={by:"none",order:"asc"};function ab({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...Di,...e}),[s,o]=useState({...tb,...t}),l=useCallback(v=>{n(h=>({...h,...v}));},[]),c=useCallback(v=>{o(h=>({...h,...v}));},[]),i=useCallback(()=>{n(Di),o(tb);},[]),u=useCallback(()=>{a&&n({...Di,assignees:[a]});},[a]),p=useCallback(()=>{n({...Di,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...Di,priorities:["HIGH","URGENT"]});},[]),m=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]),f=useCallback(v=>{let h=[...v];if(r.search){let b=r.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let I=M.endDate||M.dueDate;if(!I)return false;let C;if(typeof I=="string")C=I.split("T")[0]||I;else {let D=I.getUTCFullYear(),P=String(I.getUTCMonth()+1).padStart(2,"0"),N=String(I.getUTCDate()).padStart(2,"0");C=`${D}-${P}-${N}`;}switch(r.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let D=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),N=new Date(D);return N.setDate(N.getDate()+7),P>=D&&P<=N;case "custom":if(r.dateRange){let V=typeof I=="string"?new Date(I):I;return V>=r.dateRange.start&&V<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let x=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=I-C;break;case "dueDate":let D=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!D)return 1;if(!P)return -1;let N=typeof D=="string"?new Date(D).getTime():D.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=N-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,J=y.estimatedTime||0;x=O-J;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var nb,ob;if(typeof window<"u")try{let e=Bi("ai");nb=e.generateObject,ob=e.generateText;}catch{}function sb(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(nb&&ob&&e.apiKey),o=useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",p),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{a(false);}},[s]),l=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{a(false);}},[s]),c=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{a(false);}},[s]),i=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),u=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Nu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function ib(e){let{cards:t}=e,[a,r]=Nu(),n=useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=useCallback((p,d)=>{if(!d){r({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,D)=>C.position-D.position),y=b.findIndex(C=>C.id===a.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),I=Array.from(new Set([...a.selectedCardIds,...M]));r({selectedCardIds:I,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),o=useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(p=>{a.selectedCardIds.includes(p)?o(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,o,r]),u=useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var lb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function cb(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...lb,...a}),[a]),[s,o]=useState([]),l=useCallback((v,h,b,y,x)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=useCallback(async v=>{let h=t.filter(k=>k.columnId===v);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${I} ${M} Priority`,cardIds:k.map(C=>C.id),columnId:v,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let k of h){let I=(await r.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(I.length>=n.minCardsPerStack-1){let C=[k.id,...I.map(P=>P.card.id)],D=I.reduce((P,N)=>P+N.similarity,0)/I.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:D});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var db=createContext(null);function ub({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=Bi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Bi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Bi("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(db.Provider,{value:{store:n},children:e})}function sc(){let e=useContext(db);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ei(){let e=sc(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),p=useCallback(y=>e.getColumn(y),[e]),d=useCallback(y=>{e.addCard(y);},[e]),m=useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),v=useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function mb(e){let{cards:t}=Ei();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!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(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function gb(e="position",t="asc"){let{cards:a}=Ei();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var ic=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=ap.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 n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},S2=new ic;function bb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:d,className:n,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(v,f.index)},h)})})})}function hb(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 xb({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),p=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let h=e[v.index];if(!h)return null;let b=c?c(h,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:y,"data-index":v.index,children:n(h,v.index)},b)})})})}function vb(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 wb(e,t=10){return e>t}var Mu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Pu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Fu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Lu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Au={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Iu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ru={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bu={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)"},$u={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)"},Ou={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Hu={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Uu={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}},lc={spacing:Mu,borderRadius:Pu,fontSize:Fu,fontWeight:Lu,lineHeight:Au,zIndex:Iu,duration:Ru,easing:Bu,shadows:$u,opacity:Ou,kanban:Hu,gantt:Uu};function kb(e,t,a){return e[t]??a}function Wu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Wu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function P2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zu(e="asakaa"){let t=Wu(lc),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=P2(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${a.join(`
|
|
416
416
|
`)}
|
|
417
|
-
}`}function
|
|
417
|
+
}`}function Mi(e,t="asakaa"){let a=[],r=Wu(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
|
|
418
418
|
${a.join(`
|
|
419
419
|
`)}
|
|
420
|
-
}`}var
|
|
420
|
+
}`}var cc={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},Gu={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},Vu={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function ju(e=cc,t="asakaa"){let a=zu(t),r=Mi(e,t);return `${a}
|
|
421
421
|
|
|
422
|
-
${r}`}function
|
|
422
|
+
${r}`}function Cb(){return `/**
|
|
423
423
|
* ASAKAA Design Tokens
|
|
424
424
|
* Auto-generated from design-tokens.ts
|
|
425
425
|
* Do not edit this file directly
|
|
426
426
|
*/
|
|
427
427
|
|
|
428
|
-
${
|
|
428
|
+
${ju(cc)}
|
|
429
429
|
|
|
430
430
|
/* Light theme */
|
|
431
431
|
[data-theme="light"] {
|
|
432
|
-
${
|
|
432
|
+
${Mi(Gu,"asakaa").split(`
|
|
433
433
|
`).slice(1,-1).join(`
|
|
434
434
|
`)}
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
/* Neutral theme */
|
|
438
438
|
[data-theme="neutral"] {
|
|
439
|
-
${
|
|
439
|
+
${Mi(Vu,"asakaa").split(`
|
|
440
440
|
`).slice(1,-1).join(`
|
|
441
441
|
`)}
|
|
442
442
|
}
|
|
443
|
-
`}var F2=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function
|
|
444
|
-
export{
|
|
443
|
+
`}var F2=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Tb({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:n,themes:s}=bs();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,l])=>{let c=o,i=c===r;return jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(F2,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
444
|
+
export{qf as AIUsageDashboard,c2 as AI_FEATURES,ku as AI_MODELS,Vc as AddCardButton,Hc as AddColumnButton,ms as AttachmentUploader,ub as BoardProvider,cl as BulkOperationsToolbar,Qc as BurnDownChart,tf as CUSTOM_FIELD_TYPES,Lf as CalendarBoard,Wn as Card,Hf as CardHistoryReplay,$f as CardHistoryTimeline,zf as CardRelationshipsGraph,e2 as CardStack,od as CardTemplateSelector,yc as CircuitBreaker,ls as Column,fl as ColumnManager,Kc as CommandPalette,cd as ConfigMenu,xs as ContextMenu,ni as DEFAULT_SHORTCUTS,Z0 as DEFAULT_TABLE_COLUMNS,nd as DEFAULT_TEMPLATES,Vs as DateRangePicker,_s as DependenciesSelector,ui as DependencyLine,Zc as DistributionCharts,Dc as EditableColumnTitle,ps as ErrorBoundary,_m as ExportDropdown,id as ExportImportModal,ld as FilterBar,Sg as GANTT_AI_SYSTEM_PROMPT,Sl as GanttAIAssistant,Cg as GanttBoard,ys as GanttI18nContext,Cl as GanttMilestone,gl as GanttToolbar,Jf as GenerateGanttTasksDialog,jf as GeneratePlanModal,ad as GroupBySelector,Lc as HealthBar,co as KanbanBoard,$c as KanbanToolbar,ai as KanbanViewAdapter,rd as KeyboardShortcutsHelp,Q0 as ListView,sa as MenuIcons,ic as PluginManager,Po as PrioritySelector,Ac as ProfitabilityReport,ei as QuickTaskCreate,l2 as RATE_LIMITS,ef as STANDARD_FIELDS,ed as SwimlaneBoardView,Ec as TagBadge,Hp as TagList,cs as TagPicker,yl as TaskBar,Ro as TaskDetailModal,Dg as TaskFormModal,hl as TaskGrid,md as ThemeModal,Rm as ThemeProvider,Tb as ThemeSwitcher,Sn as TimeInputPopover,Mc as TimePill,Pc as TimePopover,Tl as Timeline,Lo as UserAssignmentSelector,Jc as VelocityChart,xb as VirtualGrid,bb as VirtualList,Yo as aiUsageTracker,Pu as borderRadius,Yl as buildCalendar,Oi as calculatePosition,Pl as cardToGanttTask,Ig as cardsToGanttTasks,g as cn,fm as createKanbanView,Wb as createRetryWrapper,dd as darkTheme,cc as darkTokenTheme,ul as defaultTheme,lc as designTokens,Ru as duration,Bu as easing,Cb as exportTokensToCSS,Kn as findTaskByName,Fu as fontSize,Lu as fontWeight,Ni as formatCost,ml as ganttEnTranslations,$m as ganttEsTranslations,Ag as ganttTaskToCardUpdate,ct as ganttThemes,Uu as ganttTokens,gd as ganttTranslations,Ee as ganttUtils,zu as generateCSSVariables,ju as generateCompleteCSS,$b as generateInitialPositions,Eg as generateTasksContext,Mi as generateThemeVariables,af as getListViewTheme,Ud as getListViewTranslations,kb as getToken,Om as getTranslations,Hu as kanbanTokens,ud as lightTheme,Gu as lightTokenTheme,Au as lineHeight,uu as listViewDarkTheme,Od as listViewEnTranslations,Hd as listViewEsTranslations,pu as listViewLightTheme,mu as listViewNeutralTheme,Kl as listViewThemes,Fl as listViewTranslations,Ll as mergeListViewTranslations,fd as mergeTranslations,pd as neutralTheme,Vu as neutralTokenTheme,Ou as opacity,Fg as parseLocalCommand,Rd as parseNaturalDate,Bd as parseNaturalDuration,$d as parseProgress,Pg as parseStatus,S2 as pluginManager,Ub as retrySyncOperation,Hi as retryWithBackoff,$u as shadows,wb as shouldVirtualizeGrid,tc as simulateReschedule,Mu as spacing,$o as themes,sb as useAI,Zf as useBoard,Ei as useBoardCore,sc as useBoardStore,cb as useCardStacking,Rc as useDragState,mb as useFilteredCards,ab as useFilters,Xr as useGanttI18n,oc as useKanbanState,Lm as useKeyboardShortcuts,ib as useMultiSelect,Nu as useSelectionState,gb as useSortedCards,bs as useTheme,vb as useVirtualGrid,hb as useVirtualList,Lg as validateAIResponse,jc as withErrorBoundary,zi as wouldCreateCircularDependency,Iu as zIndex};//# sourceMappingURL=index.js.map
|
|
445
445
|
//# sourceMappingURL=index.js.map
|