@libxai/board 1.5.13 → 1.5.14

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.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 hf 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,CheckSquare,ChevronDown,Calendar,Hash,Type,Users,CalendarClock,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,FileJson,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import Rh from'react-markdown';import Oh from'remark-gfm';import $h from'rehype-sanitize';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 vs=(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 ws=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 [ws.Translate.toString(e),ws.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function ks(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 pf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Zi(e,t){return e.length===0?1e3:t===0?ks(null,e[0].position):t>=e.length?ks(e[e.length-1].position,null):ks(e[t-1].position,e[t].position)}function Uc(e,t=100){return e>t}var mf=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 gf(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Cs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=mf,onRetry:d}=t,p,l=0;for(let c=1;c<=a;c++){l=c;try{return {data:await e(),attempts:l,success:!0}}catch(i){if(p=i,c===a||!n(p,c))return {error:p,attempts:l,success:false};let g=gf(c,r,o,s);if(d)try{d(p,c,g);}catch(h){console.error("Error in retry callback:",h);}await new Promise(h=>setTimeout(h,g));}}return {error:p||new Error("Unknown error"),attempts:l,success:false}}function ff(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function bf(e,t={}){return async(...a)=>Cs(()=>e(...a),t)}var el=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 Wc=(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))(Wc||{}),Do=class Do{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,p=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,p?n:"");break;case "INFO":console.info(d,o,p?n:"");break;case "WARN":console.warn(d,o,p?n:"");break;case "ERROR":console.error(d,o,p?n:""),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",...Do.globalOptions};}static configure(t){Do.globalOptions={...Do.globalOptions,...t};}child(t){return new Do({...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 Ts((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ts(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Wc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Do.globalOptions={};var tl=Do,Ts=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}},Vc=new tl;function yf(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 xf(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 n=e.columns.find(d=>d.id===s.columnId);return [s.id,al(s.title),al(s.description||""),al(n?.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 vf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await hf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),p=297,l=210,c=n.width/n.height,i=p-20,m=i/c;m>l-20&&(m=l-20,i=m*c);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,p,15,"F"),g.text(e.title||"Kanban Board",10,10);let h=(p-i)/2;return g.addImage(d,"PNG",h,20,i,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let d=e.cards.filter(p=>p.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(p.description,160);o.text(c,25,s),s+=c.length*5;}let l=[];if(p.priority&&l.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&l.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&l.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let c=[];p.startDate&&c.push(`Start: ${p.startDate}`),p.endDate&&c.push(`End: ${p.endDate}`),l.push(c.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function al(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function _c(e,t,a,r){switch(t){case "json":return yf(e,r);case "csv":return xf(e);case "pdf":return await vf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function jc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),p=URL.createObjectURL(d),l=document.createElement("a");l.href=p,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(p);}function wf(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 kf(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=Kc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=Kc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let l={};a.forEach((g,h)=>{l[g]=d[h]||"";});let c=l.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let i=o.get(c),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),i.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.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 Kc(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Yc(e,t){switch(t){case "json":return wf(e);case "csv":return kf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function qc(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var rl=createContext(null);function Xc(){return useContext(rl)}var Jc=createContext(null);function Qc({children:e,themeName:t}){return jsx(Jc.Provider,{value:{themeName:t},children:e})}function Qo(){return useContext(Jc)}function It({children:e,container:t}){let[a,r]=useState(false),o=Xc(),s=Qo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:p}=o,l={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return createPortal(jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var ru={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Pf="#BDC3C7",Mf=({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 So({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),l=()=>{if(!p.current)return;let g=p.current.getBoundingClientRect(),h=window.innerHeight,b=window.innerWidth,w=160,f=220,x=4,k=g.right-w;k<10&&(k=g.left),k+w>b-10&&(k=b-w-10);let v=h-g.bottom,C=g.top,N;v>=f+x?N=g.bottom+x:C>=f+x?N=g.top-f-x:N=v>=C?g.bottom+x:Math.max(10,g.top-f-x),n({top:N,left:k}),o(true);};useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&!p.current?.contains(h.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=h=>{h.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},i=e?ru[e]:null,m=i?.color||Pf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,onClick:()=>r?o(false):l(),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?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:i?.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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(It,{children:jsxs("div",{ref:d,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(ru).map(([g,h])=>jsxs("button",{onClick:()=>c(g),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: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(Mf,{color:h.color}),jsx("span",{className:"font-semibold text-sm",children:h.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:()=>c(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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Af=[{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 Mn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),p=useRef(null),l=useRef(null),m=(Qo()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let k=l.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=320,E=380,T=4,B=k.left;B+N>C-10&&(B=C-N-10),B<10&&(B=10);let O=v-k.bottom,I=k.top,G;O>=E+T?G=k.bottom+T:I>=E+T?G=k.top-E-T:G=O>=I?k.bottom+T:Math.max(10,k.top-E-T),d({top:G,left:B}),s(true);};useEffect(()=>{let k=v=>{p.current&&!p.current.contains(v.target)&&!l.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),useEffect(()=>{let k=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let h=k=>{let v=new Date,C=B=>{let O=B.getFullYear(),I=String(B.getMonth()+1).padStart(2,"0"),G=String(B.getDate()).padStart(2,"0");return `${O}-${I}-${G}`},N=C(v),E=new Date(v);E.setDate(E.getDate()+k);let T=C(E);a(N,T),s(false);},b=()=>{if(!e||!t)return "Set date";let k=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=E.split("-").map(Number);if(T.length!==3||T.some(G=>isNaN(G)))return null;let B=T[0],O=T[1],I=T[2];return B===void 0||O===void 0||I===void 0?null:new Date(B,O-1,I)},v=k(e),C=k(t);if(!v||!C||isNaN(v.getTime())||isNaN(C.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[v.getMonth()]} ${v.getDate()} \u2013 ${N[C.getMonth()]} ${C.getDate()}`},w=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),k<v})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:w?`${b()}`:"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:b()})]}),o&&jsx(It,{children:jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:Af.map(k=>jsx("button",{onClick:()=>h(k.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"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:k=>a(k.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:k=>a(e,k.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[d,p]=useState(""),[l,c]=useState({top:0,left:0}),i=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let x=m.current.getBoundingClientRect(),k=window.innerHeight,v=window.innerWidth,C=300,N=380,E=4,T=x.right-C;T<10&&(T=x.left),T+C>v-10&&(T=v-C-10);let B=k-x.bottom,O=x.top,I;B>=N+E?I=x.bottom+E:O>=N+E?I=x.top-N-E:I=B>=O?x.bottom+E:Math.max(10,x.top-N-E),c({top:I,left:T}),n(true);};useEffect(()=>{let x=k=>{i.current&&!i.current.contains(k.target)&&!m.current?.contains(k.target)&&(n(false),p(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),p(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let h=x=>{let k=e.some(v=>v.id===x.id);a(k?e.filter(v=>v.id!==x.id):[...e,x]);},b=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),w=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:m,onClick:()=>s?n(false):g(),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:[w.map(x=>jsx("div",{className:"asakaa-avatar",title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"asakaa-avatar-img"}):x.initials},x.id)),f>0&&jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(It,{children:jsxs("div",{ref:i,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.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:d,onChange:x=>p(x.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:b.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"}):b.map(x=>{let k=e.some(v=>v.id===x.id);return jsxs("button",{onClick:()=>h(x),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.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:x.color,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.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:x.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},x.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(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 Ns(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let l=p.dependencies.map(c=>{if(typeof c=="string")return c;let i=c;return i.taskId||i.targetId||""}).filter(Boolean);r.set(p.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=p=>{if(!s.has(p)){s.add(p),n.add(p);let l=r.get(p)||[];for(let c of l){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(p),false};return d(a)}function Ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,p]=useState(false),[l,c]=useState(""),[i,m]=useState(t.length>0),[g,h]=useState({top:0,left:0}),[b,w]=useState(null),f=useRef(null),x=useRef(null),k=()=>{if(!x.current)return;let T=x.current.getBoundingClientRect(),B=window.innerHeight,O=window.innerWidth,I=300,G=i?380:120,S=4,ce=T.right-I;ce<10&&(ce=T.left),ce+I>O-10&&(ce=O-I-10);let M=B-T.bottom,q=T.top,ke;M>=G+S?ke=T.bottom+S:q>=G+S?ke=T.top-G-S:ke=M>=q?T.bottom+S:Math.max(10,T.top-G-S),h({top:ke,left:ce}),p(true);};useEffect(()=>{if(!d||!x.current)return;let T=x.current.getBoundingClientRect(),B=window.innerHeight,O=window.innerWidth,I=300,G=i?380:120,S=4,ce=T.right-I;ce<10&&(ce=T.left),ce+I>O-10&&(ce=O-I-10);let M=B-T.bottom,q=T.top,ke;M>=G+S?ke=T.bottom+S:q>=G+S?ke=T.top-G-S:ke=M>=q?T.bottom+S:Math.max(10,T.top-G-S),h({top:ke,left:ce});},[i,d]),useEffect(()=>{let T=B=>{f.current&&!f.current.contains(B.target)&&!x.current?.contains(B.target)&&(p(false),c(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),useEffect(()=>{let T=B=>{B.key==="Escape"&&(p(false),c(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let v=T=>{let B=t.includes(T),O=a.find(I=>I.id===T);if(w(null),B){let I=t.filter(G=>G!==T);r(I),I.length===0&&m(false);}else {if(s&&Ns(a,T,e)){let G=`Cannot add "${O?.title||T}" as dependency - would create circular reference`;w(G),n?.(T,O?.title||T),setTimeout(()=>w(null),3e3);return}r([...t,T]),m(true);}},C=()=>{let T=!i;m(T),T||r([]);},N=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),E=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:x,onClick:()=>d?p(false):k(),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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),d&&jsx(It,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.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:[b&&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:b})]}),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:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&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"})]})}),i&&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:l,onChange:T=>c(T.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:N.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"}):N.map(T=>{let B=t.includes(T.id);return jsxs("button",{onClick:()=>v(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:O=>{O.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:O=>{O.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:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),p(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 Yr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:p=[]})=>{let{attributes:l,listeners:c,setNodeRef:i,transform:m,transition:g,isDragging:h}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:ws.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:i,style:b,...l,...c,onClick:()=>a?.(e),children:t(e)});let w=d.filter(v=>e.assignedUserIds?.includes(v.id)),f=e.progress===100,x=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),k={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:i,style:k,className:u("asakaa-card",h&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...c,onClick:v=>{v.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:v=>{v.currentTarget.style.display="none";}})}),x.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:x.length===1&&x[0]?jsx("img",{src:x[0].url,alt:x[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:v=>{v.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((v,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),C===3&&x.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:["+",x.length-4]})})]},v.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:v=>v.stopPropagation(),className:"priority-selector",children:jsx(So,{priority:e.priority,onChange:v=>n?.(e.id,{priority:v})})}),jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsx(Mn,{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:(v,C)=>n?.(e.id,{startDate:v,endDate:C})})}),d.length>0&&jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:w,availableUsers:d,onChange:v=>n?.(e.id,{assignedUserIds:v.map(C=>C.id)})})}),jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsx(Ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:p,onChange:v=>n?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsx("span",{className:"asakaa-label",children:v},v))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));Yr.displayName="Card";var Ds={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"}},mu=({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 gu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),p=useRef(null),l=useRef(null),c=[...Object.entries(Ds).map(([w,f])=>({id:w,label:f.label,color:f.color,icon:f.icon})),...r.filter(w=>!Object.keys(Ds).includes(w.id)).map(w=>({id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let w=Ds[e];if(w)return {...w,id:e};let f=r.find(x=>x.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ds.todo,id:"todo"}},m=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,v=280,C=4,N=w.right-k;N<10&&(N=w.left),N+k>x-10&&(N=x-k-10);let E=f-w.bottom,T=w.top,B;E>=v+C?B=w.bottom+C:T>=v+C?B=w.top-v-C:B=E>=T?w.bottom+C:Math.max(10,w.top-v-C),d({top:B,left:N}),s(true);};useEffect(()=>{let w=f=>{p.current&&!p.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let g=w=>{t(w),s(false);},h=i(),b=h.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?s(false):m(),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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:h.label,children:jsx(mu,{icon:h.icon,color:b})}),o&&jsx(It,{children:jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:c.map(w=>jsxs("button",{onClick:()=>g(w.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:w.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(mu,{icon:w.icon,color:w.color}),jsx("span",{className:"font-semibold",children:w.label}),e===w.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},w.id))})]})})]})}var fu={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 bu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=fu[s]||fu.en,[d,p]=useState(false),[l,c]=useState(false),[i,m]=useState(e),[g,h]=useState({top:0,left:0}),b=useRef(null),w=useRef(null),f=useRef(null);useEffect(()=>{if(d&&w.current){let C=w.current.getBoundingClientRect();h({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[d]),useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!w.current?.contains(N.target)&&(p(false),c(false));};if(d)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]),useEffect(()=>{let C=N=>{N.key==="Escape"&&(p(false),c(false),m(e));};if(d)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[d,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let x=()=>{c(true),m(e);},k=()=>{let C=i.trim();C&&C!==e&&t(C),c(false),p(false),m(e);},v=C=>{C.key==="Enter"?k():C.key==="Escape"&&(c(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:w,onClick:()=>p(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.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"})]})}),d&&jsx(It,{children:jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:i,onChange:C=>m(C.target.value),onKeyDown:v,onBlur:k,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-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:x,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:n.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),p(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:n.delete})]})]})]})})})]})}var tn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:p,allCards:l,enableVirtualization:c,cardHeight:i=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:h,onColumnDelete:b,isDeletable:w=false,className:f,renderMetrics:x,locale:k})=>{let{setNodeRef:v,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),N=useRef(null),E=c??Uc(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>N.current,estimateSize:()=>i,enabled:E});if(a)return jsx("div",{ref:v,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),I=O.state==="exceeded",G=()=>"asakaa-column-count";return jsxs("div",{ref:v,className:u("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):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:u(G()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&O.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${O.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[O.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"})]}),O.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"})]}),O.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"})}),O.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"})]})]}),(h||b)&&jsx(bu,{columnTitle:e.title,onRename:S=>h?.(e.id,S),onDelete:b?()=>b(e.id):void 0,isDeletable:w,locale:k}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),x&&x(e,t),!m&&jsx("div",{ref:N,className:"asakaa-column-cards",style:{maxHeight:E?"600px":void 0},children:jsx(SortableContext,{items:t.map(S=>S.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"})}):E?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(S=>{let ce=t[S.index];return ce?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsx(Yr,{card:ce,render:r,onClick:n,onUpdate:d,availableUsers:p,allCards:l})},ce.id):null})}):t.map(S=>jsx(Yr,{card:S,render:r,onClick:n,onUpdate:d,availableUsers:p,allCards:l},S.id))})})]})});tn.displayName="Column";function ll({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),d=useRef(null);useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let p=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},l=c=>{c.key==="Enter"?p():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:p,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Qf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function ku(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let p=d.name.toLowerCase(),l=p.replace(/\s+/g,""),c=p.split(/\s+/);return !!(l===s||p===s||c.some(i=>i===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Zf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function eb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var tb=["\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 Cu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:p="es",currentUser:l,enableEmoji:c=true,enableAttachments:i=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:h,maxFileSizeMB:b=10}){let w=d==="dark",[f,x]=useState(false),[k,v]=useState([]),[C,N]=useState(0),[E,T]=useState(null),[B,O]=useState(false),I=useRef(null),G=useRef(null),S=useRef(null),ce=useRef(null),M=useCallback(($,Z)=>{let X=Qf($,Z);if(T(X),X){let fe=r.filter(Fe=>Fe.name.toLowerCase().includes(X.query)||Fe.email&&Fe.email.toLowerCase().includes(X.query)).slice(0,5);v(fe),x(fe.length>0),N(0);}else x(false),v([]);},[r]),q=$=>{let Z=$.target.value;if(t(Z),M(Z,$.target.selectionStart||0),I.current){I.current.style.height="24px";let X=I.current.scrollHeight,fe=280,Fe=Math.min(X,fe);I.current.style.height=`${Fe}px`,I.current.style.overflowY=X>fe?"auto":"hidden";}},ke=()=>{I.current&&M(e,I.current.selectionStart||0);},_e=useCallback($=>{if(!E||!I.current)return;let Z=e.slice(0,E.start),X=e.slice(E.end),fe=`@${$.name.replace(/\s+/g,"")} `,Fe=Z+fe+X;t(Fe),x(false),T(null),setTimeout(()=>{if(I.current){let Ke=E.start+fe.length;I.current.selectionStart=Ke,I.current.selectionEnd=Ke,I.current.focus();}},0);},[E,e,t]),P=$=>{if(f&&k.length>0)switch($.key){case "ArrowDown":$.preventDefault(),N(Z=>Z<k.length-1?Z+1:0);break;case "ArrowUp":$.preventDefault(),N(Z=>Z>0?Z-1:k.length-1);break;case "Enter":{$.preventDefault();let Z=k[C];Z&&_e(Z);break}case "Tab":{$.preventDefault();let Z=k[C];Z&&_e(Z);break}case "Escape":$.preventDefault(),x(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};useEffect(()=>{let $=Z=>{G.current&&!G.current.contains(Z.target)&&I.current&&!I.current.contains(Z.target)&&x(false),ce.current&&!ce.current.contains(Z.target)&&O(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let V=useCallback($=>{if(!I.current)return;let Z=I.current.selectionStart||e.length,X=e.slice(0,Z)+$+e.slice(Z);t(X),O(false),setTimeout(()=>{if(I.current){let fe=Z+$.length;I.current.selectionStart=fe,I.current.selectionEnd=fe,I.current.focus();}},0);},[e,t]),re=useCallback($=>{if(!g||!$.target.files)return;let Z=Array.from($.target.files),X=b*1024*1024,fe=Z.filter(Fe=>Fe.size>X?(console.warn(`File ${Fe.name} exceeds max size of ${b}MB`),false):true);fe.length>0&&g(fe),$.target.value="";},[g,b]),Te=useCallback($=>$.type.startsWith("image/")?Image:$.type.includes("pdf")||$.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&G.current){let $=G.current.children[C];$&&$.scrollIntoView({block:"nearest"});}},[C,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map($=>{let Z=Te($.file),X$1=$.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",w?"bg-white/10":"bg-gray-100"),children:[X$1&&$.preview?jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Z,{className:u("w-4 h-4",w?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",w?"text-white":"text-gray-900"),children:$.file.name}),jsx("p",{className:u("text-xs",w?"text-[#6B7280]":"text-gray-400"),children:eb($.file.size)})]}),h&&jsx("button",{onClick:()=>h($.id),className:u("p-0.5 rounded-full transition-colors",w?"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"})})]},$.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&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:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",w?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>O(!B),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",w?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:B&&jsx(motion.div,{ref:ce,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",w?"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:tb.map($=>jsx("button",{type:"button",onClick:()=>V($),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",w?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),i&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>S.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",w?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:p==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:S,type:"file",multiple:true,onChange:re,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:I,value:e,onChange:q,onSelect:ke,onKeyDown:P,placeholder:o||(p==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",w?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":w?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&k.length>0&&jsx(motion.div,{ref:G,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",w?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:k.map(($,Z)=>jsxs("button",{type:"button",onClick:()=>_e($),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Z===C?w?"bg-white/10":"bg-gray-100":w?"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:$.color||"#8B5CF6"},children:Zf($.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",w?"text-white":"text-gray-900"),children:$.name}),$.email&&jsx("p",{className:u("text-xs truncate",w?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function Tu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[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((d,p)=>d.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},p):jsx("span",{children:d.value},p))})}var Ms=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,p]=useState(false),[l,c]=useState(""),[i,m]=useState(false),[g,h]=useState(Ms[10]||"#2E94FF"),[b,w]=useState({top:0,left:0}),f=useRef(null),x=useRef(null),k=useRef(null),v=useRef(null),C=t.filter(I=>I.name.toLowerCase().includes(l.toLowerCase())),N=t.some(I=>I.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(d&&x.current){let I=x.current.getBoundingClientRect();w({top:I.bottom+6,left:I.left});}},[d]),useEffect(()=>{let I=G=>{let S=G.target,ce=f.current?.contains(S),M=k.current?.contains(S);!ce&&!M&&(p(false),c(""),m(false));};if(d)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[d]),useEffect(()=>{d&&v.current&&v.current.focus();},[d]);let E=I=>{let G=e.some(S=>S.id===I.id);a(G?e.filter(S=>S.id!==I.id):[...e,I]);},T=async()=>{if(!(!r||!l.trim())){m(true);try{let I=await r(l.trim(),g);I&&(a([...e,I]),c(""),h(Ms[Math.floor(Math.random()*Ms.length)]||"#2E94FF"));}finally{m(false);}}},B=(I,G)=>{G.stopPropagation(),a(e.filter(S=>S.id!==I));},O={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:x,type:"button",onClick:()=>!s&&p(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,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(I=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${I.color}20`,color:I.color},children:I.name},I.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:k,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:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:v,type:"text",value:l,onChange:I=>c(I.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:I=>{I.key==="Enter"&&l.trim()&&!N&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(I=>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:`${I.color}20`,color:I.color},onClick:G=>B(I.id,G),children:[I.name,jsx(X,{className:"w-3 h-3"})]},I.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(I=>{let G=e.some(S=>S.id===I.id);return jsxs("button",{type:"button",onClick:()=>E(I),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${I.color}15`:"transparent",color:o.textPrimary},onMouseEnter:S=>{G||(S.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:S=>{G||(S.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:I.color}}),jsx("span",{className:"flex-1 text-left",children:I.name}),G&&jsx(Check,{className:"w-4 h-4",style:{color:I.color}})]},I.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!N&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ms.map(I=>jsx("button",{type:"button",onClick:()=>h(I),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:I,outline:g===I?`2px solid ${I}`:"none",outlineOffset:"2px"}},I))}),jsxs("button",{type:"button",onClick:T,disabled:i,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:i?.7:1},children:[i?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 "',l.trim(),'"']})]})]})}),document.body)]})}function cl({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:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Du({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(cl,{tag:s,size:a},s.id)),o>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:["+",o]})]})}var Mo=[{name:"Azul",value:"#2E94FF",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:"#06B6D4",light:"#22D3EE"},{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 Su(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 cb(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 ub({className:e}){return jsxs("svg",{className:u("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 ul({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=cb(e.health),n={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"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},p=Su(e.loggedMinutes),l=e.estimateMinutes?Su(e.estimateMinutes):null,c=a&&l?`${p} / ${l}`:p;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(ub,{className:d[t]}),jsx("span",{children:c})]})}function Fu(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Ls(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 gb(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 fb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function bb({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 Pu({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 hb({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 pl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:p,onDiscardTimer:l,onClose:c,className:i}){let[m,g]=useState(""),[h,b]=useState(t.estimateMinutes?Ls(t.estimateMinutes):""),[w,f]=useState(""),[x,k]=useState(false),[v,C]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let E=async()=>{let O=Fu(m);if(!(O<=0||!s)){k(true);try{await s({durationMinutes:O,note:w.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},T=async()=>{if(!n)return;let O=h.trim()?Fu(h):null;await n(O),C(false);},B=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),E()),O.key==="Escape"&&c?.();};return jsxs("div",{className:u("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",i),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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Pu,{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:gb(o)})]}),jsx("button",{onClick:p,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(bb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,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(Pu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:d,className:u("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(fb,{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(hb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:m,onChange:O=>g(O.target.value),onKeyDown:B,placeholder:"8 (=8h), 2h 30m",className:u("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-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:E,disabled:x||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:w,onChange:O=>f(O.target.value),onKeyDown:B,placeholder:"Note (optional)",className:u("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-blue-500 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:Ls(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"}),v?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:h,onChange:O=>b(O.target.value),onKeyDown:O=>{O.key==="Enter"&&T(),O.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Ls(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:u("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:u("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(O=>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:O.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ls(O.durationMinutes)})]},O.id))})]})]})}function kb(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Cb(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 Or({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,p]=useState(Cb(r)),[l,c]=useState(""),[i,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let h=async()=>{m(true);let k=kb(d);await o(k&&k>0?k:null,l||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},w=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),h()),k.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},x=t==="es";return jsxs("div",{className:u("w-56",n),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:k=>k.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":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[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:g,type:"text",value:d,onChange:k=>p(k.target.value),onKeyDown:w,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 2:30"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:k=>c(k.target.value),onKeyDown:w,placeholder:x?"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:h,disabled:i||!d.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,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:i?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:b,disabled:i,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:x?"Quitar":"Clear"})]})]})}function Tb(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 Nb(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 gl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Tb(e.health),s=Nb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,p=Math.min(100,d),l=d>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${p}%`}}),l&&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:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function an(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 Sb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Eb(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-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";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 Fb(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 Pb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=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",n=a?"border-white/5":"border-gray-200",d=a?"text-[#9CA3AF]":"text-gray-500",p=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:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",an(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",d),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:u("font-medium",p),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",p),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:u("font-medium",p),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",d),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:d,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",p),children:an(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",p),children:an(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",p),children:e.totalTasksWithEstimate})]})]})]})]})}function Mb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",d),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?an(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:an(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,an(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Eb(e.status,a),Sb(e.status,a)),children:Fb(e.status,t)})})]})}function fl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",p=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",i=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((h,b)=>h.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-h.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",i,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",i,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",d,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",i),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Pb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",p,l),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:m,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(h=>jsx(Mb,{task:h,locale:a,isDark:n,onClick:s},h.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",i),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 rn(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 _b(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 zu(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==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(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.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 jb(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 Xr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:p=[],onCreateTag:l,attachments:c=[],onUploadAttachments:i,onDeleteAttachment:m,availableTasks:g=[],comments:h=[],onAddComment:b,currentUser:w,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:v,timeEntries:C=[],isTimerRunning:N=false,timerElapsedSeconds:E=0,onTimeLog:T,onEstimateUpdate:B,onSoldEffortUpdate:O,onTimerStart:I,onTimerStop:G,onTimerDiscard:S,blurFinancials:ce=false}){let M=s==="dark",q={textTertiary:M?"#6B7280":"#9CA3AF",textSecondary:M?"#9CA3AF":"#6B7280",textPrimary:M?"#FFFFFF":"#111827",borderLight:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:M?"#1A1D25":"#FFFFFF",bgSecondary:M?"#0A0A0A":"#F9FAFB",hoverBg:M?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ke=e&&"title"in e&&!("name"in e),_e=e,[P,V]=useState(e?zu(e,d):null),[re,Te]=useState(false),[$,Z]=useState(false),[X$1,fe]=useState(false),[Fe,Ke]=useState(null),[qe,ot]=useState(new Date),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState(""),[xe,rt]=useState(false),[Ye,Je]=useState(false),[H,le]=useState(false),[D,j]=useState(false),[se,ye]=useState(""),W=useRef(null),te=useRef(null),[Oe,Ce]=useState(""),He=useRef(null),[Ne,ze]=useState(""),[it,st]=useState(false),[nt,pt]=useState([]),[Rt,Et]=useState(""),[dt,mt]=useState(false),Nt=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 A=zu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),V(A),ye(A.description||""),Ce(A.name||"");}},[e?.id,e?.quotedMinutes,d,t]),useEffect(()=>{if(!t||!se)return;let A=setTimeout(()=>{let ue=te.current;ue&&(ue.style.height="auto",ue.style.height=`${Math.max(100,ue.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,se]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),He.current&&clearTimeout(He.current);},[]),useEffect(()=>{t&&Nt.current&&h.length>0&&setTimeout(()=>{Nt.current&&(Nt.current.scrollTop=Nt.current.scrollHeight);},100);},[t,h.length]);let Lt=useCallback(A=>{V(A),ke&&o&&_e?o(jb(A,_e)):r&&r(A);},[ke,_e,o,r]),Ie=useCallback(()=>{Te(false),Z(false),fe(false),Ke(null),ct(false),Tt(""),rt(false);},[]),Be=useCallback((A,ue)=>{if(!P)return;let $e={...P,[A]:ue};Lt($e);},[P,Lt]),K=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),he=useCallback(A=>{ye(A),setTimeout(K,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(P){let ue={...P,description:A};Lt(ue);}},800);},[P,Lt,K]),ee=useCallback(A=>{Ce(A),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(P&&A.trim()){let ue={...P,name:A.trim()};Lt(ue);}},800);},[P,Lt]),y=useCallback(A=>{let ue=A.map($e=>{let Xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$e};return $e.type.startsWith("image/")&&(Xe.preview=URL.createObjectURL($e)),Xe});pt($e=>[...$e,...ue]);},[]),L=useCallback(A=>{pt(ue=>{let $e=ue.find(Xe=>Xe.id===A);return $e?.preview&&URL.revokeObjectURL($e.preview),ue.filter(Xe=>Xe.id!==A)});},[]),z=useCallback(async()=>{if(!(!P||!Ne.trim()&&nt.length===0||!b)){st(true);try{let A=ku(Ne,f),ue=[];if(nt.length>0&&x){let $e=nt.map(Xe=>Xe.file);ue=await x($e);}await b(P.id,Ne.trim(),A.length>0?A:void 0,ue.length>0?ue:void 0),ze(""),nt.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview);}),pt([]);}finally{st(false);}}},[P,Ne,nt,b,f,x]),J=useCallback(()=>{if(!P||!Rt.trim())return;let A=P.subtasks||[],ue={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Rt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},$e=[...A,ue],Xe={...P,subtasks:$e};Lt(Xe),Et(""),mt(false);},[P,Rt,Lt]),de=useCallback(A=>{if(!P?.subtasks)return;let ue=P.subtasks.map(Xe=>Xe.id===A?{...Xe,progress:Xe.progress===100?0:100}:Xe),$e={...P,subtasks:ue};Lt($e);},[P,Lt]),ge=useCallback(A=>{if(!P?.subtasks)return;let ue=P.subtasks.filter(Xe=>Xe.id!==A),$e={...P,subtasks:ue};Lt($e);},[P,Lt]),Y=useCallback(A=>{let ue=typeof A=="string"?new Date(A):A,Xe=new Date().getTime()-ue.getTime(),ft=Math.floor(Xe/6e4),Va=Math.floor(Xe/36e5),Ta=Math.floor(Xe/864e5);return ft<1?n==="es"?"Ahora":"Just now":ft<60?n==="es"?`Hace ${ft} min`:`${ft}m ago`:Va<24?n==="es"?`Hace ${Va}h`:`${Va}h ago`:Ta<7?n==="es"?`Hace ${Ta}d`:`${Ta}d ago`:ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Re=useCallback(A=>{if(!P)return;let ue=P.progress||0;A==="completed"?ue=100:A==="in-progress"&&ue===0?ue=10:A==="todo"&&(ue=0);let $e={...P,status:A,progress:ue};Lt($e),Te(false);},[P,Lt]),je=useCallback((A,ue)=>{if(!P)return;let $e={...P,startDate:A,endDate:ue};Lt($e);},[P,Lt]),gt=useCallback(()=>{let A=qe.getFullYear(),ue=qe.getMonth(),$e=new Date(A,ue,1),ft=new Date(A,ue+1,0).getDate(),Va=$e.getDay(),Ta=[],Ua=new Date(A,ue,0).getDate();for(let Ia=Va-1;Ia>=0;Ia--)Ta.push({date:new Date(A,ue-1,Ua-Ia),isCurrentMonth:false});for(let Ia=1;Ia<=ft;Ia++)Ta.push({date:new Date(A,ue,Ia),isCurrentMonth:true});let xa=42-Ta.length;for(let Ia=1;Ia<=xa;Ia++)Ta.push({date:new Date(A,ue+1,Ia),isCurrentMonth:false});return Ta},[qe]),St=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),le(false),!P||!i)return;let ue=Array.from(A.dataTransfer.files);if(ue.length!==0){j(true);try{await i(P.id,ue);}finally{j(false);}}},[P,i]),Yt=useCallback(async A=>{if(!P||!i||!A.target.files)return;let ue=Array.from(A.target.files);if(ue.length!==0){j(true);try{await i(P.id,ue);}finally{j(false);}A.target.value="";}},[P,i]),Se=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(true);},[]),ae=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(false);},[]),me=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),Ge=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]);return !t||!P?null:jsx(AnimatePresence,{children:t&&P&&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:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",M?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",M?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",M?"text-[#6B7280]":"text-gray-400"),children:P.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 A=P.progress===100?0:100,$e={...P,progress:A,status:A===100?"completed":"todo"};Lt($e);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",P.progress===100?"bg-green-500 border-green-500":M?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Oe,onChange:A=>ee(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",P.progress===100?"line-through text-[#6B7280]":M?"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:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ie(),Te(!re);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",P.progress===100||P.status==="completed"?"bg-green-500/20 text-green-400":P.progress&&P.progress>0||P.status==="in-progress"?"bg-blue-500/20 text-blue-400":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.progress===100||P.status==="completed"?n==="es"?"COMPLETADO":"DONE":P.progress&&P.progress>0||P.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:re&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Re(A.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",P.status===A.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:M?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ie(),fe(!X$1);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[P.assignees&&P.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[P.assignees.slice(0,3).map((A,ue)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ue)),P.assignees.length>3&&jsxs("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:["+",P.assignees.length-3]})]}):jsx("span",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:X$1&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(A=>{let ue=P.assignees?.some($e=>$e.name===A.name);return jsxs("button",{onClick:()=>{let $e=P.assignees||[],Xe;ue?Xe=$e.filter(ft=>ft.name!==A.name):Xe=[...$e,A],Be("assignees",Xe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",ue&&(M?"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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",M?"text-white":"text-gray-900"),children:A.name}),ue&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ke(Fe?null:"start"),ot(P.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[P.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",M?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),P.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Fe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",M?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ue=new Date(A);ue.setDate(A.getDate()+1);let $e=new Date(A);$e.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Xe=new Date(A);Xe.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let ft=new Date(A);ft.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Va=new Date(A);Va.setDate(A.getDate()+14);let Ta=new Date(A);return Ta.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ue,display:ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:$e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ft,display:ft.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Va,display:Va.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ta,display:Ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((xa,Ia)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Fe==="start"){let ir=P.endDate&&xa.date>P.endDate?xa.date:P.endDate;je(xa.date,ir),Ke("end");}else {let ir=P.startDate&&xa.date<P.startDate?xa.date:P.startDate;je(ir,xa.date),Ke(null);}},children:[jsx("span",{children:xa.label}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:xa.display})]},Ia))})(),jsx("div",{className:u("border-t mt-2 pt-2",M?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{je(void 0,void 0),Ke(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",M?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Fe==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",M?"text-white":"text-gray-900"),children:qe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ot(new Date),className:u("p-1 rounded text-sm transition-colors",M?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ot(new Date(qe.getFullYear(),qe.getMonth()-1)),className:u("p-1 rounded",M?"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:()=>ot(new Date(qe.getFullYear(),qe.getMonth()+1)),className:u("p-1 rounded",M?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",M?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((A,ue)=>{let $e=A.date.toDateString()===new Date().toDateString(),Xe=P.startDate?.toDateString()===A.date.toDateString(),ft=P.endDate?.toDateString()===A.date.toDateString(),Va=Xe||ft,Ta=P.startDate&&P.endDate&&A.date>=P.startDate&&A.date<=P.endDate;return jsx("button",{onClick:()=>{let Ua=new Date(A.date);if(Fe==="start"){let xa=P.endDate&&Ua>P.endDate?Ua:P.endDate;je(Ua,xa),Ke("end");}else {let xa=P.startDate&&Ua<P.startDate?Ua:P.startDate;je(xa,Ua),Ke(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(M?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(M?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#2E94FF]",Xe&&"bg-[#2E94FF] text-white",ft&&!Xe&&"bg-[#7C3AED] text-white",Ta&&!Va&&(M?"bg-[#7C3AED]/20":"bg-purple-100"),!Va&&(M?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ue)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ie(),Z(!$);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",P.priority==="high"||P.priority==="urgent"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":P.priority==="low"?"bg-green-500/20 text-green-400":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.priority?P.priority==="high"||P.priority==="urgent"?n==="es"?"Alta":"High":P.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Be("priority",A.id),Z(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",P.priority===A.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:M?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:P.startDate&&P.endDate?`${Math.ceil((P.endDate.getTime()-P.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",M?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ne?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:P.progress||0,onChange:A=>{let ue=parseInt(A.target.value),$e=P.status;ue===100?$e="completed":ue>0?$e="in-progress":$e="todo";let Xe={...P,progress:ue,status:$e};Lt(Xe);},onBlur:()=>ut(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",M?"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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>ut(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",M?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",P.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${P.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",M?"text-white":"text-gray-900"),children:[P.progress||0,"%"]})]})]}),k&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:P.status==="completed"||P.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:v?.estimateMinutes?rn(v.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):v?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(v.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="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(Or,{mode:"estimate",locale:n,isDark:M,currentValue:v?.estimateMinutes||null,onSave:async A=>{await B?.(P.id,A),Je(false);},onClose:()=>Je(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ce?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",M?"text-[#94A3B8]":"text-gray-500"),title:n==="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"}):P.status==="completed"||P.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:P.quotedMinutes?rn(P.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):P.quotedMinutes?jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(P.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="quoted"&&!ce&&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(Or,{mode:"quoted",locale:n,isDark:M,currentValue:P.quotedMinutes||null,onSave:async A=>{O?(await O(P.id,A),V(ue=>ue?{...ue,quotedMinutes:A}:null)):Be("quotedMinutes",A),Je(false);},onClose:()=>Je(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[P.status==="completed"||P.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",M?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxs("button",{type:"button",onClick:()=>G?.(P.id),className:u("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"}),_b(E||0)]}):jsx("button",{type:"button",onClick:()=>I?.(P.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",M?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),P.status==="completed"||P.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Je("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",M?"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"}),n==="es"?"Agregar tiempo":"Add time"]}),v&&v.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",v.health==="over-budget"?"text-red-500":v.health==="at-risk"?"text-yellow-500":M?"text-white":"text-gray-900"),children:[rn(v.loggedMinutes),v.estimateMinutes&&jsxs("span",{className:u("font-normal",M?"text-[#6B7280]":"text-gray-400"),children:[" / ",rn(v.estimateMinutes)]})]}),v.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:u("h-full rounded-full transition-all",v.health==="over-budget"?"bg-red-500":v.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,v.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Ye==="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(Or,{mode:"log",locale:n,isDark:M,currentValue:null,onSave:async(A,ue)=>{A&&await T?.(P.id,{durationMinutes:A,note:ue,source:"manual"}),Je(false);},onClose:()=>Je(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:P.tags||[],availableTags:p,onChange:A=>{Be("tags",A);},onCreateTag:l,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[P.dependencies&&P.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:P.dependencies.map(A=>{let ue=g.find($e=>$e.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",M?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ue?.name||A.slice(0,8),jsx("button",{onClick:()=>{let $e=(P.dependencies||[]).filter(Xe=>Xe!==A);Be("dependencies",$e);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Ie(),ct(!Me);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"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:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Me&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ct(false),Tt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",M?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Dt,onChange:A=>Tt(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",M?"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:g.length>0?g.filter(A=>A.id!==P.id).filter(A=>Dt===""||A.name.toLowerCase().includes(Dt.toLowerCase())).map(A=>{let ue=P.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let $e=P.dependencies||[],Xe;ue?Xe=$e.filter(ft=>ft!==A.id):Xe=[...$e,A.id],Be("dependencies",Xe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",ue&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ue?"bg-blue-500 border-blue-500":M?"border-white/30":"border-gray-300"),children:ue&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",M?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ie(),rt(!xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"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:P.color||"#6366F1"}}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:Mo.find(A=>A.value===P.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Mo.map(A=>{let ue=P.color===A.value;return jsx("button",{onClick:()=>{Be("color",A.value),rt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ue&&"ring-2 ring-offset-2",M?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ue?A.value:void 0},title:A.name,children:ue&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:P.isMilestone||false,onChange:A=>Be("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",P.isMilestone?"bg-purple-500 border-purple-500":M?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:se,onChange:A=>he(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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",M?"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:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",P.subtasks&&P.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",P.subtasks.filter(A=>A.progress===100).length,"/",P.subtasks.length,")"]})]})}),P.subtasks&&P.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...P.subtasks].sort((A,ue)=>(A.position??0)-(ue.position??0)).map(A=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",M?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>de(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.progress===100?"bg-green-500 border-green-500":M?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":M?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>ge(A.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",M?"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"})})]},A.id))}),dt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Rt,onChange:A=>Et(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Rt.trim()?J():A.key==="Escape"&&(mt(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",M?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:J,disabled:!Rt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Rt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":M?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{mt(false),Et("");},className:u("p-2 rounded-lg transition-colors",M?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>mt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",M?"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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",M?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(A=>{let ue=Ge(A.type),$e=A.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[$e&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",M?"bg-white/10":"bg-gray-200"),children:jsx(ue,{className:u("w-5 h-5",M?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",M?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:me(A.size)})]}),m&&jsx("button",{onClick:()=>m(A.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",M?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:Se,onDragLeave:ae,onDrop:St,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?M?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":M?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Yt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!i||D}),D?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":M?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!i&&jsx("p",{className:u("text-xs mt-1",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",M?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",h.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",h.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",M?"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 yf 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,CheckSquare,ChevronDown,Calendar,Hash,Type,Users,CalendarClock,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,FileJson,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import $h from'react-markdown';import Hh from'remark-gfm';import zh from'rehype-sanitize';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 vs=(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 ws=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 [ws.Translate.toString(e),ws.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function ks(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 mf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function el(e,t){return e.length===0?1e3:t===0?ks(null,e[0].position):t>=e.length?ks(e[e.length-1].position,null):ks(e[t-1].position,e[t].position)}function Wc(e,t=100){return e>t}var gf=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 ff(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Cs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=gf,onRetry:d}=t,p,l=0;for(let c=1;c<=a;c++){l=c;try{return {data:await e(),attempts:l,success:!0}}catch(i){if(p=i,c===a||!n(p,c))return {error:p,attempts:l,success:false};let g=ff(c,r,o,s);if(d)try{d(p,c,g);}catch(h){console.error("Error in retry callback:",h);}await new Promise(h=>setTimeout(h,g));}}return {error:p||new Error("Unknown error"),attempts:l,success:false}}function bf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function hf(e,t={}){return async(...a)=>Cs(()=>e(...a),t)}var tl=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 Vc=(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))(Vc||{}),Do=class Do{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,p=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,p?n:"");break;case "INFO":console.info(d,o,p?n:"");break;case "WARN":console.warn(d,o,p?n:"");break;case "ERROR":console.error(d,o,p?n:""),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",...Do.globalOptions};}static configure(t){Do.globalOptions={...Do.globalOptions,...t};}child(t){return new Do({...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 Ts((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ts(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Vc[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};Do.globalOptions={};var al=Do,Ts=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}},Gc=new al;function xf(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 vf(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 n=e.columns.find(d=>d.id===s.columnId);return [s.id,rl(s.title),rl(s.description||""),rl(n?.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 wf(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await yf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),p=297,l=210,c=n.width/n.height,i=p-20,m=i/c;m>l-20&&(m=l-20,i=m*c);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,p,15,"F"),g.text(e.title||"Kanban Board",10,10);let h=(p-i)/2;return g.addImage(d,"PNG",h,20,i,m),g}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let d=e.cards.filter(p=>p.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):d.forEach(p=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(p.title,25,s),s+=6,p.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(p.description,160);o.text(c,25,s),s+=c.length*5;}let l=[];if(p.priority&&l.push(`Priority: ${p.priority}`),p.labels&&p.labels.length>0&&l.push(`Labels: ${p.labels.join(", ")}`),p.assignedUserIds&&p.assignedUserIds.length>0&&l.push(`Assigned: ${p.assignedUserIds.length} user(s)`),p.startDate||p.endDate){let c=[];p.startDate&&c.push(`Start: ${p.startDate}`),p.endDate&&c.push(`End: ${p.endDate}`),l.push(c.join(" \u2192 "));}l.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(l.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function rl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function jc(e,t,a,r){switch(t){case "json":return xf(e,r);case "csv":return vf(e);case "pdf":return await wf(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Kc(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},d=new Blob([e],{type:n[t]}),p=URL.createObjectURL(d),l=document.createElement("a");l.href=p,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(p);}function kf(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 Cf(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=Yc(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=Yc(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let l={};a.forEach((g,h)=>{l[g]=d[h]||"";});let c=l.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let i=o.get(c),m={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:i.id,position:i.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(m),i.cardIds.push(m.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.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 Yc(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function qc(e,t){switch(t){case "json":return kf(e);case "csv":return Cf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xc(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var ol=createContext(null);function Jc(){return useContext(ol)}var Qc=createContext(null);function Zc({children:e,themeName:t}){return jsx(Qc.Provider,{value:{themeName:t},children:e})}function Qo(){return useContext(Qc)}function It({children:e,container:t}){let[a,r]=useState(false),o=Jc(),s=Qo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:d,themeName:p}=o,l={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return createPortal(jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var ou={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Mf="#BDC3C7",Af=({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 So({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),l=()=>{if(!p.current)return;let g=p.current.getBoundingClientRect(),h=window.innerHeight,b=window.innerWidth,w=160,f=220,x=4,k=g.right-w;k<10&&(k=g.left),k+w>b-10&&(k=b-w-10);let v=h-g.bottom,C=g.top,N;v>=f+x?N=g.bottom+x:C>=f+x?N=g.top-f-x:N=v>=C?g.bottom+x:Math.max(10,g.top-f-x),n({top:N,left:k}),o(true);};useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&!p.current?.contains(h.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=h=>{h.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let c=g=>{t(g),o(false);},i=e?ou[e]:null,m=i?.color||Mf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,onClick:()=>r?o(false):l(),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?`${m}10`:"transparent",boxShadow:e?`0 0 0 2px ${m}30 inset`:"none"},title:i?.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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:m,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(It,{children:jsxs("div",{ref:d,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(ou).map(([g,h])=>jsxs("button",{onClick:()=>c(g),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: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(Af,{color:h.color}),jsx("span",{className:"font-semibold text-sm",children:h.label}),e===g&&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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),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:()=>c(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:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Lf=[{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 Mn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),p=useRef(null),l=useRef(null),m=(Qo()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let k=l.current.getBoundingClientRect(),v=window.innerHeight,C=window.innerWidth,N=320,E=380,T=4,B=k.left;B+N>C-10&&(B=C-N-10),B<10&&(B=10);let O=v-k.bottom,I=k.top,G;O>=E+T?G=k.bottom+T:I>=E+T?G=k.top-E-T:G=O>=I?k.bottom+T:Math.max(10,k.top-E-T),d({top:G,left:B}),s(true);};useEffect(()=>{let k=v=>{p.current&&!p.current.contains(v.target)&&!l.current?.contains(v.target)&&s(false);};if(o)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),useEffect(()=>{let k=v=>{v.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o]);let h=k=>{let v=new Date,C=B=>{let O=B.getFullYear(),I=String(B.getMonth()+1).padStart(2,"0"),G=String(B.getDate()).padStart(2,"0");return `${O}-${I}-${G}`},N=C(v),E=new Date(v);E.setDate(E.getDate()+k);let T=C(E);a(N,T),s(false);},b=()=>{if(!e||!t)return "Set date";let k=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=E.split("-").map(Number);if(T.length!==3||T.some(G=>isNaN(G)))return null;let B=T[0],O=T[1],I=T[2];return B===void 0||O===void 0||I===void 0?null:new Date(B,O-1,I)},v=k(e),C=k(t);if(!v||!C||isNaN(v.getTime())||isNaN(C.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[v.getMonth()]} ${v.getDate()} \u2013 ${N[C.getMonth()]} ${C.getDate()}`},w=e&&t,x=(()=>{if(!t)return false;let k=typeof t=="string"?new Date(t):t,v=new Date;return v.setHours(0,0,0,0),k<v})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${x?"asakaa-date-overdue":"asakaa-date"}`,title:w?`${b()}`:"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:b()})]}),o&&jsx(It,{children:jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:m?"#1A1D25":"#FFFFFF",border:`1px solid ${m?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:m?"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:m?"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:m?"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:Lf.map(k=>jsx("button",{onClick:()=>h(k.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",v.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",v.currentTarget.style.border=`1px solid ${m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:k.label},k.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:m?"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:k=>a(k.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:k=>a(e,k.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:m?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:m?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:m?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:m?"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:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[d,p]=useState(""),[l,c]=useState({top:0,left:0}),i=useRef(null),m=useRef(null),g=()=>{if(!m.current)return;let x=m.current.getBoundingClientRect(),k=window.innerHeight,v=window.innerWidth,C=300,N=380,E=4,T=x.right-C;T<10&&(T=x.left),T+C>v-10&&(T=v-C-10);let B=k-x.bottom,O=x.top,I;B>=N+E?I=x.bottom+E:O>=N+E?I=x.top-N-E:I=B>=O?x.bottom+E:Math.max(10,x.top-N-E),c({top:I,left:T}),n(true);};useEffect(()=>{let x=k=>{i.current&&!i.current.contains(k.target)&&!m.current?.contains(k.target)&&(n(false),p(""));};if(s)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]),useEffect(()=>{let x=k=>{k.key==="Escape"&&(n(false),p(""));};if(s)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[s]);let h=x=>{let k=e.some(v=>v.id===x.id);a(k?e.filter(v=>v.id!==x.id):[...e,x]);},b=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),w=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:m,onClick:()=>s?n(false):g(),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:[w.map(x=>jsx("div",{className:"asakaa-avatar",title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"asakaa-avatar-img"}):x.initials},x.id)),f>0&&jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(It,{children:jsxs("div",{ref:i,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.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:d,onChange:x=>p(x.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:b.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"}):b.map(x=>{let k=e.some(v=>v.id===x.id);return jsxs("button",{onClick:()=>h(x),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:v=>{v.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:x.color,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.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:x.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:k?"#3b82f6":"transparent"},children:k?"\u2713":""})]},x.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(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 Ns(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let l=p.dependencies.map(c=>{if(typeof c=="string")return c;let i=c;return i.taskId||i.targetId||""}).filter(Boolean);r.set(p.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=p=>{if(!s.has(p)){s.add(p),n.add(p);let l=r.get(p)||[];for(let c of l){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(p),false};return d(a)}function Ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,p]=useState(false),[l,c]=useState(""),[i,m]=useState(t.length>0),[g,h]=useState({top:0,left:0}),[b,w]=useState(null),f=useRef(null),x=useRef(null),k=()=>{if(!x.current)return;let T=x.current.getBoundingClientRect(),B=window.innerHeight,O=window.innerWidth,I=300,G=i?380:120,S=4,ce=T.right-I;ce<10&&(ce=T.left),ce+I>O-10&&(ce=O-I-10);let M=B-T.bottom,q=T.top,ke;M>=G+S?ke=T.bottom+S:q>=G+S?ke=T.top-G-S:ke=M>=q?T.bottom+S:Math.max(10,T.top-G-S),h({top:ke,left:ce}),p(true);};useEffect(()=>{if(!d||!x.current)return;let T=x.current.getBoundingClientRect(),B=window.innerHeight,O=window.innerWidth,I=300,G=i?380:120,S=4,ce=T.right-I;ce<10&&(ce=T.left),ce+I>O-10&&(ce=O-I-10);let M=B-T.bottom,q=T.top,ke;M>=G+S?ke=T.bottom+S:q>=G+S?ke=T.top-G-S:ke=M>=q?T.bottom+S:Math.max(10,T.top-G-S),h({top:ke,left:ce});},[i,d]),useEffect(()=>{let T=B=>{f.current&&!f.current.contains(B.target)&&!x.current?.contains(B.target)&&(p(false),c(""));};if(d)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[d]),useEffect(()=>{let T=B=>{B.key==="Escape"&&(p(false),c(""));};if(d)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[d]);let v=T=>{let B=t.includes(T),O=a.find(I=>I.id===T);if(w(null),B){let I=t.filter(G=>G!==T);r(I),I.length===0&&m(false);}else {if(s&&Ns(a,T,e)){let G=`Cannot add "${O?.title||T}" as dependency - would create circular reference`;w(G),n?.(T,O?.title||T),setTimeout(()=>w(null),3e3);return}r([...t,T]),m(true);}},C=()=>{let T=!i;m(T),T||r([]);},N=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),E=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:x,onClick:()=>d?p(false):k(),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:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),d&&jsx(It,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.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:[b&&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:b})]}),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:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:i?"#3b82f6":"transparent",borderColor:i?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:i&&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"})]})}),i&&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:l,onChange:T=>c(T.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:N.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"}):N.map(T=>{let B=t.includes(T.id);return jsxs("button",{onClick:()=>v(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:O=>{O.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:O=>{O.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:B?"#3b82f6":"transparent",borderColor:B?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:B&&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:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),m(false),p(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 Yr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:p=[]})=>{let{attributes:l,listeners:c,setNodeRef:i,transform:m,transition:g,isDragging:h}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),b={transform:ws.Transform.toString(m),transition:g};if(t)return jsx("div",{ref:i,style:b,...l,...c,onClick:()=>a?.(e),children:t(e)});let w=d.filter(v=>e.assignedUserIds?.includes(v.id)),f=e.progress===100,x=(e.attachments||[]).filter(v=>v.type.startsWith("image/")),k={...b,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:i,style:k,className:u("asakaa-card",h&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...c,onClick:v=>{v.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:v=>{v.currentTarget.style.display="none";}})}),x.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:x.length===1&&x[0]?jsx("img",{src:x[0].url,alt:x[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:v=>{v.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:x.slice(0,4).map((v,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:v.url,alt:v.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),C===3&&x.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:["+",x.length-4]})})]},v.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:v=>v.stopPropagation(),className:"priority-selector",children:jsx(So,{priority:e.priority,onChange:v=>n?.(e.id,{priority:v})})}),jsx("div",{onClick:v=>v.stopPropagation(),className:"date-picker",children:jsx(Mn,{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:(v,C)=>n?.(e.id,{startDate:v,endDate:C})})}),d.length>0&&jsx("div",{onClick:v=>v.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:w,availableUsers:d,onChange:v=>n?.(e.id,{assignedUserIds:v.map(C=>C.id)})})}),jsx("div",{onClick:v=>v.stopPropagation(),className:"dependencies-selector",children:jsx(Ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(v=>typeof v=="string"?v:v.taskId):[],availableTasks:p,onChange:v=>n?.(e.id,{dependencies:v})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(v=>jsx("span",{className:"asakaa-label",children:v},v))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));Yr.displayName="Card";var Ds={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"}},gu=({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 fu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),p=useRef(null),l=useRef(null),c=[...Object.entries(Ds).map(([w,f])=>({id:w,label:f.label,color:f.color,icon:f.icon})),...r.filter(w=>!Object.keys(Ds).includes(w.id)).map(w=>({id:w.id,label:w.title,color:w.color||"#8B5CF6",icon:"circle-dot"}))],i=()=>{let w=Ds[e];if(w)return {...w,id:e};let f=r.find(x=>x.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ds.todo,id:"todo"}},m=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,k=180,v=280,C=4,N=w.right-k;N<10&&(N=w.left),N+k>x-10&&(N=x-k-10);let E=f-w.bottom,T=w.top,B;E>=v+C?B=w.bottom+C:T>=v+C?B=w.top-v-C:B=E>=T?w.bottom+C:Math.max(10,w.top-v-C),d({top:B,left:N}),s(true);};useEffect(()=>{let w=f=>{p.current&&!p.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let g=w=>{t(w),s(false);},h=i(),b=h.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?s(false):m(),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:`${b}10`,boxShadow:`0 0 0 2px ${b}30 inset`},title:h.label,children:jsx(gu,{icon:h.icon,color:b})}),o&&jsx(It,{children:jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:c.map(w=>jsxs("button",{onClick:()=>g(w.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:w.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(gu,{icon:w.icon,color:w.color}),jsx("span",{className:"font-semibold",children:w.label}),e===w.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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},w.id))})]})})]})}var bu={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 hu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=bu[s]||bu.en,[d,p]=useState(false),[l,c]=useState(false),[i,m]=useState(e),[g,h]=useState({top:0,left:0}),b=useRef(null),w=useRef(null),f=useRef(null);useEffect(()=>{if(d&&w.current){let C=w.current.getBoundingClientRect();h({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[d]),useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!w.current?.contains(N.target)&&(p(false),c(false));};if(d)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]),useEffect(()=>{let C=N=>{N.key==="Escape"&&(p(false),c(false),m(e));};if(d)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[d,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let x=()=>{c(true),m(e);},k=()=>{let C=i.trim();C&&C!==e&&t(C),c(false),p(false),m(e);},v=C=>{C.key==="Enter"?k():C.key==="Escape"&&(c(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:w,onClick:()=>p(!d),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.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"})]})}),d&&jsx(It,{children:jsx("div",{ref:b,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:i,onChange:C=>m(C.target.value),onKeyDown:v,onBlur:k,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-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:x,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:n.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),p(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:n.delete})]})]})]})})})]})}var tn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:p,allCards:l,enableVirtualization:c,cardHeight:i=120,isCollapsed:m,onToggleCollapse:g,onColumnRename:h,onColumnDelete:b,isDeletable:w=false,className:f,renderMetrics:x,locale:k})=>{let{setNodeRef:v,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),N=useRef(null),E=c??Wc(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>N.current,estimateSize:()=>i,enabled:E});if(a)return jsx("div",{ref:v,className:f,children:a(e,t)});let O=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let S=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:S}:S>=80?{state:"warning",percentage:S}:S>=60?{state:"approaching",percentage:S}:{state:"ok",percentage:S}})(),I=O.state==="exceeded",G=()=>"asakaa-column-count";return jsxs("div",{ref:v,className:u("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",I&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):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:u(G()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&O.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${O.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[O.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"})]}),O.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"})]}),O.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"})}),O.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"})]})]}),(h||b)&&jsx(hu,{columnTitle:e.title,onRename:S=>h?.(e.id,S),onDelete:b?()=>b(e.id):void 0,isDeletable:w,locale:k}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":m?"Expand column":"Collapse column",children:m?"\u25B6":"\u25BC"})]})]}),x&&x(e,t),!m&&jsx("div",{ref:N,className:"asakaa-column-cards",style:{maxHeight:E?"600px":void 0},children:jsx(SortableContext,{items:t.map(S=>S.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"})}):E?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(S=>{let ce=t[S.index];return ce?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},children:jsx(Yr,{card:ce,render:r,onClick:n,onUpdate:d,availableUsers:p,allCards:l})},ce.id):null})}):t.map(S=>jsx(Yr,{card:S,render:r,onClick:n,onUpdate:d,availableUsers:p,allCards:l},S.id))})})]})});tn.displayName="Column";function dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),d=useRef(null);useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let p=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},l=c=>{c.key==="Enter"?p():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:p,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Zf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function Cu(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(d=>{let p=d.name.toLowerCase(),l=p.replace(/\s+/g,""),c=p.split(/\s+/);return !!(l===s||p===s||c.some(i=>i===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function eb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function tb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var ab=["\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 Tu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:p="es",currentUser:l,enableEmoji:c=true,enableAttachments:i=true,pendingFiles:m=[],onFilesSelect:g,onRemoveFile:h,maxFileSizeMB:b=10}){let w=d==="dark",[f,x]=useState(false),[k,v]=useState([]),[C,N]=useState(0),[E,T]=useState(null),[B,O]=useState(false),I=useRef(null),G=useRef(null),S=useRef(null),ce=useRef(null),M=useCallback(($,Z)=>{let X=Zf($,Z);if(T(X),X){let fe=r.filter(Fe=>Fe.name.toLowerCase().includes(X.query)||Fe.email&&Fe.email.toLowerCase().includes(X.query)).slice(0,5);v(fe),x(fe.length>0),N(0);}else x(false),v([]);},[r]),q=$=>{let Z=$.target.value;if(t(Z),M(Z,$.target.selectionStart||0),I.current){I.current.style.height="24px";let X=I.current.scrollHeight,fe=280,Fe=Math.min(X,fe);I.current.style.height=`${Fe}px`,I.current.style.overflowY=X>fe?"auto":"hidden";}},ke=()=>{I.current&&M(e,I.current.selectionStart||0);},_e=useCallback($=>{if(!E||!I.current)return;let Z=e.slice(0,E.start),X=e.slice(E.end),fe=`@${$.name.replace(/\s+/g,"")} `,Fe=Z+fe+X;t(Fe),x(false),T(null),setTimeout(()=>{if(I.current){let Ke=E.start+fe.length;I.current.selectionStart=Ke,I.current.selectionEnd=Ke,I.current.focus();}},0);},[E,e,t]),P=$=>{if(f&&k.length>0)switch($.key){case "ArrowDown":$.preventDefault(),N(Z=>Z<k.length-1?Z+1:0);break;case "ArrowUp":$.preventDefault(),N(Z=>Z>0?Z-1:k.length-1);break;case "Enter":{$.preventDefault();let Z=k[C];Z&&_e(Z);break}case "Tab":{$.preventDefault();let Z=k[C];Z&&_e(Z);break}case "Escape":$.preventDefault(),x(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};useEffect(()=>{let $=Z=>{G.current&&!G.current.contains(Z.target)&&I.current&&!I.current.contains(Z.target)&&x(false),ce.current&&!ce.current.contains(Z.target)&&O(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let V=useCallback($=>{if(!I.current)return;let Z=I.current.selectionStart||e.length,X=e.slice(0,Z)+$+e.slice(Z);t(X),O(false),setTimeout(()=>{if(I.current){let fe=Z+$.length;I.current.selectionStart=fe,I.current.selectionEnd=fe,I.current.focus();}},0);},[e,t]),re=useCallback($=>{if(!g||!$.target.files)return;let Z=Array.from($.target.files),X=b*1024*1024,fe=Z.filter(Fe=>Fe.size>X?(console.warn(`File ${Fe.name} exceeds max size of ${b}MB`),false):true);fe.length>0&&g(fe),$.target.value="";},[g,b]),Te=useCallback($=>$.type.startsWith("image/")?Image:$.type.includes("pdf")||$.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&G.current){let $=G.current.children[C];$&&$.scrollIntoView({block:"nearest"});}},[C,f]),jsxs("div",{className:"flex flex-col gap-2",children:[m.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:m.map($=>{let Z=Te($.file),X$1=$.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",w?"bg-white/10":"bg-gray-100"),children:[X$1&&$.preview?jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Z,{className:u("w-4 h-4",w?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",w?"text-white":"text-gray-900"),children:$.file.name}),jsx("p",{className:u("text-xs",w?"text-[#6B7280]":"text-gray-400"),children:tb($.file.size)})]}),h&&jsx("button",{onClick:()=>h($.id),className:u("p-0.5 rounded-full transition-colors",w?"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"})})]},$.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&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:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",w?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>O(!B),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",w?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:B&&jsx(motion.div,{ref:ce,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",w?"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:ab.map($=>jsx("button",{type:"button",onClick:()=>V($),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",w?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),i&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>S.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",w?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:p==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:S,type:"file",multiple:true,onChange:re,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:I,value:e,onChange:q,onSelect:ke,onKeyDown:P,placeholder:o||(p==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",w?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&m.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||m.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":w?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?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:f&&k.length>0&&jsx(motion.div,{ref:G,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",w?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:k.map(($,Z)=>jsxs("button",{type:"button",onClick:()=>_e($),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Z===C?w?"bg-white/10":"bg-gray-100":w?"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:$.color||"#8B5CF6"},children:eb($.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",w?"text-white":"text-gray-900"),children:$.name}),$.email&&jsx("p",{className:u("text-xs truncate",w?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function Nu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[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((d,p)=>d.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:d.value},p):jsx("span",{children:d.value},p))})}var Ms=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function lo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,p]=useState(false),[l,c]=useState(""),[i,m]=useState(false),[g,h]=useState(Ms[10]||"#2E94FF"),[b,w]=useState({top:0,left:0}),f=useRef(null),x=useRef(null),k=useRef(null),v=useRef(null),C=t.filter(I=>I.name.toLowerCase().includes(l.toLowerCase())),N=t.some(I=>I.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(d&&x.current){let I=x.current.getBoundingClientRect();w({top:I.bottom+6,left:I.left});}},[d]),useEffect(()=>{let I=G=>{let S=G.target,ce=f.current?.contains(S),M=k.current?.contains(S);!ce&&!M&&(p(false),c(""),m(false));};if(d)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[d]),useEffect(()=>{d&&v.current&&v.current.focus();},[d]);let E=I=>{let G=e.some(S=>S.id===I.id);a(G?e.filter(S=>S.id!==I.id):[...e,I]);},T=async()=>{if(!(!r||!l.trim())){m(true);try{let I=await r(l.trim(),g);I&&(a([...e,I]),c(""),h(Ms[Math.floor(Math.random()*Ms.length)]||"#2E94FF"));}finally{m(false);}}},B=(I,G)=>{G.stopPropagation(),a(e.filter(S=>S.id!==I));},O={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:x,type:"button",onClick:()=>!s&&p(!d),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:O,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(I=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${I.color}20`,color:I.color},children:I.name},I.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:k,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:b.top,left:b.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:v,type:"text",value:l,onChange:I=>c(I.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:I=>{I.key==="Enter"&&l.trim()&&!N&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(I=>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:`${I.color}20`,color:I.color},onClick:G=>B(I.id,G),children:[I.name,jsx(X,{className:"w-3 h-3"})]},I.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(I=>{let G=e.some(S=>S.id===I.id);return jsxs("button",{type:"button",onClick:()=>E(I),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:G?`${I.color}15`:"transparent",color:o.textPrimary},onMouseEnter:S=>{G||(S.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:S=>{G||(S.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:I.color}}),jsx("span",{className:"flex-1 text-left",children:I.name}),G&&jsx(Check,{className:"w-4 h-4",style:{color:I.color}})]},I.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!N&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ms.map(I=>jsx("button",{type:"button",onClick:()=>h(I),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:I,outline:g===I?`2px solid ${I}`:"none",outlineOffset:"2px"}},I))}),jsxs("button",{type:"button",onClick:T,disabled:i,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:i?.7:1},children:[i?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 "',l.trim(),'"']})]})]})}),document.body)]})}function ul({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:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Su({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(ul,{tag:s,size:a},s.id)),o>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:["+",o]})]})}var Mo=[{name:"Azul",value:"#2E94FF",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:"#06B6D4",light:"#22D3EE"},{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 Eu(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 ub(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 pb({className:e}){return jsxs("svg",{className:u("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 pl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=ub(e.health),n={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"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},p=Eu(e.loggedMinutes),l=e.estimateMinutes?Eu(e.estimateMinutes):null,c=a&&l?`${p} / ${l}`:p;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(pb,{className:d[t]}),jsx("span",{children:c})]})}function mb(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 Ls(e){let t=mb(e);return t!==null?String(t):e}function Pu(e){let a=Ls(e).trim().toLowerCase();if(a.includes(":")){let[n,d]=a.split(":").map(Number);return (n||0)*60+(d||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,d=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+d}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Is(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 bb(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 hb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function yb({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 Mu({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 xb({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 ml({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:p,onDiscardTimer:l,onClose:c,className:i}){let[m,g]=useState(""),[h,b]=useState(t.estimateMinutes?Is(t.estimateMinutes):""),[w,f]=useState(""),[x,k]=useState(false),[v,C]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let E=async()=>{let O=Pu(m);if(!(O<=0||!s)){k(true);try{await s({durationMinutes:O,note:w.trim()||void 0,source:"manual"}),g(""),f("");}finally{k(false);}}},T=async()=>{if(!n)return;let O=h.trim()?Pu(h):null;await n(O),C(false);},B=O=>{O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),E()),O.key==="Escape"&&c?.();};return jsxs("div",{className:u("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",i),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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Mu,{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:bb(o)})]}),jsx("button",{onClick:p,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(yb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,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(Mu,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:d,className:u("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(hb,{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(xb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:m,onChange:O=>g(O.target.value),onKeyDown:B,placeholder:"8 (=8h), 2h 30m",className:u("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-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:E,disabled:x||!m.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:w,onChange:O=>f(O.target.value),onKeyDown:B,placeholder:"Note (optional)",className:u("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-blue-500 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:Is(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"}),v?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:h,onChange:O=>b(O.target.value),onKeyDown:O=>{O.key==="Enter"&&T(),O.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Is(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:u("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:u("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(O=>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:O.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Is(O.durationMinutes)})]},O.id))})]})]})}function Tb(e){let a=Ls(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,d]=a.split(":").map(Number);return (n||0)*60+(d||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,d=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+d}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Nb(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 Or({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,p]=useState(Nb(r)),[l,c]=useState(""),[i,m]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let h=async()=>{m(true);let k=Tb(d);await o(k&&k>0?k:null,l||void 0),m(false);},b=async()=>{m(true),await o(null),m(false);},w=k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),h()),k.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},x=t==="es";return jsxs("div",{className:u("w-56",n),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:k=>k.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":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[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:g,type:"text",value:d,onChange:k=>p(k.target.value),onKeyDown:w,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:l,onChange:k=>c(k.target.value),onKeyDown:w,placeholder:x?"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:h,disabled:i||!d.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,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:i?x?"Guardando...":"Saving...":x?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:b,disabled:i,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:x?"Quitar":"Clear"})]})]})}function Db(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 Sb(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 fl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Db(e.health),s=Sb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,p=Math.min(100,d),l=d>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${p}%`}}),l&&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:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[d,"%"]})]})}function an(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 Fb(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Pb(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-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";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 Mb(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 Ab({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=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",n=a?"border-white/5":"border-gray-200",d=a?"text-[#9CA3AF]":"text-gray-500",p=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:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",an(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",d),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",d),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:u("font-medium",p),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("font-medium",p),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:u("font-medium",p),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",d),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:d,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",p),children:an(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",p),children:an(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",p),children:e.totalTasksWithEstimate})]})]})]})]})}function Lb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",d=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",d),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?an(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:an(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":d),children:[o,an(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":d),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Pb(e.status,a),Fb(e.status,a)),children:Mb(e.status,t)})})]})}function bl({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#050505]":"bg-gray-50",p=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",c=n?"text-white/[0.92]":"text-gray-900",i=n?"text-white/[0.60]":"text-gray-500",m=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((h,b)=>h.varianceMinutes===null?1:b.varianceMinutes===null?-1:b.varianceMinutes-h.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",i,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",i,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",d,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",i),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Ab,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",p,l),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:m,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",i),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(h=>jsx(Lb,{task:h,locale:a,isDark:n,onClick:s},h.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",i),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 rn(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 Kb(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 Uu(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==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(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.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 Yb(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 Xr({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:p=[],onCreateTag:l,attachments:c=[],onUploadAttachments:i,onDeleteAttachment:m,availableTasks:g=[],comments:h=[],onAddComment:b,currentUser:w,mentionableUsers:f=[],onUploadCommentAttachments:x,enableTimeTracking:k=false,timeTrackingSummary:v,timeEntries:C=[],isTimerRunning:N=false,timerElapsedSeconds:E=0,onTimeLog:T,onEstimateUpdate:B,onSoldEffortUpdate:O,onTimerStart:I,onTimerStop:G,onTimerDiscard:S,blurFinancials:ce=false}){let M=s==="dark",q={textTertiary:M?"#6B7280":"#9CA3AF",textSecondary:M?"#9CA3AF":"#6B7280",textPrimary:M?"#FFFFFF":"#111827",borderLight:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:M?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:M?"#1A1D25":"#FFFFFF",bgSecondary:M?"#0A0A0A":"#F9FAFB",hoverBg:M?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ke=e&&"title"in e&&!("name"in e),_e=e,[P,V]=useState(e?Uu(e,d):null),[re,Te]=useState(false),[$,Z]=useState(false),[X$1,fe]=useState(false),[Fe,Ke]=useState(null),[qe,ot]=useState(new Date),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState(""),[xe,rt]=useState(false),[Ye,Je]=useState(false),[H,le]=useState(false),[D,j]=useState(false),[se,ye]=useState(""),W=useRef(null),te=useRef(null),[Oe,Ce]=useState(""),He=useRef(null),[Ne,ze]=useState(""),[it,st]=useState(false),[nt,pt]=useState([]),[Rt,Et]=useState(""),[dt,mt]=useState(false),Nt=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 A=Uu(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),V(A),ye(A.description||""),Ce(A.name||"");}},[e?.id,e?.quotedMinutes,d,t]),useEffect(()=>{if(!t||!se)return;let A=setTimeout(()=>{let ue=te.current;ue&&(ue.style.height="auto",ue.style.height=`${Math.max(100,ue.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,se]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),He.current&&clearTimeout(He.current);},[]),useEffect(()=>{t&&Nt.current&&h.length>0&&setTimeout(()=>{Nt.current&&(Nt.current.scrollTop=Nt.current.scrollHeight);},100);},[t,h.length]);let Lt=useCallback(A=>{V(A),ke&&o&&_e?o(Yb(A,_e)):r&&r(A);},[ke,_e,o,r]),Ie=useCallback(()=>{Te(false),Z(false),fe(false),Ke(null),ct(false),Tt(""),rt(false);},[]),Be=useCallback((A,ue)=>{if(!P)return;let $e={...P,[A]:ue};Lt($e);},[P,Lt]),K=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),he=useCallback(A=>{ye(A),setTimeout(K,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(P){let ue={...P,description:A};Lt(ue);}},800);},[P,Lt,K]),ee=useCallback(A=>{Ce(A),He.current&&clearTimeout(He.current),He.current=setTimeout(()=>{if(P&&A.trim()){let ue={...P,name:A.trim()};Lt(ue);}},800);},[P,Lt]),y=useCallback(A=>{let ue=A.map($e=>{let Xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:$e};return $e.type.startsWith("image/")&&(Xe.preview=URL.createObjectURL($e)),Xe});pt($e=>[...$e,...ue]);},[]),L=useCallback(A=>{pt(ue=>{let $e=ue.find(Xe=>Xe.id===A);return $e?.preview&&URL.revokeObjectURL($e.preview),ue.filter(Xe=>Xe.id!==A)});},[]),z=useCallback(async()=>{if(!(!P||!Ne.trim()&&nt.length===0||!b)){st(true);try{let A=Cu(Ne,f),ue=[];if(nt.length>0&&x){let $e=nt.map(Xe=>Xe.file);ue=await x($e);}await b(P.id,Ne.trim(),A.length>0?A:void 0,ue.length>0?ue:void 0),ze(""),nt.forEach($e=>{$e.preview&&URL.revokeObjectURL($e.preview);}),pt([]);}finally{st(false);}}},[P,Ne,nt,b,f,x]),J=useCallback(()=>{if(!P||!Rt.trim())return;let A=P.subtasks||[],ue={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Rt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},$e=[...A,ue],Xe={...P,subtasks:$e};Lt(Xe),Et(""),mt(false);},[P,Rt,Lt]),de=useCallback(A=>{if(!P?.subtasks)return;let ue=P.subtasks.map(Xe=>Xe.id===A?{...Xe,progress:Xe.progress===100?0:100}:Xe),$e={...P,subtasks:ue};Lt($e);},[P,Lt]),ge=useCallback(A=>{if(!P?.subtasks)return;let ue=P.subtasks.filter(Xe=>Xe.id!==A),$e={...P,subtasks:ue};Lt($e);},[P,Lt]),Y=useCallback(A=>{let ue=typeof A=="string"?new Date(A):A,Xe=new Date().getTime()-ue.getTime(),ft=Math.floor(Xe/6e4),Va=Math.floor(Xe/36e5),Ta=Math.floor(Xe/864e5);return ft<1?n==="es"?"Ahora":"Just now":ft<60?n==="es"?`Hace ${ft} min`:`${ft}m ago`:Va<24?n==="es"?`Hace ${Va}h`:`${Va}h ago`:Ta<7?n==="es"?`Hace ${Ta}d`:`${Ta}d ago`:ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Re=useCallback(A=>{if(!P)return;let ue=P.progress||0;A==="completed"?ue=100:A==="in-progress"&&ue===0?ue=10:A==="todo"&&(ue=0);let $e={...P,status:A,progress:ue};Lt($e),Te(false);},[P,Lt]),je=useCallback((A,ue)=>{if(!P)return;let $e={...P,startDate:A,endDate:ue};Lt($e);},[P,Lt]),gt=useCallback(()=>{let A=qe.getFullYear(),ue=qe.getMonth(),$e=new Date(A,ue,1),ft=new Date(A,ue+1,0).getDate(),Va=$e.getDay(),Ta=[],Ua=new Date(A,ue,0).getDate();for(let Ia=Va-1;Ia>=0;Ia--)Ta.push({date:new Date(A,ue-1,Ua-Ia),isCurrentMonth:false});for(let Ia=1;Ia<=ft;Ia++)Ta.push({date:new Date(A,ue,Ia),isCurrentMonth:true});let xa=42-Ta.length;for(let Ia=1;Ia<=xa;Ia++)Ta.push({date:new Date(A,ue+1,Ia),isCurrentMonth:false});return Ta},[qe]),St=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),le(false),!P||!i)return;let ue=Array.from(A.dataTransfer.files);if(ue.length!==0){j(true);try{await i(P.id,ue);}finally{j(false);}}},[P,i]),Yt=useCallback(async A=>{if(!P||!i||!A.target.files)return;let ue=Array.from(A.target.files);if(ue.length!==0){j(true);try{await i(P.id,ue);}finally{j(false);}A.target.value="";}},[P,i]),Se=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(true);},[]),ae=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(false);},[]),me=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),Ge=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.includes("document")?FileText:File,[]);return !t||!P?null:jsx(AnimatePresence,{children:t&&P&&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:u("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",M?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:u("px-6 py-3 border-b flex items-center gap-3 h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",M?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",M?"text-[#6B7280]":"text-gray-400"),children:P.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 A=P.progress===100?0:100,$e={...P,progress:A,status:A===100?"completed":"todo"};Lt($e);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",P.progress===100?"bg-green-500 border-green-500":M?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:P.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Oe,onChange:A=>ee(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",P.progress===100?"line-through text-[#6B7280]":M?"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:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ie(),Te(!re);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",P.progress===100||P.status==="completed"?"bg-green-500/20 text-green-400":P.progress&&P.progress>0||P.status==="in-progress"?"bg-blue-500/20 text-blue-400":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.progress===100||P.status==="completed"?n==="es"?"COMPLETADO":"DONE":P.progress&&P.progress>0||P.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:re&&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:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Re(A.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",P.status===A.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:M?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ie(),fe(!X$1);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[P.assignees&&P.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[P.assignees.slice(0,3).map((A,ue)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ue)),P.assignees.length>3&&jsxs("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:["+",P.assignees.length-3]})]}):jsx("span",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:X$1&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(A=>{let ue=P.assignees?.some($e=>$e.name===A.name);return jsxs("button",{onClick:()=>{let $e=P.assignees||[],Xe;ue?Xe=$e.filter(ft=>ft.name!==A.name):Xe=[...$e,A],Be("assignees",Xe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",ue&&(M?"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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",M?"text-white":"text-gray-900"),children:A.name}),ue&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ke(Fe?null:"start"),ot(P.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[P.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",M?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),P.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Fe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",M?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ue=new Date(A);ue.setDate(A.getDate()+1);let $e=new Date(A);$e.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Xe=new Date(A);Xe.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let ft=new Date(A);ft.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Va=new Date(A);Va.setDate(A.getDate()+14);let Ta=new Date(A);return Ta.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ue,display:ue.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:$e,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Xe,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ft,display:ft.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Va,display:Va.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Ta,display:Ta.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((xa,Ia)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Fe==="start"){let ir=P.endDate&&xa.date>P.endDate?xa.date:P.endDate;je(xa.date,ir),Ke("end");}else {let ir=P.startDate&&xa.date<P.startDate?xa.date:P.startDate;je(ir,xa.date),Ke(null);}},children:[jsx("span",{children:xa.label}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:xa.display})]},Ia))})(),jsx("div",{className:u("border-t mt-2 pt-2",M?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{je(void 0,void 0),Ke(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",M?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",M?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Fe==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",M?"text-white":"text-gray-900"),children:qe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ot(new Date),className:u("p-1 rounded text-sm transition-colors",M?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ot(new Date(qe.getFullYear(),qe.getMonth()-1)),className:u("p-1 rounded",M?"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:()=>ot(new Date(qe.getFullYear(),qe.getMonth()+1)),className:u("p-1 rounded",M?"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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",M?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((A,ue)=>{let $e=A.date.toDateString()===new Date().toDateString(),Xe=P.startDate?.toDateString()===A.date.toDateString(),ft=P.endDate?.toDateString()===A.date.toDateString(),Va=Xe||ft,Ta=P.startDate&&P.endDate&&A.date>=P.startDate&&A.date<=P.endDate;return jsx("button",{onClick:()=>{let Ua=new Date(A.date);if(Fe==="start"){let xa=P.endDate&&Ua>P.endDate?Ua:P.endDate;je(Ua,xa),Ke("end");}else {let xa=P.startDate&&Ua<P.startDate?Ua:P.startDate;je(xa,Ua),Ke(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(M?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(M?"text-white":"text-gray-900"),$e&&"ring-2 ring-[#2E94FF]",Xe&&"bg-[#2E94FF] text-white",ft&&!Xe&&"bg-[#7C3AED] text-white",Ta&&!Va&&(M?"bg-[#7C3AED]/20":"bg-purple-100"),!Va&&(M?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ue)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ie(),Z(!$);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",P.priority==="high"||P.priority==="urgent"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":P.priority==="low"?"bg-green-500/20 text-green-400":M?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:P.priority?P.priority==="high"||P.priority==="urgent"?n==="es"?"Alta":"High":P.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Z(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Be("priority",A.id),Z(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",P.priority===A.id&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:M?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:P.startDate&&P.endDate?`${Math.ceil((P.endDate.getTime()-P.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",M?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ne?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:P.progress||0,onChange:A=>{let ue=parseInt(A.target.value),$e=P.status;ue===100?$e="completed":ue>0?$e="in-progress":$e="todo";let Xe={...P,progress:ue,status:$e};Lt(Xe);},onBlur:()=>ut(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",M?"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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>ut(true),className:u("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",M?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",P.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${P.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",M?"text-white":"text-gray-900"),children:[P.progress||0,"%"]})]})]}),k&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:P.status==="completed"||P.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:v?.estimateMinutes?rn(v.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):v?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(v.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Je("estimate"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="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(Or,{mode:"estimate",locale:n,isDark:M,currentValue:v?.estimateMinutes||null,onSave:async A=>{await B?.(P.id,A),Je(false);},onClose:()=>Je(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ce?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",M?"text-[#94A3B8]":"text-gray-500"),title:n==="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"}):P.status==="completed"||P.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:P.quotedMinutes?rn(P.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):P.quotedMinutes?jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm px-2 py-0.5 rounded",M?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:rn(P.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Je("quoted"),className:u("text-sm",M?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="quoted"&&!ce&&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(Or,{mode:"quoted",locale:n,isDark:M,currentValue:P.quotedMinutes||null,onSave:async A=>{O?(await O(P.id,A),V(ue=>ue?{...ue,quotedMinutes:A}:null)):Be("quotedMinutes",A),Je(false);},onClose:()=>Je(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[P.status==="completed"||P.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",M?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxs("button",{type:"button",onClick:()=>G?.(P.id),className:u("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"}),Kb(E||0)]}):jsx("button",{type:"button",onClick:()=>I?.(P.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",M?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),P.status==="completed"||P.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",M?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Je("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",M?"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"}),n==="es"?"Agregar tiempo":"Add time"]}),v&&v.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",v.health==="over-budget"?"text-red-500":v.health==="at-risk"?"text-yellow-500":M?"text-white":"text-gray-900"),children:[rn(v.loggedMinutes),v.estimateMinutes&&jsxs("span",{className:u("font-normal",M?"text-[#6B7280]":"text-gray-400"),children:[" / ",rn(v.estimateMinutes)]})]}),v.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:u("h-full rounded-full transition-all",v.health==="over-budget"?"bg-red-500":v.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,v.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Ye==="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(Or,{mode:"log",locale:n,isDark:M,currentValue:null,onSave:async(A,ue)=>{A&&await T?.(P.id,{durationMinutes:A,note:ue,source:"manual"}),Je(false);},onClose:()=>Je(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(lo,{selectedTags:P.tags||[],availableTags:p,onChange:A=>{Be("tags",A);},onCreateTag:l,theme:q})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[P.dependencies&&P.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:P.dependencies.map(A=>{let ue=g.find($e=>$e.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",M?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ue?.name||A.slice(0,8),jsx("button",{onClick:()=>{let $e=(P.dependencies||[]).filter(Xe=>Xe!==A);Be("dependencies",$e);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Ie(),ct(!Me);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"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:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Me&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ct(false),Tt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",M?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Dt,onChange:A=>Tt(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",M?"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:g.length>0?g.filter(A=>A.id!==P.id).filter(A=>Dt===""||A.name.toLowerCase().includes(Dt.toLowerCase())).map(A=>{let ue=P.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let $e=P.dependencies||[],Xe;ue?Xe=$e.filter(ft=>ft!==A.id):Xe=[...$e,A.id],Be("dependencies",Xe);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",M?"hover:bg-white/5":"hover:bg-gray-50",ue&&(M?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ue?"bg-blue-500 border-blue-500":M?"border-white/30":"border-gray-300"),children:ue&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",M?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ie(),rt(!xe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",M?"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:P.color||"#6366F1"}}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:Mo.find(A=>A.value===P.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",M?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",M?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Mo.map(A=>{let ue=P.color===A.value;return jsx("button",{onClick:()=>{Be("color",A.value),rt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ue&&"ring-2 ring-offset-2",M?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ue?A.value:void 0},title:A.name,children:ue&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:P.isMilestone||false,onChange:A=>Be("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",P.isMilestone?"bg-purple-500 border-purple-500":M?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",M?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:u("w-4 h-4",M?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:se,onChange:A=>he(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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",M?"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:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",P.subtasks&&P.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",P.subtasks.filter(A=>A.progress===100).length,"/",P.subtasks.length,")"]})]})}),P.subtasks&&P.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...P.subtasks].sort((A,ue)=>(A.position??0)-(ue.position??0)).map(A=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",M?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>de(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.progress===100?"bg-green-500 border-green-500":M?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":M?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>ge(A.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",M?"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"})})]},A.id))}),dt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Rt,onChange:A=>Et(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Rt.trim()?J():A.key==="Escape"&&(mt(false),Et(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",M?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:J,disabled:!Rt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Rt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":M?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{mt(false),Et("");},className:u("p-2 rounded-lg transition-colors",M?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>mt(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",M?"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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",M?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",M?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(A=>{let ue=Ge(A.type),$e=A.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[$e&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",M?"bg-white/10":"bg-gray-200"),children:jsx(ue,{className:u("w-5 h-5",M?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",M?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:me(A.size)})]}),m&&jsx("button",{onClick:()=>m(A.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",M?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:Se,onDragLeave:ae,onDrop:St,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?M?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":M?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Yt,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!i||D}),D?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":M?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="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"})]})}),!i&&jsx("p",{className:u("text-xs mt-1",M?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",M?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",M?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",M?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",h.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",M?"text-[#6B7280]":"text-gray-400"),children:["(",h.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",M?"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: ${M?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsx("div",{ref:Nt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",M?"scrollbar-slim":"scrollbar-slim-light"),children:h.length>0?jsx("div",{className:"space-y-4",children:[...h].sort((A,ue)=>{let $e=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,Xe=typeof ue.createdAt=="string"?new Date(ue.createdAt):ue.createdAt;return $e.getTime()-Xe.getTime()}).map(A=>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:A.user?.color||"#8B5CF6"},children:A.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",M?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:Y(A.createdAt)})]}),jsx("div",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Tu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ue=>{let $e=ue.type.startsWith("image/");return jsxs("a",{href:ue.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$e?jsx(Image,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",M?"text-white":"text-gray-900"),children:ue.name})]},ue.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",M?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",M?"border-white/10":"border-gray-200"),children:jsx(Cu,{value:Ne,onChange:ze,onSubmit:z,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:it,theme:s,locale:n,currentUser:w,enableEmoji:true,enableAttachments:!!x,pendingFiles:nt,onFilesSelect:y,onRemoveFile:L})})]})]})]})})}function hl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:p,error:l,children:c,availableTags:i=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:h,onDeleteAttachment:b,comments:w,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:v,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:T,timerState:B,onLogTime:O,onUpdateEstimate:I,onUpdateSoldEffort:G,onStartTimer:S,onStopTimer:ce,onDiscardTimer:M,blurFinancials:q=false,sidePanel:ke,renderColumnMetrics:_e,suppressDetailModal:P=false}){let[V,re]=hl(),[Te,$]=useState(null),[Z,X]=useState(false),fe=useRef(null),Fe=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ke=o?.theme||"dark",qe=Ke==="dark"||Ke==="neutral",ot=qe?"dark":"",ne=useCallback((D,j)=>{t.onCardUpdate?.(D,j);},[t]),ut=useCallback((D,j)=>{t.onColumnUpdate?.(D,{title:j});},[t]),Me=useCallback(D=>{t.onColumnDelete?.(D);},[t]),ct=["todo","in-progress","completed"],Dt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Tt=useMemo(()=>{let D=new Map;return e.columns.forEach(j=>{let se=j.cardIds.map(ye=>e.cards.find(W=>W.id===ye)).filter(ye=>ye!==void 0).sort((ye,W)=>ye.position-W.position);D.set(j.id,se);}),D},[e.cards,e.columns]);useEffect(()=>{let D=fe.current;if(!D)return;let j=te=>{let Oe=te.target,Ce=te.button===1,He=Oe===D||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(Ce||te.button===0&&He&&!V.isDragging)&&(te.preventDefault(),X(true),Fe.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},se=te=>{if(!Z)return;let Oe=te.clientX-Fe.current.x,Ce=te.clientY-Fe.current.y;D.scrollLeft=Fe.current.scrollLeft-Oe,D.scrollTop=Fe.current.scrollTop-Ce;},ye=()=>{Z&&(X(false),D.style.cursor="",D.style.userSelect="");},W=()=>{Z&&(X(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",j),document.addEventListener("mousemove",se),document.addEventListener("mouseup",ye),D.addEventListener("mouseleave",W),()=>{D.removeEventListener("mousedown",j),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",ye),D.removeEventListener("mouseleave",W);}},[Z,V.isDragging]);let xe=useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(j=>typeof j=="string"?j:j.taskId):[]})),[e.cards]),rt=useCallback(D=>{let{active:j}=D,se=e.cards.find(ye=>ye.id===j.id);se&&re({isDragging:true,draggedCardId:se.id,sourceColumnId:se.columnId,targetColumnId:se.columnId});},[e.cards,re]),Ye=useCallback(D=>{let{active:j,over:se}=D;if(!se||!e.cards.find(te=>te.id===j.id))return;let W=null;se.data.current?.type==="column"?W=se.id:se.data.current?.type==="card"&&(W=e.cards.find(Oe=>Oe.id===se.id)?.columnId||null),W&&W!==V.targetColumnId&&re({...V,targetColumnId:W});},[e.cards,V,re]),Je=useCallback(async D=>{let{active:j,over:se}=D;if(re({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!se)return;let ye=e.cards.find(Ce=>Ce.id===j.id);if(!ye)return;let W,te;if(se.data.current?.type==="column"){W=se.id;let Ce=Tt.get(W)||[];te=Zi(Ce,0);}else {let Ce=e.cards.find(ze=>ze.id===se.id);if(!Ce)return;W=Ce.columnId;let He=Tt.get(W)||[],Ne=He.findIndex(ze=>ze.id===se.id);te=Zi(He,Ne);}let Oe=e.columns.find(Ce=>Ce.id===W);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let Ce=Tt.get(W)||[];if(ye.columnId!==W&&Ce.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,ye);return}}(ye.columnId!==W||ye.position!==te)&&await t.onCardMove?.(ye.id,W,te);},[e.cards,e.columns,Tt,t,re]),H=useCallback(D=>{P||$(D),a?.(D),v?.(D.id);},[a,v,P]),le=useCallback(D=>{t.onCardUpdate?.(D.id,D),$(D);},[t]);return p?jsx("div",{className:u("asakaa-board",ot,n),style:d,children:jsx(oh,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",ot,n),style:d,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(Qc,{themeName:Ke,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ke?"flex-row":""),children:[jsxs(DndContext,{sensors:Dt,collisionDetection:closestCorners,onDragStart:rt,onDragOver:Ye,onDragEnd:Je,children:[jsxs("div",{ref:fe,className:u("asakaa-board",ke?"flex-1":"",ot,n),style:{...d,cursor:Z?"grabbing":void 0},"data-theme":Ke,children:[e.columns.sort((D,j)=>D.position-j.position).map(D=>{let j=Tt.get(D.id)||[],se=!ct.includes(D.id),ye=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(tn,{column:D,cards:j,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:_e?(W,te)=>_e(W,te):void 0,onCardClick:H,onCardUpdate:ne,onColumnRename:t.onColumnUpdate?ut:void 0,onColumnDelete:t.onColumnDelete?Me:void 0,isDeletable:se,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),ye]},D.id)}),c]}),jsx(DragOverlay,{children:V.draggedCardId?jsx(Yr,{card:e.cards.find(D=>D.id===V.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ke]}),!P&&jsx(Xr,{task:Te,isOpen:!!Te,onClose:()=>$(null),onCardUpdate:le,theme:qe?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:i,onCreateTag:m,attachments:Te?g?.get(Te.id)||[]:[],onUploadAttachments:h,onDeleteAttachment:b,availableTasks:xe,comments:w,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:T,isTimerRunning:B?.isRunning,timerElapsedSeconds:B?.elapsedSeconds,onTimeLog:O,onEstimateUpdate:I,onSoldEffortUpdate:G,onTimerStart:S,onTimerStop:ce,onTimerDiscard:M,blurFinancials:q})]})}function oh({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 dh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},ch={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},uh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},ph={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function mh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let l=c=>{d.current&&!d.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let p=l=>{t(l),n(false);};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,c)=>l.position-c.position).map((l,c)=>jsxs(motion.button,{onClick:()=>p(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function gh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[d,p]=useState(null),l=useRef(null);if(useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let i=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,h)=>{if(h){p(g);try{await h();}catch(b){console.error(`Export ${g} failed:`,b);}finally{p(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:i.map((g,h)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function fh({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function xl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:p,translations:l,toolbarRightContent:c}){let i=r==="dark"?dh:ch,m={...o==="es"?uh:ph,...l},g=n||d||p;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:i.bgGrid,borderColor:i.border},children:jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxs(Fragment,{children:[c,jsx("div",{className:"w-px h-5",style:{backgroundColor:i.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(gh,{theme:i,t:m,onExportCSV:n,onExportJSON:d,onExportExcel:p}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:i.borderLight}})]}),t&&(s?jsx(mh,{columns:e,onSelect:t,theme:i,t:m,createTaskLabel:a}):jsx(fh,{onClick:()=>t(),label:a||m.newTask}))]})})}function wl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[d,p]=useState(""),l=useCallback(()=>{let m=d.trim();m&&(e(m),p(""),n(false));},[d,e]),c=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(p(""),n(false));},[l]),i=useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:d,onChange:m=>p(m.target.value),onKeyDown:c,onBlur:i,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!d.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:()=>{p(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ao({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:d="up"}){let[p,l]=useState(""),[c,i]=useState(void 0),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(false),[x,k]=useState(false),[v,C]=useState(false),[N,E]=useState(s||new Date),T=useRef(null),B=o==="es",O=d==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let I=useCallback(()=>{f(false),k(false),C(false);},[]),G=useCallback(()=>{l(""),i(void 0),g(null),b(null),I(),t();},[t,I]),S=useCallback(()=>{let q=p.trim();if(!q)return;let ke=a.find(P=>P.id===m),_e=h||s;e({name:q,priority:c,assignee:ke||void 0,assigneeId:m,startDate:_e,endDate:_e}),l(""),i(void 0),g(null),b(null),I(),T.current?.focus();},[p,c,m,h,s,a,e,I]),ce=useCallback(q=>{q.key==="Enter"&&p.trim()&&(q.preventDefault(),S()),q.key==="Escape"&&G();},[S,G,p]),M=h||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>I(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:p,onChange:q=>l(q.target.value),placeholder:B?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ce})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),f(!w),k(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",c?c==="urgent"||c==="high"?"text-red-400 bg-red-500/20":c==="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:w&&jsx(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:B?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:B?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:B?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:B?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:B?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{i(q.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",c===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),C(!v),f(false),k(false),E(h||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",h?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),M.toLocaleDateString(B?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:v&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,ke=new Date(q);ke.setDate(q.getDate()+1);let _e=new Date(q);_e.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let P=new Date(q);P.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let V=new Date(q);V.setDate(q.getDate()+14);let re=new Date(q);re.setDate(q.getDate()+28);let Te=B?"es-ES":"en-US";return [{label:B?"Hoy":"Today",date:q,display:q.toLocaleDateString(Te,{weekday:"short"}).slice(0,3)+"."},{label:B?"Ma\xF1ana":"Tomorrow",date:ke,display:ke.toLocaleDateString(Te,{weekday:"short"}).slice(0,3)+"."},{label:B?"Este fin de semana":"This weekend",date:_e,display:B?"s\xE1b.":"sat."},{label:B?"Pr\xF3xima semana":"Next week",date:P,display:B?"lun.":"mon."},{label:B?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(Te,{day:"numeric",month:"short"})},{label:B?"4 semanas":"4 weeks",date:re,display:re.toLocaleDateString(Te,{day:"numeric",month:"short"})}].map((Z,X)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{b(Z.date),C(false);},children:[jsx("span",{children:Z.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Z.display})]},X))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:N.toLocaleDateString(B?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>E(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:B?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>E(new Date(N.getFullYear(),N.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>E(new Date(N.getFullYear(),N.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(B?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=N.getFullYear(),ke=N.getMonth(),_e=new Date(q,ke,1).getDay(),P=new Date(q,ke+1,0).getDate(),V=new Date(q,ke,0).getDate(),re=new Date().toDateString(),Te=[];for(let Z=_e-1;Z>=0;Z--)Te.push({dayNum:V-Z,isCurrent:false,date:new Date(q,ke-1,V-Z)});for(let Z=1;Z<=P;Z++)Te.push({dayNum:Z,isCurrent:true,date:new Date(q,ke,Z)});let $=42-Te.length;for(let Z=1;Z<=$;Z++)Te.push({dayNum:Z,isCurrent:false,date:new Date(q,ke+1,Z)});return Te.map((Z,X)=>{let fe=Z.date.toDateString()===re,Fe=(h||s)?.toDateString()===Z.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!Z.isCurrent&&(r?"text-white/20":"text-gray-300"),Z.isCurrent&&(r?"text-white":"text-gray-900"),fe&&"ring-1 ring-[#007FFF]",Fe&&"bg-[#007FFF] text-white",!Fe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(Z.date),C(false);},children:Z.dayNum},X)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),k(!x),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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(q=>q.id===m)?.color||"#007FFF"},children:a.find(q=>q.id===m)?.initials||a.find(q=>q.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:x&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),k(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:B?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),k(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===q.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:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:B?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:S,disabled:!p.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",p.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:B?"Guardar":"Save"})]})]})}function Dl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:d="es"}){let[p,l]=useState(false),c=useRef(null),i=useRef(null),[m,g]=useState({}),[h,b]=useState(false),w=n==="dark",x={buttonLabel:o||(d==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!p||!c.current)return;let v=90,C=()=>{let N=c.current.getBoundingClientRect(),T=window.innerHeight-N.bottom<v+8;b(T),g({position:"fixed",...T?{bottom:window.innerHeight-N.top+4}:{top:N.bottom+4},left:N.left,width:N.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[p]),useEffect(()=>{if(!p)return;let v=C=>{let N=C.target;i.current&&!i.current.contains(N)&&c.current&&!c.current.contains(N)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[p]);let k=useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxs("div",{ref:c,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!p),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"})]}),x.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:p&&jsx(motion.div,{ref:i,initial:{opacity:0,y:h?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:h?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",w?"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(Ao,{onSubmit:k,onCancel:()=>l(false),availableUsers:a,isDark:w,locale:d,dropdownDirection:"up"})})}),document.body)]})}var Wn=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(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function ap(e={}){return new Wn(e)}var on=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Sl(e,t){let a=r=>jsx(on,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Fl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:p,shortcut:l="k",className:c=""}){let[i,m]=useState(false),[g,h]=useState(""),[b,w]=useState("home"),[f,x]=useState(""),[k,v]=useState("");useEffect(()=>{let T=B=>{(B.metaKey||B.ctrlKey)&&B.key===l&&(B.preventDefault(),m(O=>!O)),B.key==="Escape"&&(m(false),w("home"),h(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),useEffect(()=>{i||(w("home"),h(""),x(""),v(""));},[i]);let C=useCallback(()=>{m(false);},[]),N=useCallback(T=>{let[B,O]=T.split(":");switch(B){case "create-card":w("create-card");break;case "create-card-in":x(O||"");break;case "navigate":O?(a?.(O),C()):w("navigate");break;case "search":r?.(g),C();break;case "priority":w("priority");break;case "set-priority":k&&O&&(o?.(k,O),C());break;case "assign":w("assign");break;case "assign-user":k&&O&&(s?.(k,O),C());break;case "ai":w("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":d?.(),C();break;case "ai-usage":p?.(),C();break;case "back":w("home");break;}},[g,k,t,a,r,o,s,n,d,p,C]),E=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return i?jsx(It,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${c}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:h,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:b==="create-card"&&f?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&f&&E();}}),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."}),b==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,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:N,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:N,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:N,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(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(B=>jsx("span",{className:"command-palette-item-label",children:B},B))})]},T.id))})]}),b==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:N,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:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),b==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(T=>{let B=e.columns.find(O=>O.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:N,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(O=>jsx("span",{className:"command-palette-item-label",children:O},O))})]},T.id)})})]}),b==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 np(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
18
+ `}),jsx("div",{ref:Nt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",M?"scrollbar-slim":"scrollbar-slim-light"),children:h.length>0?jsx("div",{className:"space-y-4",children:[...h].sort((A,ue)=>{let $e=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,Xe=typeof ue.createdAt=="string"?new Date(ue.createdAt):ue.createdAt;return $e.getTime()-Xe.getTime()}).map(A=>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:A.user?.color||"#8B5CF6"},children:A.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:u("text-sm font-medium",M?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",M?"text-[#6B7280]":"text-gray-400"),children:Y(A.createdAt)})]}),jsx("div",{className:u("text-sm",M?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Nu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ue=>{let $e=ue.type.startsWith("image/");return jsxs("a",{href:ue.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",M?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[$e?jsx(Image,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",M?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",M?"text-white":"text-gray-900"),children:ue.name})]},ue.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",M?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",M?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",M?"border-white/10":"border-gray-200"),children:jsx(Tu,{value:Ne,onChange:ze,onSubmit:z,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!b,isSubmitting:it,theme:s,locale:n,currentUser:w,enableEmoji:true,enableAttachments:!!x,pendingFiles:nt,onFilesSelect:y,onRemoveFile:L})})]})]})]})})}function yl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function po({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:p,error:l,children:c,availableTags:i=[],onCreateTag:m,attachmentsByCard:g,onUploadAttachments:h,onDeleteAttachment:b,comments:w,onAddComment:f,currentUser:x,mentionableUsers:k,onTaskOpen:v,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:T,timerState:B,onLogTime:O,onUpdateEstimate:I,onUpdateSoldEffort:G,onStartTimer:S,onStopTimer:ce,onDiscardTimer:M,blurFinancials:q=false,sidePanel:ke,renderColumnMetrics:_e,suppressDetailModal:P=false}){let[V,re]=yl(),[Te,$]=useState(null),[Z,X]=useState(false),fe=useRef(null),Fe=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ke=o?.theme||"dark",qe=Ke==="dark"||Ke==="neutral",ot=qe?"dark":"",ne=useCallback((D,j)=>{t.onCardUpdate?.(D,j);},[t]),ut=useCallback((D,j)=>{t.onColumnUpdate?.(D,{title:j});},[t]),Me=useCallback(D=>{t.onColumnDelete?.(D);},[t]),ct=["todo","in-progress","completed"],Dt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Tt=useMemo(()=>{let D=new Map;return e.columns.forEach(j=>{let se=j.cardIds.map(ye=>e.cards.find(W=>W.id===ye)).filter(ye=>ye!==void 0).sort((ye,W)=>ye.position-W.position);D.set(j.id,se);}),D},[e.cards,e.columns]);useEffect(()=>{let D=fe.current;if(!D)return;let j=te=>{let Oe=te.target,Ce=te.button===1,He=Oe===D||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(Ce||te.button===0&&He&&!V.isDragging)&&(te.preventDefault(),X(true),Fe.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},se=te=>{if(!Z)return;let Oe=te.clientX-Fe.current.x,Ce=te.clientY-Fe.current.y;D.scrollLeft=Fe.current.scrollLeft-Oe,D.scrollTop=Fe.current.scrollTop-Ce;},ye=()=>{Z&&(X(false),D.style.cursor="",D.style.userSelect="");},W=()=>{Z&&(X(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",j),document.addEventListener("mousemove",se),document.addEventListener("mouseup",ye),D.addEventListener("mouseleave",W),()=>{D.removeEventListener("mousedown",j),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",ye),D.removeEventListener("mouseleave",W);}},[Z,V.isDragging]);let xe=useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(j=>typeof j=="string"?j:j.taskId):[]})),[e.cards]),rt=useCallback(D=>{let{active:j}=D,se=e.cards.find(ye=>ye.id===j.id);se&&re({isDragging:true,draggedCardId:se.id,sourceColumnId:se.columnId,targetColumnId:se.columnId});},[e.cards,re]),Ye=useCallback(D=>{let{active:j,over:se}=D;if(!se||!e.cards.find(te=>te.id===j.id))return;let W=null;se.data.current?.type==="column"?W=se.id:se.data.current?.type==="card"&&(W=e.cards.find(Oe=>Oe.id===se.id)?.columnId||null),W&&W!==V.targetColumnId&&re({...V,targetColumnId:W});},[e.cards,V,re]),Je=useCallback(async D=>{let{active:j,over:se}=D;if(re({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!se)return;let ye=e.cards.find(Ce=>Ce.id===j.id);if(!ye)return;let W,te;if(se.data.current?.type==="column"){W=se.id;let Ce=Tt.get(W)||[];te=el(Ce,0);}else {let Ce=e.cards.find(ze=>ze.id===se.id);if(!Ce)return;W=Ce.columnId;let He=Tt.get(W)||[],Ne=He.findIndex(ze=>ze.id===se.id);te=el(He,Ne);}let Oe=e.columns.find(Ce=>Ce.id===W);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let Ce=Tt.get(W)||[];if(ye.columnId!==W&&Ce.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,ye);return}}(ye.columnId!==W||ye.position!==te)&&await t.onCardMove?.(ye.id,W,te);},[e.cards,e.columns,Tt,t,re]),H=useCallback(D=>{P||$(D),a?.(D),v?.(D.id);},[a,v,P]),le=useCallback(D=>{t.onCardUpdate?.(D.id,D),$(D);},[t]);return p?jsx("div",{className:u("asakaa-board",ot,n),style:d,children:jsx(sh,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",ot,n),style:d,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(Zc,{themeName:Ke,children:[jsxs("div",{className:u("flex h-full overflow-hidden",ke?"flex-row":""),children:[jsxs(DndContext,{sensors:Dt,collisionDetection:closestCorners,onDragStart:rt,onDragOver:Ye,onDragEnd:Je,children:[jsxs("div",{ref:fe,className:u("asakaa-board",ke?"flex-1":"",ot,n),style:{...d,cursor:Z?"grabbing":void 0},"data-theme":Ke,children:[e.columns.sort((D,j)=>D.position-j.position).map(D=>{let j=Tt.get(D.id)||[],se=!ct.includes(D.id),ye=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(tn,{column:D,cards:j,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:_e?(W,te)=>_e(W,te):void 0,onCardClick:H,onCardUpdate:ne,onColumnRename:t.onColumnUpdate?ut:void 0,onColumnDelete:t.onColumnDelete?Me:void 0,isDeletable:se,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),ye]},D.id)}),c]}),jsx(DragOverlay,{children:V.draggedCardId?jsx(Yr,{card:e.cards.find(D=>D.id===V.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),ke]}),!P&&jsx(Xr,{task:Te,isOpen:!!Te,onClose:()=>$(null),onCardUpdate:le,theme:qe?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:i,onCreateTag:m,attachments:Te?g?.get(Te.id)||[]:[],onUploadAttachments:h,onDeleteAttachment:b,availableTasks:xe,comments:w,onAddComment:f,currentUser:x,mentionableUsers:k,onUploadCommentAttachments:C,enableTimeTracking:N,timeTrackingSummary:E,timeEntries:T,isTimerRunning:B?.isRunning,timerElapsedSeconds:B?.elapsedSeconds,onTimeLog:O,onEstimateUpdate:I,onSoldEffortUpdate:G,onTimerStart:S,onTimerStop:ce,onTimerDiscard:M,blurFinancials:q})]})}function sh({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 uh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},ph={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},mh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},gh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function fh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let l=c=>{d.current&&!d.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let p=l=>{t(l),n(false);};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,c)=>l.position-c.position).map((l,c)=>jsxs(motion.button,{onClick:()=>p(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function bh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[d,p]=useState(null),l=useRef(null);if(useEffect(()=>{let g=h=>{l.current&&!l.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let i=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),m=async(g,h)=>{if(h){p(g);try{await h();}catch(b){console.error(`Export ${g} failed:`,b);}finally{p(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:i.map((g,h)=>jsxs(motion.button,{onClick:()=>m(g.id,g.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:h<i.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function hh({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function vl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:p,translations:l,toolbarRightContent:c}){let i=r==="dark"?uh:ph,m={...o==="es"?mh:gh,...l},g=n||d||p;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:i.bgGrid,borderColor:i.border},children:jsxs("div",{className:"flex items-center gap-3",children:[c&&jsxs(Fragment,{children:[c,jsx("div",{className:"w-px h-5",style:{backgroundColor:i.borderLight}})]}),g&&jsxs(Fragment,{children:[jsx(bh,{theme:i,t:m,onExportCSV:n,onExportJSON:d,onExportExcel:p}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:i.borderLight}})]}),t&&(s?jsx(fh,{columns:e,onSelect:t,theme:i,t:m,createTaskLabel:a}):jsx(hh,{onClick:()=>t(),label:a||m.newTask}))]})})}function kl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[d,p]=useState(""),l=useCallback(()=>{let m=d.trim();m&&(e(m),p(""),n(false));},[d,e]),c=useCallback(m=>{m.key==="Enter"?(m.preventDefault(),l()):m.key==="Escape"&&(p(""),n(false));},[l]),i=useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:d,onChange:m=>p(m.target.value),onKeyDown:c,onBlur:i,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!d.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:()=>{p(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Ao({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:d="up"}){let[p,l]=useState(""),[c,i]=useState(void 0),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(false),[x,k]=useState(false),[v,C]=useState(false),[N,E]=useState(s||new Date),T=useRef(null),B=o==="es",O=d==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let I=useCallback(()=>{f(false),k(false),C(false);},[]),G=useCallback(()=>{l(""),i(void 0),g(null),b(null),I(),t();},[t,I]),S=useCallback(()=>{let q=p.trim();if(!q)return;let ke=a.find(P=>P.id===m),_e=h||s;e({name:q,priority:c,assignee:ke||void 0,assigneeId:m,startDate:_e,endDate:_e}),l(""),i(void 0),g(null),b(null),I(),T.current?.focus();},[p,c,m,h,s,a,e,I]),ce=useCallback(q=>{q.key==="Enter"&&p.trim()&&(q.preventDefault(),S()),q.key==="Escape"&&G();},[S,G,p]),M=h||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>I(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:p,onChange:q=>l(q.target.value),placeholder:B?"Nombre de la tarea...":"Task name...",className:u("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ce})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),f(!w),k(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",c?c==="urgent"||c==="high"?"text-red-400 bg-red-500/20":c==="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:w&&jsx(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:B?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:B?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:B?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:B?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:B?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{i(q.id),f(false);},type:"button",className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",c===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),C(!v),f(false),k(false),E(h||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",h?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),M.toLocaleDateString(B?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:v&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,ke=new Date(q);ke.setDate(q.getDate()+1);let _e=new Date(q);_e.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let P=new Date(q);P.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let V=new Date(q);V.setDate(q.getDate()+14);let re=new Date(q);re.setDate(q.getDate()+28);let Te=B?"es-ES":"en-US";return [{label:B?"Hoy":"Today",date:q,display:q.toLocaleDateString(Te,{weekday:"short"}).slice(0,3)+"."},{label:B?"Ma\xF1ana":"Tomorrow",date:ke,display:ke.toLocaleDateString(Te,{weekday:"short"}).slice(0,3)+"."},{label:B?"Este fin de semana":"This weekend",date:_e,display:B?"s\xE1b.":"sat."},{label:B?"Pr\xF3xima semana":"Next week",date:P,display:B?"lun.":"mon."},{label:B?"2 semanas":"2 weeks",date:V,display:V.toLocaleDateString(Te,{day:"numeric",month:"short"})},{label:B?"4 semanas":"4 weeks",date:re,display:re.toLocaleDateString(Te,{day:"numeric",month:"short"})}].map((Z,X)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{b(Z.date),C(false);},children:[jsx("span",{children:Z.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Z.display})]},X))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:N.toLocaleDateString(B?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>E(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:B?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>E(new Date(N.getFullYear(),N.getMonth()-1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>E(new Date(N.getFullYear(),N.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(B?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=N.getFullYear(),ke=N.getMonth(),_e=new Date(q,ke,1).getDay(),P=new Date(q,ke+1,0).getDate(),V=new Date(q,ke,0).getDate(),re=new Date().toDateString(),Te=[];for(let Z=_e-1;Z>=0;Z--)Te.push({dayNum:V-Z,isCurrent:false,date:new Date(q,ke-1,V-Z)});for(let Z=1;Z<=P;Z++)Te.push({dayNum:Z,isCurrent:true,date:new Date(q,ke,Z)});let $=42-Te.length;for(let Z=1;Z<=$;Z++)Te.push({dayNum:Z,isCurrent:false,date:new Date(q,ke+1,Z)});return Te.map((Z,X)=>{let fe=Z.date.toDateString()===re,Fe=(h||s)?.toDateString()===Z.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!Z.isCurrent&&(r?"text-white/20":"text-gray-300"),Z.isCurrent&&(r?"text-white":"text-gray-900"),fe&&"ring-1 ring-[#007FFF]",Fe&&"bg-[#007FFF] text-white",!Fe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{b(Z.date),C(false);},children:Z.dayNum},X)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),k(!x),f(false),C(false);},type:"button",className:u("p-1 rounded transition-colors",m?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:m?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(q=>q.id===m)?.color||"#007FFF"},children:a.find(q=>q.id===m)?.initials||a.find(q=>q.id===m)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:x&&jsxs(motion.div,{initial:{opacity:0,y:d==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:d==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",O,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),k(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!m&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:B?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{g(q.id),k(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",m===q.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:q.color||"#007FFF"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:B?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:S,disabled:!p.trim(),type:"button",className:u("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",p.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:B?"Guardar":"Save"})]})]})}function Sl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:d="es"}){let[p,l]=useState(false),c=useRef(null),i=useRef(null),[m,g]=useState({}),[h,b]=useState(false),w=n==="dark",x={buttonLabel:o||(d==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!p||!c.current)return;let v=90,C=()=>{let N=c.current.getBoundingClientRect(),T=window.innerHeight-N.bottom<v+8;b(T),g({position:"fixed",...T?{bottom:window.innerHeight-N.top+4}:{top:N.bottom+4},left:N.left,width:N.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[p]),useEffect(()=>{if(!p)return;let v=C=>{let N=C.target;i.current&&!i.current.contains(N)&&c.current&&!c.current.contains(N)&&l(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[p]);let k=useCallback(v=>{t({name:v.name,columnId:e,assigneeIds:v.assigneeId?[v.assigneeId]:void 0,startDate:v.startDate,endDate:v.endDate,priority:v.priority});},[t,e]);return jsxs("div",{ref:c,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!p),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"})]}),x.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:p&&jsx(motion.div,{ref:i,initial:{opacity:0,y:h?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:h?4:-4,scale:.97},transition:{duration:.12},style:m,className:u("rounded-lg shadow-2xl",w?"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(Ao,{onSubmit:k,onCancel:()=>l(false),availableUsers:a,isDark:w,locale:d,dropdownDirection:"up"})})}),document.body)]})}var Wn=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(po,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
19
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function rp(e={}){return new Wn(e)}var on=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function El(e,t){let a=r=>jsx(on,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Pl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:p,shortcut:l="k",className:c=""}){let[i,m]=useState(false),[g,h]=useState(""),[b,w]=useState("home"),[f,x]=useState(""),[k,v]=useState("");useEffect(()=>{let T=B=>{(B.metaKey||B.ctrlKey)&&B.key===l&&(B.preventDefault(),m(O=>!O)),B.key==="Escape"&&(m(false),w("home"),h(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),useEffect(()=>{i||(w("home"),h(""),x(""),v(""));},[i]);let C=useCallback(()=>{m(false);},[]),N=useCallback(T=>{let[B,O]=T.split(":");switch(B){case "create-card":w("create-card");break;case "create-card-in":x(O||"");break;case "navigate":O?(a?.(O),C()):w("navigate");break;case "search":r?.(g),C();break;case "priority":w("priority");break;case "set-priority":k&&O&&(o?.(k,O),C());break;case "assign":w("assign");break;case "assign-user":k&&O&&(s?.(k,O),C());break;case "ai":w("ai");break;case "ai-generate-plan":n?.(),C();break;case "ai-predict-risks":d?.(),C();break;case "ai-usage":p?.(),C();break;case "back":w("home");break;}},[g,k,t,a,r,o,s,n,d,p,C]),E=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),C());},[f,g,t,C]);return i?jsx(It,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${c}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:h,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:b==="create-card"&&f?"Type card title and press Enter...":b==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&b==="create-card"&&f&&E();}}),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."}),b==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,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:N,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:N,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:N,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(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(B=>jsx("span",{className:"command-palette-item-label",children:B},B))})]},T.id))})]}),b==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:N,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:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),b==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(T=>{let B=e.columns.find(O=>O.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:N,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:B?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(O=>jsx("span",{className:"command-palette-item-label",children:O},O))})]},T.id)})})]}),b==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 sp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
20
20
  position: fixed !important;
21
21
  inset: 0 !important;
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
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=h=>{h.stopPropagation();let b=r<a.length-1?r+1:0;l(),o(b);},n.appendChild(i),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(p),document.body.appendChild(n),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function Ph(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 Mh(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 Ml(e){return e.startsWith("image/")}function zr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=useState(false),[p,l]=useState(false),[c,i]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let h=useCallback((T,B)=>{B.preventDefault(),B.stopPropagation();let O=g.current.filter(S=>Ml(S.type)),I=O.findIndex(S=>S.id===T.id),G=S=>{let ce=g.current.filter(q=>Ml(q.type)),M=ce[S];M&&np(M.url,M.name,ce,S,G);};np(T.url,T.name,O,I,G);},[]),b=useCallback(T=>{let B=[],O=[];return e.length+T.length>s?(O.push(`Maximum ${s} files allowed`),{valid:B,errors:O}):(T.forEach(I=>{if(I.size/1048576>r){O.push(`${I.name} is too large (max ${r}MB)`);return}if(o&&!o.some(S=>I.type.match(S))){O.push(`${I.name} has invalid file type`);return}B.push(I);}),{valid:B,errors:O})},[e.length,s,r,o]),w=useCallback(async T=>{let{valid:B,errors:O}=b(T);if(O.length>0){i(O.join(", ")),setTimeout(()=>i(null),5e3);return}if(B.length!==0){l(true),i(null);try{await t?.(B);}catch(I){i(I instanceof Error?I.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{l(false);}}},[b,t]),f=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),k=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),v=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let B=Array.from(T.dataTransfer.files);w(B);},[w]),C=useCallback(T=>{let B=T.target.files?Array.from(T.target.files):[];w(B),m.current&&(m.current.value="");},[w]),N=useCallback(()=>{m.current?.click();},[]),E=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${p?"uploading":""}`,onDragEnter:f,onDragLeave:x,onDragOver:k,onDrop:v,onClick:N,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:p?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:n?"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"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ml(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>h(T,B),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:Mh(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Ph(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>E(T.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"})})})]},T.id))})]})}function Al({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:p=[],attachments:l=[],onAddComment:c,onDeleteComment:i,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:h,onGenerateSubtasks:b,onEstimateEffort:w,currentUserId:f="user-1"}){let[x,k]=useState("details"),[v,C]=useState(false),[N,E]=useState({}),[T,B]=useState(""),[O,I]=useState(false),[G,S]=useState({});if(!t||!e)return null;let ce=useCallback(()=>{C(false),E({}),k("details"),B(""),S({}),a();},[a]),M=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),E({}),C(false));},[e.id,N,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ce());},[e.id,o,ce]),ke=useCallback(()=>{c&&T.trim()&&(c(e.id,T.trim()),B(""));},[e.id,T,c]),_e=useCallback(async()=>{if(h){I(true);try{let $=await h(e);S(Z=>({...Z,assignees:$}));}catch($){console.error("Failed to suggest assignee:",$);}finally{I(false);}}},[e,h]),P=useCallback(async()=>{if(b){I(true);try{let $=await b(e);S(Z=>({...Z,subtasks:$}));}catch($){console.error("Failed to generate subtasks:",$);}finally{I(false);}}},[e,b]),V=useCallback(async()=>{if(w){I(true);try{let $=await w(e);S(Z=>({...Z,effort:$}));}catch($){console.error("Failed to estimate effort:",$);}finally{I(false);}}},[e,w]),re={...e,...N},Te=s.filter($=>re.assignedUserIds?.includes($.id));return jsx(It,{children:jsx("div",{className:"card-detail-overlay",onClick:ce,children:jsxs("div",{className:"card-detail-modal",onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),v?jsx("input",{type:"text",value:N.title??re.title,onChange:$=>E({...N,title:$.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:re.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[v?jsxs(Fragment,{children:[jsx("button",{onClick:M,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{C(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:q,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:ce,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>k("details"),className:`card-detail-tab ${x==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxs("button",{onClick:()=>k("comments"),className:`card-detail-tab ${x==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>k("activity"),className:`card-detail-tab ${x==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>k("attachments"),className:`card-detail-tab ${x==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>k("ai"),className:`card-detail-tab ${x==="ai"?"active":""}`,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"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[x==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),v?jsx("textarea",{value:N.description??re.description??"",onChange:$=>E({...N,description:$.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:re.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),v?jsx("select",{multiple:true,value:N.assignedUserIds??re.assignedUserIds??[],onChange:$=>{let Z=Array.from($.target.selectedOptions,X=>X.value);E({...N,assignedUserIds:Z});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map($=>jsx("option",{value:$.id,children:$.name},$.id))}):jsx("div",{className:"card-detail-users",children:Te.length>0?Te.map($=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:$.color},children:$.initials}),jsx("span",{children:$.name})]},$.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),v?jsxs("select",{value:N.priority??re.priority??"",onChange:$=>E({...N,priority:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:re.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:re.labels&&re.labels.length>0?re.labels.map($=>jsx("span",{className:"card-detail-label-tag",children:$},$)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),v?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:re.startDate?new Date(re.startDate).toISOString().split("T")[0]:"",onChange:$=>E({...N,startDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.startDate?new Date(re.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),v?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:re.endDate?new Date(re.endDate).toISOString().split("T")[0]:"",onChange:$=>E({...N,endDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),v?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??re.estimatedTime??"",onChange:$=>E({...N,estimatedTime:$.target.value?parseFloat($.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:re.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:re.dependencies&&re.dependencies.length>0?re.dependencies.map($=>{let Z=typeof $=="string"?$:$.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",Z.slice(-4)]},Z)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:re.createdAt?new Date(re.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:$=>B($.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ke,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map($=>{let Z=s.find(X=>X.id===$.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[Z&&jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:Z?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date($.createdAt).toLocaleString()})]})]}),i&&jsx("button",{onClick:()=>i($.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:$.content})]},$.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),x==="activity"&&jsx("div",{className:"card-detail-activity",children:d.length>0?jsx("div",{className:"card-detail-activity-list",children:d.map($=>{let Z=s.find(X=>X.id===$.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("COMMENT")&&"\u{1F4AC}",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",$.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:Z?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:$.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),x==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(zr,{cardId:e.id,attachments:l,onUpload:m?$=>m(e.id,$):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),x==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:_e,disabled:O||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:P,disabled:O||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:V,disabled:O||!w,className:"card-detail-ai-btn",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 6 12 12 16 14"})]}),"Estimate Effort"]})]}),G.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map(($,Z)=>{let X=s.find(fe=>fe.id===$.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:$.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",($.confidence*100).toFixed(0),"%"]})]})]},Z)})]}),G.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map(($,Z)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:$.title}),$.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:$.description}),$.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",$.estimatedTime,"h"]})]},Z))]}),G.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[G.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),p.map($=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${$.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:$.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:$.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:$.description}),$.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",$.suggestedAction]})]},$.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&p.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",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("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Gn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,p]=useState({top:0,left:0}),l=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let i=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,h=4,b=i.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let w=m-i.bottom,f=i.top,x;return w>=s+h?x=i.bottom+h:f>=s+h?x=i.top-s-h:w>=f?x=i.bottom+h:x=Math.max(10,i.top-s-h),{top:x,left:b}},[e,o,s]);return useEffect(()=>{t&&p(c());},[t,c]),useEffect(()=>{if(!t)return;let i=g=>{let h=g.target;l.current&&!l.current.contains(h)&&e.current&&!e.current.contains(h)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",i);}},[t,a,e]),useEffect(()=>{if(!t)return;let i=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsx(It,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var et={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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 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)"}};var Hh=["LOW","MEDIUM","HIGH","URGENT"],zh=["todo","in-progress","review","done"];function Bl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:p,onDeleteComment:l,currentUser:c,onAIGenerateDescription:i,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:h=[],availableLabels:b=[],availableTags:w=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:v,onSubtasksChange:C,attachments:N=[],onUploadAttachments:E,onDeleteAttachment:T}){let B=Qo(),O=v||B?.themeName||"dark",[I,G]=useState(e),[S,ce]=useState(false),[M,q]=useState(()=>[...e?.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0))),[ke,_e]=useState(false),[P,V]=useState(""),[re,Te]=useState(""),[$,Z]=useState("all"),[X,fe]=useState(false),[Fe,Ke]=useState(false),[qe,ot]=useState(false),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState(false),xe=useRef(null),rt=useRef(null),Ye=useRef(null),Je=useRef(null),H=useRef(null),le=useRef(null),D=useRef(null),j=useRef(null),se=useRef(null),ye=useRef(null),W=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!I){G({...e});let y=[...e.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0));q(y);}else if(e&&I&&e.id!==I.id){G({...e});let y=[...e.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0));q(y);}},[e,I]),useEffect(()=>{let y=L=>{let z=L.target;Je.current&&!Je.current.contains(z)&&fe(false),H.current&&!H.current.contains(z)&&Ke(false),le.current&&!le.current.contains(z)&&ot(false),D.current&&!D.current.contains(z)&&ut(false);};if(X||Fe||qe||ne)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[X,Fe,qe,ne]),useEffect(()=>{if(!t)return;let y=L=>{let z=L.target,J=z.tagName==="INPUT"||z.tagName==="TEXTAREA"||z.isContentEditable;if(L.key==="Escape"){L.preventDefault(),X||Fe||qe||ne||Me||Dt?(fe(false),Ke(false),ot(false),ut(false),ct(false),Tt(false)):J||a();return}if(J&&L.key!=="Escape")return;let de=L.metaKey||L.ctrlKey;switch(L.key.toLowerCase()){case "s":L.preventDefault(),fe(true);break;case "a":L.preventDefault(),ot(true);break;case "p":L.preventDefault(),Ke(true);break;case "l":L.preventDefault(),ut(true);break;case "d":de||(L.preventDefault(),ct(true),setTimeout(()=>j.current?.focus(),0));break;case "e":de||(L.preventDefault(),Tt(true));break;case "i":L.preventDefault(),ce(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":L.preventDefault(),_e(true);break;case "c":L.preventDefault(),Ye.current?.focus();break}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t,a,X,Fe,qe,ne,Me,Dt]);let Oe=useCallback(y=>{let L=y.currentTarget.textContent?.trim()||"";if(I&&L!==I.title){let z={...I,title:L};G(z),r?.(I.id,{title:L});}},[I,r]),Ce=useCallback(y=>{y.key==="Enter"&&(y.preventDefault(),y.currentTarget.blur()),y.key==="Escape"&&(y.preventDefault(),y.currentTarget.textContent=I?.title||"",y.currentTarget.blur());},[I]),He=useCallback(()=>{I&&e&&I.description!==e.description&&r?.(I.id,{description:I.description}),ce(false);},[I,e,r]),Ne=useCallback(y=>{if(I){let L={...I,columnId:y};G(L),r?.(I.id,{columnId:y}),fe(false);}},[I,r]),ze=useCallback(y=>{if(I){let L={...I,priority:y};G(L),r?.(I.id,{priority:y}),Ke(false);}},[I,r]),it=useCallback(y=>{if(I){let L=I.assignedUserIds||[],z=L.includes(y)?L.filter(de=>de!==y):[...L,y],J={...I,assignedUserIds:z};G(J),r?.(I.id,{assignedUserIds:z});}},[I,r]),st=useCallback(y=>{if(I){let L=I.labels||[],z=L.includes(y)?L.filter(de=>de!==y):[...L,y],J={...I,labels:z};G(J),r?.(I.id,{labels:z});}},[I,r]),nt=useCallback(y=>{if(I){let L={...I,tags:y};G(L),r?.(I.id,{tags:y});}},[I,r]),pt=useCallback(y=>{if(I){let L=y.target.value,z={...I,endDate:L};G(z),r?.(I.id,{endDate:L}),ct(false);}},[I,r]),Rt=useCallback(y=>{if(I){let L={...I,estimatedTime:parseFloat(y)||0};G(L),r?.(I.id,{estimatedTime:parseFloat(y)||0});}},[I,r]),Et=useCallback(()=>{if(P.trim()&&I){let y={id:`subtask-${Date.now()}`,title:P.trim(),completed:false,position:M.length,createdAt:new Date},L=[...M,y];q(L),V(""),_e(false),C?.(I.id,L);}},[P,M,I,C]),dt=useCallback(y=>{let L=M.map(z=>z.id===y?{...z,completed:!z.completed,updatedAt:new Date}:z);q(L),I&&C?.(I.id,L);},[M,I,C]),mt=useCallback(y=>{let L=M.filter(z=>z.id!==y);q(L),I&&C?.(I.id,L);},[M,I,C]),Nt=useCallback(()=>{re.trim()&&I&&p&&(p(I.id,re.trim()),Te(""));},[re,I,p]),Lt=useCallback(y=>{(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&(y.preventDefault(),Nt());},[Nt]),Ie=y=>jsx(Rh,{remarkPlugins:[Oh],rehypePlugins:[$h],components:{a:({node:L,...z})=>jsx("a",{...z,target:"_blank",rel:"noopener noreferrer"})},children:y}),Be=d.filter(y=>$==="comments"?y.type.includes("COMMENT"):$==="history"?!y.type.includes("COMMENT"):true);if(!t||!e)return null;let K=I||e,he=s.filter(y=>K.assignedUserIds?.includes(y.id)),ee=M.filter(y=>y.completed).length;return jsx(It,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:y=>y.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":O,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:xe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Oe,onKeyDown:Ce,children:K.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxs("button",{ref:se,className:"modal-v2-field",onClick:()=>fe(!X),children:[jsxs("div",{className:"modal-v2-field-label",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("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:K.columnId||"No status"})]}),jsx(Gn,{triggerRef:se,isOpen:X,onClose:()=>fe(false),width:250,estimatedHeight:200,children:(h.length>0?h:zh.map(y=>({id:y,title:y}))).map(y=>jsx("button",{className:`modal-v2-popover-item ${K.columnId===y.id?"active":""}`,onClick:()=>Ne(y.id),children:y.title},y.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:ye,className:"modal-v2-field",onClick:()=>ot(!qe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:he.length>0?jsx("div",{className:"modal-v2-avatars",children:he.map(y=>jsx("div",{className:"modal-v2-avatar",style:{background:y.color},title:y.name,children:y.initials},y.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Gn,{triggerRef:ye,isOpen:qe,onClose:()=>ot(false),width:280,estimatedHeight:300,children:s.map(y=>jsxs("button",{className:`modal-v2-popover-item ${K.assignedUserIds?.includes(y.id)?"active":""}`,onClick:()=>it(y.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:y.color},children:y.initials}),y.name,K.assignedUserIds?.includes(y.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},y.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ke(!Fe),children:[jsxs("div",{className:"modal-v2-field-label",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:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:K.priority||"None"})]}),jsxs(Gn,{triggerRef:W,isOpen:Fe,onClose:()=>Ke(false),width:180,estimatedHeight:220,children:[Hh.map(y=>jsx("button",{className:`modal-v2-popover-item priority-${y.toLowerCase()} ${K.priority===y?"active":""}`,onClick:()=>ze(y),children:y},y)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>ze(""),children:"None"})]})]}),w.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(lo,{selectedTags:K.tags||[],availableTags:w,onChange:nt,onCreateTag:f,theme:et[O]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>ut(!ne),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:K.labels&&K.labels.length>0?jsx("span",{children:K.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Gn,{triggerRef:te,isOpen:ne,onClose:()=>ut(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(y=>jsxs("button",{className:`modal-v2-popover-item ${K.labels?.includes(y)?"active":""}`,onClick:()=>st(y),children:[y,K.labels?.includes(y)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},y))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ct(!Me),setTimeout(()=>j.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:K.endDate?new Date(K.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:j,type:"date",value:typeof K.endDate=="string"?K.endDate.split("T")[0]:K.endDate?(()=>{let y=new Date(K.endDate),L=y.getUTCFullYear(),z=String(y.getUTCMonth()+1).padStart(2,"0"),J=String(y.getUTCDate()).padStart(2,"0");return `${L}-${z}-${J}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Tt(!Dt),children:[jsxs("div",{className:"modal-v2-field-label",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 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:K.estimatedTime?`${K.estimatedTime}h`:"Not set"})]}),Dt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:K.estimatedTime||"",onChange:y=>Rt(y.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Tt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsx("h2",{children:"Description"})]}),S?jsx("textarea",{className:"modal-v2-textarea",value:K.description||"",onChange:y=>{if(I){let L={...I,description:y.target.value};G(L);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ce(true),children:K.description?jsx("div",{className:"modal-v2-markdown",children:Ie(K.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),M.length>0&&jsxs("span",{className:"modal-v2-count",children:[ee,"/",M.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>_e(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[M.map(y=>jsxs("div",{className:`modal-v2-subtask ${y.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>dt(y.id),children:y.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:y.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>mt(y.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},y.id)),ke&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:P,onChange:y=>V(y.target.value),onKeyDown:y=>{y.key==="Enter"&&Et(),y.key==="Escape"&&(_e(false),V(""));},onBlur:Et,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||N.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})}),jsx("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(zr,{cardId:K.id,attachments:N,onUpload:E?y=>E(K.id,y):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${$==="all"?"active":""}`,onClick:()=>Z("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${$==="comments"?"active":""}`,onClick:()=>Z("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${$==="history"?"active":""}`,onClick:()=>Z("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Ye,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:y=>Te(y.target.value),onKeyDown:Lt,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:Nt,disabled:!re.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Be.map(y=>{let L=s.find(J=>J.id===y.userId);if(y.type.includes("COMMENT")){let J=n.find(de=>de.id===y.metadata?.commentId);return J?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[L&&jsx("div",{className:"modal-v2-avatar",style:{background:L.color},children:L.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:L?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(y.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:J.content})]})]},y.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[y.type.includes("CREATED")&&"\u2795",y.type.includes("UPDATED")&&"\u270F\uFE0F",y.type.includes("MOVED")&&"\u27A1\uFE0F",y.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",y.type.includes("ASSIGNED")&&"\u{1F464}",y.type.includes("PRIORITY")&&"\u{1F3AF}",y.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:L?.name||"Unknown"})," ",y.type.replace(/_/g," ").toLowerCase(),y.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:y.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(y.timestamp).toLocaleString()})]})]},y.id)}),Be.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function qh({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 Ol({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,p)=>d+p.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(qh,{})}),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}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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((n,d)=>n+d.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((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function oy({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 $l({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,p=s>0?(s-n)/s*100:0,l=n<=d;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?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(oy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var my={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},gp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function gy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),p=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:d,y:p,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=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:[o,"%"]})]})]})}function Hl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,l)=>p+l.value,0),n=e.map(p=>({...p,totalValue:s,color:p.color||my[p.name]||gp[e.indexOf(p)%gp.length]})),d=n.map(p=>p.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?gy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((p,l)=>jsx(Cell,{fill:d[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(fp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,l)=>{let c=l.payload,i=s>0?(c.value/s*100).toFixed(0):"0";return `${p} (${c.value} - ${i}%)`}})]}):jsxs(BarChart$1,{data:n,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(fp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((p,l)=>jsx(Cell,{fill:d[l]},`cell-${l}`))})]})}),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:"#2E94FF"},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((p,l)=>l.value>p.value?l:p).name})]})]})]})}var _s=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=useState(false),[p,l]=useState(false),[c,i]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let h=e.map(v=>v.id),b=v=>{r.onBulkUpdate?.(h,{priority:v}),d(false);},w=v=>{r.onBulkMove?.(h,v),l(false),a();},f=v=>{r.onBulkUpdate?.(h,{assignedUserIds:v}),i(false);},x=v=>{let C=new Set;e.forEach(E=>{E.labels?.forEach(T=>C.add(T));});let N=Array.from(new Set([...C,...v]));r.onBulkUpdate?.(h,{labels:N}),g(false);},k=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(h),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:()=>d(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(v),children:[jsx("span",{className:u("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(v.id),children:v.title},v.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([v.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([v]),children:v},v))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,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"})})]})]})})});_s.displayName="BulkOperationsToolbar";function xy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,p,l;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let h=a?.find(b=>b.id===g);n=`assignee-${g}`,d=h?.name||`User ${g}`,p=h?.color,l=h?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:p,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",p="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:p,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={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];d=m.title,p=m.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,d=g,p="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",p="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:p}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function zl({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),d=useMemo(()=>xy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=useCallback(l=>{n(c=>{let i=new Set(c);return i.has(l)?i.delete(l):i.add(l),i});},[]);return t.groupBy==="none"||d.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[d.map(l=>{let c=s.has(l.id),i=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:i};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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&&p(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(po,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),d.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 Ul=[{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 Wl({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),d=Ul.find(l=>l.value===e)||Ul[0];useEffect(()=>{function l(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!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:d.icon}),jsx("span",{children:d.label}),jsx("svg",{className:u("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:Ul.map(l=>jsxs("button",{onClick:()=>p(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var _n=[{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 ky(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&n&&d&&p}function vp(e={}){let{shortcuts:t=_n,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(p=>{o.current=[...o.current,p];},[]),d=useCallback(p=>{o.current=o.current.filter(l=>l.action!==p);},[]);return useEffect(()=>{function p(l){if(!s.current)return;let c=l.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let i of o.current)if(ky(l,i)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function Ty(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Ny(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 Dy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Ny(e),r=t?Ty(t):"";return a?`${a} + ${r}`:r}function Sy(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 Vl({shortcuts:e=_n,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function d(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Sy(e);return jsxs("div",{className:u("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(n).map(([d,p])=>p.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-blue-500 rounded-full"}),d]}),jsx("div",{className:"space-y-3",children:p.map(l=>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:l.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:Dy(l)})]},l.action))})]},d))})}),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 Gl=[{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
+ `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=h=>{h.stopPropagation();let b=r<a.length-1?r+1:0;l(),o(b);},n.appendChild(i),n.appendChild(m),n.appendChild(g);}n.appendChild(d),n.appendChild(p),document.body.appendChild(n),setTimeout(()=>{p.style.transition="opacity 0.5s ease",p.style.opacity="0";},2e3);}function Ah(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 Lh(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 Al(e){return e.startsWith("image/")}function zr({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=useState(false),[p,l]=useState(false),[c,i]=useState(null),m=useRef(null),g=useRef(e);g.current=e;let h=useCallback((T,B)=>{B.preventDefault(),B.stopPropagation();let O=g.current.filter(S=>Al(S.type)),I=O.findIndex(S=>S.id===T.id),G=S=>{let ce=g.current.filter(q=>Al(q.type)),M=ce[S];M&&sp(M.url,M.name,ce,S,G);};sp(T.url,T.name,O,I,G);},[]),b=useCallback(T=>{let B=[],O=[];return e.length+T.length>s?(O.push(`Maximum ${s} files allowed`),{valid:B,errors:O}):(T.forEach(I=>{if(I.size/1048576>r){O.push(`${I.name} is too large (max ${r}MB)`);return}if(o&&!o.some(S=>I.type.match(S))){O.push(`${I.name} has invalid file type`);return}B.push(I);}),{valid:B,errors:O})},[e.length,s,r,o]),w=useCallback(async T=>{let{valid:B,errors:O}=b(T);if(O.length>0){i(O.join(", ")),setTimeout(()=>i(null),5e3);return}if(B.length!==0){l(true),i(null);try{await t?.(B);}catch(I){i(I instanceof Error?I.message:"Upload failed"),setTimeout(()=>i(null),5e3);}finally{l(false);}}},[b,t]),f=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(true);},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);},[]),k=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),v=useCallback(T=>{T.preventDefault(),T.stopPropagation(),d(false);let B=Array.from(T.dataTransfer.files);w(B);},[w]),C=useCallback(T=>{let B=T.target.files?Array.from(T.target.files):[];w(B),m.current&&(m.current.value="");},[w]),N=useCallback(()=>{m.current?.click();},[]),E=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${p?"uploading":""}`,onDragEnter:f,onDragLeave:x,onDragOver:k,onDrop:v,onClick:N,children:[jsx("input",{ref:m,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:p?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:n?"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"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Al(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:B=>h(T,B),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:Lh(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Ah(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>E(T.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"})})})]},T.id))})]})}function Ll({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:p=[],attachments:l=[],onAddComment:c,onDeleteComment:i,onUploadAttachments:m,onDeleteAttachment:g,onSuggestAssignee:h,onGenerateSubtasks:b,onEstimateEffort:w,currentUserId:f="user-1"}){let[x,k]=useState("details"),[v,C]=useState(false),[N,E]=useState({}),[T,B]=useState(""),[O,I]=useState(false),[G,S]=useState({});if(!t||!e)return null;let ce=useCallback(()=>{C(false),E({}),k("details"),B(""),S({}),a();},[a]),M=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),E({}),C(false));},[e.id,N,r]),q=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ce());},[e.id,o,ce]),ke=useCallback(()=>{c&&T.trim()&&(c(e.id,T.trim()),B(""));},[e.id,T,c]),_e=useCallback(async()=>{if(h){I(true);try{let $=await h(e);S(Z=>({...Z,assignees:$}));}catch($){console.error("Failed to suggest assignee:",$);}finally{I(false);}}},[e,h]),P=useCallback(async()=>{if(b){I(true);try{let $=await b(e);S(Z=>({...Z,subtasks:$}));}catch($){console.error("Failed to generate subtasks:",$);}finally{I(false);}}},[e,b]),V=useCallback(async()=>{if(w){I(true);try{let $=await w(e);S(Z=>({...Z,effort:$}));}catch($){console.error("Failed to estimate effort:",$);}finally{I(false);}}},[e,w]),re={...e,...N},Te=s.filter($=>re.assignedUserIds?.includes($.id));return jsx(It,{children:jsx("div",{className:"card-detail-overlay",onClick:ce,children:jsxs("div",{className:"card-detail-modal",onClick:$=>$.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),v?jsx("input",{type:"text",value:N.title??re.title,onChange:$=>E({...N,title:$.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:re.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[v?jsxs(Fragment,{children:[jsx("button",{onClick:M,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{C(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>C(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:q,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:ce,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",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"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>k("details"),className:`card-detail-tab ${x==="details"?"active":""}`,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 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),"Details"]}),jsxs("button",{onClick:()=>k("comments"),className:`card-detail-tab ${x==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>k("activity"),className:`card-detail-tab ${x==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>k("attachments"),className:`card-detail-tab ${x==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>k("ai"),className:`card-detail-tab ${x==="ai"?"active":""}`,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"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[x==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),v?jsx("textarea",{value:N.description??re.description??"",onChange:$=>E({...N,description:$.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:re.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),v?jsx("select",{multiple:true,value:N.assignedUserIds??re.assignedUserIds??[],onChange:$=>{let Z=Array.from($.target.selectedOptions,X=>X.value);E({...N,assignedUserIds:Z});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map($=>jsx("option",{value:$.id,children:$.name},$.id))}):jsx("div",{className:"card-detail-users",children:Te.length>0?Te.map($=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:$.color},children:$.initials}),jsx("span",{children:$.name})]},$.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),v?jsxs("select",{value:N.priority??re.priority??"",onChange:$=>E({...N,priority:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:re.priority==="URGENT"?"#EF4444":re.priority==="HIGH"?"#F59E0B":re.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:re.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:re.labels&&re.labels.length>0?re.labels.map($=>jsx("span",{className:"card-detail-label-tag",children:$},$)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),v?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:re.startDate?new Date(re.startDate).toISOString().split("T")[0]:"",onChange:$=>E({...N,startDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.startDate?new Date(re.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),v?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:re.endDate?new Date(re.endDate).toISOString().split("T")[0]:"",onChange:$=>E({...N,endDate:$.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:re.endDate?new Date(re.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),v?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??re.estimatedTime??"",onChange:$=>E({...N,estimatedTime:$.target.value?parseFloat($.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:re.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:re.dependencies&&re.dependencies.length>0?re.dependencies.map($=>{let Z=typeof $=="string"?$:$.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",Z.slice(-4)]},Z)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:re.createdAt?new Date(re.createdAt).toLocaleString():"Unknown"})]})]}),x==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:$=>B($.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ke,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map($=>{let Z=s.find(X=>X.id===$.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[Z&&jsx("div",{className:"card-detail-user-avatar",style:{background:Z.color},children:Z.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:Z?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date($.createdAt).toLocaleString()})]})]}),i&&jsx("button",{onClick:()=>i($.id),className:"card-detail-comment-delete",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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:$.content})]},$.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),x==="activity"&&jsx("div",{className:"card-detail-activity",children:d.length>0?jsx("div",{className:"card-detail-activity-list",children:d.map($=>{let Z=s.find(X=>X.id===$.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[$.type.includes("CREATED")&&"\u2795",$.type.includes("UPDATED")&&"\u270F\uFE0F",$.type.includes("MOVED")&&"\u27A1\uFE0F",$.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",$.type.includes("COMMENT")&&"\u{1F4AC}",$.type.includes("ASSIGNED")&&"\u{1F464}",$.type.includes("PRIORITY")&&"\u{1F3AF}",$.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",$.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:Z?.name||"Unknown"})," ",$.type.replace(/_/g," ").toLowerCase(),$.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:$.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date($.timestamp).toLocaleString()})]})]},$.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),x==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(zr,{cardId:e.id,attachments:l,onUpload:m?$=>m(e.id,$):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),x==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:_e,disabled:O||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:P,disabled:O||!b,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:V,disabled:O||!w,className:"card-detail-ai-btn",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 6 12 12 16 14"})]}),"Estimate Effort"]})]}),G.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),G.assignees.map(($,Z)=>{let X=s.find(fe=>fe.id===$.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:X?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:$.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",($.confidence*100).toFixed(0),"%"]})]})]},Z)})]}),G.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),G.subtasks.map(($,Z)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:$.title}),$.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:$.description}),$.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",$.estimatedTime,"h"]})]},Z))]}),G.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[G.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(G.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),p.map($=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${$.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:$.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:$.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:$.description}),$.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",$.suggestedAction]})]},$.id))]}),!G.assignees&&!G.subtasks&&!G.effort&&p.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",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("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function Gn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,p]=useState({top:0,left:0}),l=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let i=e.current.getBoundingClientRect(),m=window.innerHeight,g=window.innerWidth,h=4,b=i.left;b+o>g-10&&(b=g-o-10),b<10&&(b=10);let w=m-i.bottom,f=i.top,x;return w>=s+h?x=i.bottom+h:f>=s+h?x=i.top-s-h:w>=f?x=i.bottom+h:x=Math.max(10,i.top-s-h),{top:x,left:b}},[e,o,s]);return useEffect(()=>{t&&p(c());},[t,c]),useEffect(()=>{if(!t)return;let i=g=>{let h=g.target;l.current&&!l.current.contains(h)&&e.current&&!e.current.contains(h)&&a();},m=setTimeout(()=>{document.addEventListener("mousedown",i);},0);return ()=>{clearTimeout(m),document.removeEventListener("mousedown",i);}},[t,a,e]),useEffect(()=>{if(!t)return;let i=m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a());};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),t?jsx(It,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var et={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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 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)"}};var Uh=["LOW","MEDIUM","HIGH","URGENT"],Wh=["todo","in-progress","review","done"];function Rl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:p,onDeleteComment:l,currentUser:c,onAIGenerateDescription:i,onAICreateSubtasks:m,onAIFindSimilar:g,availableColumns:h=[],availableLabels:b=[],availableTags:w=[],onCreateTag:f,onUploadCoverImage:x,unsplashAccessKey:k,theme:v,onSubtasksChange:C,attachments:N=[],onUploadAttachments:E,onDeleteAttachment:T}){let B=Qo(),O=v||B?.themeName||"dark",[I,G]=useState(e),[S,ce]=useState(false),[M,q]=useState(()=>[...e?.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0))),[ke,_e]=useState(false),[P,V]=useState(""),[re,Te]=useState(""),[$,Z]=useState("all"),[X,fe]=useState(false),[Fe,Ke]=useState(false),[qe,ot]=useState(false),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState(false),xe=useRef(null),rt=useRef(null),Ye=useRef(null),Je=useRef(null),H=useRef(null),le=useRef(null),D=useRef(null),j=useRef(null),se=useRef(null),ye=useRef(null),W=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!I){G({...e});let y=[...e.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0));q(y);}else if(e&&I&&e.id!==I.id){G({...e});let y=[...e.subtasks||[]].sort((L,z)=>(L.position??0)-(z.position??0));q(y);}},[e,I]),useEffect(()=>{let y=L=>{let z=L.target;Je.current&&!Je.current.contains(z)&&fe(false),H.current&&!H.current.contains(z)&&Ke(false),le.current&&!le.current.contains(z)&&ot(false),D.current&&!D.current.contains(z)&&ut(false);};if(X||Fe||qe||ne)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[X,Fe,qe,ne]),useEffect(()=>{if(!t)return;let y=L=>{let z=L.target,J=z.tagName==="INPUT"||z.tagName==="TEXTAREA"||z.isContentEditable;if(L.key==="Escape"){L.preventDefault(),X||Fe||qe||ne||Me||Dt?(fe(false),Ke(false),ot(false),ut(false),ct(false),Tt(false)):J||a();return}if(J&&L.key!=="Escape")return;let de=L.metaKey||L.ctrlKey;switch(L.key.toLowerCase()){case "s":L.preventDefault(),fe(true);break;case "a":L.preventDefault(),ot(true);break;case "p":L.preventDefault(),Ke(true);break;case "l":L.preventDefault(),ut(true);break;case "d":de||(L.preventDefault(),ct(true),setTimeout(()=>j.current?.focus(),0));break;case "e":de||(L.preventDefault(),Tt(true));break;case "i":L.preventDefault(),ce(true),setTimeout(()=>rt.current?.focus(),0);break;case "t":L.preventDefault(),_e(true);break;case "c":L.preventDefault(),Ye.current?.focus();break}};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[t,a,X,Fe,qe,ne,Me,Dt]);let Oe=useCallback(y=>{let L=y.currentTarget.textContent?.trim()||"";if(I&&L!==I.title){let z={...I,title:L};G(z),r?.(I.id,{title:L});}},[I,r]),Ce=useCallback(y=>{y.key==="Enter"&&(y.preventDefault(),y.currentTarget.blur()),y.key==="Escape"&&(y.preventDefault(),y.currentTarget.textContent=I?.title||"",y.currentTarget.blur());},[I]),He=useCallback(()=>{I&&e&&I.description!==e.description&&r?.(I.id,{description:I.description}),ce(false);},[I,e,r]),Ne=useCallback(y=>{if(I){let L={...I,columnId:y};G(L),r?.(I.id,{columnId:y}),fe(false);}},[I,r]),ze=useCallback(y=>{if(I){let L={...I,priority:y};G(L),r?.(I.id,{priority:y}),Ke(false);}},[I,r]),it=useCallback(y=>{if(I){let L=I.assignedUserIds||[],z=L.includes(y)?L.filter(de=>de!==y):[...L,y],J={...I,assignedUserIds:z};G(J),r?.(I.id,{assignedUserIds:z});}},[I,r]),st=useCallback(y=>{if(I){let L=I.labels||[],z=L.includes(y)?L.filter(de=>de!==y):[...L,y],J={...I,labels:z};G(J),r?.(I.id,{labels:z});}},[I,r]),nt=useCallback(y=>{if(I){let L={...I,tags:y};G(L),r?.(I.id,{tags:y});}},[I,r]),pt=useCallback(y=>{if(I){let L=y.target.value,z={...I,endDate:L};G(z),r?.(I.id,{endDate:L}),ct(false);}},[I,r]),Rt=useCallback(y=>{if(I){let L={...I,estimatedTime:parseFloat(y)||0};G(L),r?.(I.id,{estimatedTime:parseFloat(y)||0});}},[I,r]),Et=useCallback(()=>{if(P.trim()&&I){let y={id:`subtask-${Date.now()}`,title:P.trim(),completed:false,position:M.length,createdAt:new Date},L=[...M,y];q(L),V(""),_e(false),C?.(I.id,L);}},[P,M,I,C]),dt=useCallback(y=>{let L=M.map(z=>z.id===y?{...z,completed:!z.completed,updatedAt:new Date}:z);q(L),I&&C?.(I.id,L);},[M,I,C]),mt=useCallback(y=>{let L=M.filter(z=>z.id!==y);q(L),I&&C?.(I.id,L);},[M,I,C]),Nt=useCallback(()=>{re.trim()&&I&&p&&(p(I.id,re.trim()),Te(""));},[re,I,p]),Lt=useCallback(y=>{(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&(y.preventDefault(),Nt());},[Nt]),Ie=y=>jsx($h,{remarkPlugins:[Hh],rehypePlugins:[zh],components:{a:({node:L,...z})=>jsx("a",{...z,target:"_blank",rel:"noopener noreferrer"})},children:y}),Be=d.filter(y=>$==="comments"?y.type.includes("COMMENT"):$==="history"?!y.type.includes("COMMENT"):true);if(!t||!e)return null;let K=I||e,he=s.filter(y=>K.assignedUserIds?.includes(y.id)),ee=M.filter(y=>y.completed).length;return jsx(It,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:y=>y.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":O,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:xe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Oe,onKeyDown:Ce,children:K.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",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"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxs("button",{ref:se,className:"modal-v2-field",onClick:()=>fe(!X),children:[jsxs("div",{className:"modal-v2-field-label",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("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:K.columnId||"No status"})]}),jsx(Gn,{triggerRef:se,isOpen:X,onClose:()=>fe(false),width:250,estimatedHeight:200,children:(h.length>0?h:Wh.map(y=>({id:y,title:y}))).map(y=>jsx("button",{className:`modal-v2-popover-item ${K.columnId===y.id?"active":""}`,onClick:()=>Ne(y.id),children:y.title},y.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:ye,className:"modal-v2-field",onClick:()=>ot(!qe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:he.length>0?jsx("div",{className:"modal-v2-avatars",children:he.map(y=>jsx("div",{className:"modal-v2-avatar",style:{background:y.color},title:y.name,children:y.initials},y.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Gn,{triggerRef:ye,isOpen:qe,onClose:()=>ot(false),width:280,estimatedHeight:300,children:s.map(y=>jsxs("button",{className:`modal-v2-popover-item ${K.assignedUserIds?.includes(y.id)?"active":""}`,onClick:()=>it(y.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:y.color},children:y.initials}),y.name,K.assignedUserIds?.includes(y.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},y.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>Ke(!Fe),children:[jsxs("div",{className:"modal-v2-field-label",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:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:K.priority||"None"})]}),jsxs(Gn,{triggerRef:W,isOpen:Fe,onClose:()=>Ke(false),width:180,estimatedHeight:220,children:[Uh.map(y=>jsx("button",{className:`modal-v2-popover-item priority-${y.toLowerCase()} ${K.priority===y?"active":""}`,onClick:()=>ze(y),children:y},y)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>ze(""),children:"None"})]})]}),w.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(lo,{selectedTags:K.tags||[],availableTags:w,onChange:nt,onCreateTag:f,theme:et[O]||et.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>ut(!ne),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",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 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:K.labels&&K.labels.length>0?jsx("span",{children:K.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Gn,{triggerRef:te,isOpen:ne,onClose:()=>ut(false),width:220,estimatedHeight:200,children:(b.length>0?b:["Bug","Feature","Enhancement","Documentation"]).map(y=>jsxs("button",{className:`modal-v2-popover-item ${K.labels?.includes(y)?"active":""}`,onClick:()=>st(y),children:[y,K.labels?.includes(y)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},y))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ct(!Me),setTimeout(()=>j.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:K.endDate?new Date(K.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:j,type:"date",value:typeof K.endDate=="string"?K.endDate.split("T")[0]:K.endDate?(()=>{let y=new Date(K.endDate),L=y.getUTCFullYear(),z=String(y.getUTCMonth()+1).padStart(2,"0"),J=String(y.getUTCDate()).padStart(2,"0");return `${L}-${z}-${J}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Tt(!Dt),children:[jsxs("div",{className:"modal-v2-field-label",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 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:K.estimatedTime?`${K.estimatedTime}h`:"Not set"})]}),Dt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:K.estimatedTime||"",onChange:y=>Rt(y.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Tt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-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"})]}),jsx("h2",{children:"Description"})]}),S?jsx("textarea",{className:"modal-v2-textarea",value:K.description||"",onChange:y=>{if(I){let L={...I,description:y.target.value};G(L);}},onBlur:He,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ce(true),children:K.description?jsx("div",{className:"modal-v2-markdown",children:Ie(K.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),M.length>0&&jsxs("span",{className:"modal-v2-count",children:[ee,"/",M.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>_e(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[M.map(y=>jsxs("div",{className:`modal-v2-subtask ${y.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>dt(y.id),children:y.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:y.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>mt(y.id),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 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},y.id)),ke&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:P,onChange:y=>V(y.target.value),onKeyDown:y=>{y.key==="Enter"&&Et(),y.key==="Escape"&&(_e(false),V(""));},onBlur:Et,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(E||N.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})}),jsx("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(zr,{cardId:K.id,attachments:N,onUpload:E?y=>E(K.id,y):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${$==="all"?"active":""}`,onClick:()=>Z("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${$==="comments"?"active":""}`,onClick:()=>Z("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${$==="history"?"active":""}`,onClick:()=>Z("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Ye,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:re,onChange:y=>Te(y.target.value),onKeyDown:Lt,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",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"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",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:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",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("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:Nt,disabled:!re.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Be.map(y=>{let L=s.find(J=>J.id===y.userId);if(y.type.includes("COMMENT")){let J=n.find(de=>de.id===y.metadata?.commentId);return J?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[L&&jsx("div",{className:"modal-v2-avatar",style:{background:L.color},children:L.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:L?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(y.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:J.content})]})]},y.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[y.type.includes("CREATED")&&"\u2795",y.type.includes("UPDATED")&&"\u270F\uFE0F",y.type.includes("MOVED")&&"\u27A1\uFE0F",y.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",y.type.includes("ASSIGNED")&&"\u{1F464}",y.type.includes("PRIORITY")&&"\u{1F3AF}",y.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:L?.name||"Unknown"})," ",y.type.replace(/_/g," ").toLowerCase(),y.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:y.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(y.timestamp).toLocaleString()})]})]},y.id)}),Be.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Jh({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 $l({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((d,p)=>d+p.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(Jh,{})}),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}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",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((n,d)=>n+d.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((n,d)=>n+d.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function sy({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 Hl({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,d=e[e.length-1]?.ideal||0,p=s>0?(s-n)/s*100:0,l=n<=d;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?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(sy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?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:l?"#10B981":"#EF4444",fill:l?"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:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#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:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var fy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function by({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),p=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:d,y:p,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function bp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=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:[o,"%"]})]})]})}function zl({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,l)=>p+l.value,0),n=e.map(p=>({...p,totalValue:s,color:p.color||fy[p.name]||fp[e.indexOf(p)%fp.length]})),d=n.map(p=>p.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?by:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((p,l)=>jsx(Cell,{fill:d[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(bp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,l)=>{let c=l.payload,i=s>0?(c.value/s*100).toFixed(0):"0";return `${p} (${c.value} - ${i}%)`}})]}):jsxs(BarChart$1,{data:n,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(bp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((p,l)=>jsx(Cell,{fill:d[l]},`cell-${l}`))})]})}),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:"#2E94FF"},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((p,l)=>l.value>p.value?l:p).name})]})]})]})}var js=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=useState(false),[p,l]=useState(false),[c,i]=useState(false),[m,g]=useState(false);if(e.length===0)return null;let h=e.map(v=>v.id),b=v=>{r.onBulkUpdate?.(h,{priority:v}),d(false);},w=v=>{r.onBulkMove?.(h,v),l(false),a();},f=v=>{r.onBulkUpdate?.(h,{assignedUserIds:v}),i(false);},x=v=>{let C=new Set;e.forEach(E=>{E.labels?.forEach(T=>C.add(T));});let N=Array.from(new Set([...C,...v]));r.onBulkUpdate?.(h,{labels:N}),g(false);},k=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(h),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:()=>d(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(v=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(v),children:[jsx("span",{className:u("asakaa-priority-dot",v==="LOW"&&"bg-asakaa-priority-low",v==="MEDIUM"&&"bg-asakaa-priority-medium",v==="HIGH"&&"bg-asakaa-priority-high",v==="URGENT"&&"bg-asakaa-priority-urgent")}),v]},v))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!p),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(v=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(v.id),children:v.title},v.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(v=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([v.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:v.color},children:v.initials}),v.name]},v.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!m),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(v=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([v]),children:v},v))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:k,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"})})]})]})})});js.displayName="BulkOperationsToolbar";function wy(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,p,l;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(g=>{let h=a?.find(b=>b.id===g);n=`assignee-${g}`,d=h?.name||`User ${g}`,p=h?.color,l=h?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:p,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",p="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:p,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let m={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];d=m.title,p=m.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,d=g,p="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:g,cardIds:[],color:p}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",p="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:p}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ul({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),d=useMemo(()=>wy(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=useCallback(l=>{n(c=>{let i=new Set(c);return i.has(l)?i.delete(l):i.add(l),i});},[]);return t.groupBy==="none"||d.length===0?jsx(po,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[d.map(l=>{let c=s.has(l.id),i=e.cards.filter(g=>l.cardIds.includes(g.id)),m={...e,cards:i};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[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&&p(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(po,{board:m,callbacks:r,availableUsers:a})})]},l.id)}),d.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 Wl=[{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 Vl({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),d=Wl.find(l=>l.value===e)||Wl[0];useEffect(()=>{function l(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let p=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!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:d.icon}),jsx("span",{children:d.label}),jsx("svg",{className:u("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:Wl.map(l=>jsxs("button",{onClick:()=>p(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.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:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var _n=[{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 Ty(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,d=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&n&&d&&p}function wp(e={}){let{shortcuts:t=_n,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(p=>{o.current=[...o.current,p];},[]),d=useCallback(p=>{o.current=o.current.filter(l=>l.action!==p);},[]);return useEffect(()=>{function p(l){if(!s.current)return;let c=l.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let i of o.current)if(Ty(l,i)){r&&l.preventDefault();let m=new CustomEvent("keyboard-action",{detail:i.action,bubbles:true,cancelable:true});window.dispatchEvent(m);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function Dy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Sy(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 Ey(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Sy(e),r=t?Dy(t):"";return a?`${a} + ${r}`:r}function Fy(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 Gl({shortcuts:e=_n,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function d(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Fy(e);return jsxs("div",{className:u("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(n).map(([d,p])=>p.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-blue-500 rounded-full"}),d]}),jsx("div",{className:"space-y-3",children:p.map(l=>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:l.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:Ey(l)})]},l.action))})]},d))})}),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 _l=[{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,12 +122,12 @@ 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 _l({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let d=l=>{t(l),o(false);},p=e.reduce((l,c)=>{let i=c.category||"Other";return l[i]||(l[i]=[]),l[i].push(c),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:u("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(p).map(([l,c])=>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:l})}),jsx("div",{children:c.map(i=>jsxs("button",{onClick:()=>d(i),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:i.name}),i.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.id))})]},l)),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 Kl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[p,l]=useState("json"),[c,i]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,w=await _c(e,p,b);jc(w,p);},h=async b=>{let w=b.target.files?.[0];if(w){try{let f=await qc(w),x=w.name.endsWith(".json")?"json":"csv",k=Yc(f,x);i(k),k.success&&r&&r(k,f);}catch(f){i({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:u("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:()=>d("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>d("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="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(b=>jsxs("button",{onClick:()=>l(b),className:u("p-4 rounded-lg border-2 transition-all text-center",p===b?"border-blue-500 bg-blue-500/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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="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:m,type:"file",accept:".json,.csv",onChange:h,className:"hidden"}),jsxs("button",{onClick:()=>m.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"})]})]}),c&&jsxs("div",{className:u("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((b,w)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},w))})]})]})]})]})]})}var Ay=["URGENT","HIGH","MEDIUM","LOW"],Ly=[{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"}],Iy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Yl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:p=[],availableLabels:l=[],availableColumns:c=[],showQuickFilters:i=true,compact:m=false,groupBy:g="none",onGroupByChange:h}){let[b,w]=useState(true),f=useCallback(N=>{a({search:N.target.value});},[a]),x=useCallback(N=>{a({dateFilter:N.target.value});},[a]),k=useCallback(N=>{r({by:N.target.value});},[r]),v=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>w(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"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"}),C&&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)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[i&&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"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,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:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:x,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:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Ay.map(N=>jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(N=>jsx("option",{value:N,children:N},N))]})}),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:k,className:"filter-bar__select filter-bar__select--sm",children:Ly.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),h&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:N=>h(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Iy.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),C&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ql({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:p}){let[l,c]=useState(false),i=useRef(null);useEffect(()=>{let g=h=>{i.current&&!i.current.contains(h.target)&&c(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),c(false);};return jsxs("div",{className:u("relative",r),ref:i,children:[jsxs("button",{onClick:()=>c(!l),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&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:[o==="kanban"?jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(async()=>await n?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(async()=>await d?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(()=>p?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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 Xl={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:"#2E94FF",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"}},Jl={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:"#2E94FF",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"}},Ql={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"}},Bo={dark:Xl,light:Jl,neutral:Ql},Ks="dark";var Ys=createContext(void 0),Gy="asakaa-theme";function Cp({children:e,defaultTheme:t=Ks,storageKey:a=Gy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,p=Bo[r];Object.entries(p.colors).forEach(([c,i])=>{i&&d.style.setProperty(`--theme-${_y(c)}`,i);}),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(([c,i])=>{let m=p.colors[c];m&&d.style.setProperty(i,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Bo};return jsx(Ys.Provider,{value:n,children:e})}function dn(){let e=useContext(Ys);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function _y(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=dn();return e?jsxs("div",{className:u("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(Bo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/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:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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}function Tp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing),...et[e].dotGrid&&{dotGrid:et[e].dotGrid},...et[e].glassHeader&&{glassHeader:et[e].glassHeader},...et[e].glassToolbar&&{glassToolbar:et[e].glassToolbar},...et[e].forecastHud&&{forecastHud:et[e].forecastHud},...et[e].neonRedGlow&&{neonRedGlow:et[e].neonRedGlow},...et[e].executionBarBg&&{executionBarBg:et[e].executionBarBg}}}var qs={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"}},Np={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"}},ed={en:qs,es:Np};function Dp(e){return ed[e]||ed.en}function td(e,t){let a=Dp(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 un=createContext(qs);function Er(){return useContext(un)}function Qs(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,p;a==="right"?p=n.right-r:p=n.left;let l=8;p+r>window.innerWidth-l&&(p=window.innerWidth-l-r),p<l&&(p=l),s({top:d,left:p});},[t,a,e,r]),o}function Ep({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[p,l]=useState(null),[c,i]=useState(false),m=useRef(null),g=useRef(null),h=Er(),b=Qs(m,n,"right",224),w=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=h.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let C=N=>{let E=N.target;m.current&&!m.current.contains(E)&&g.current&&!g.current.contains(E)&&d(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let x=[{id:"png",label:h.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:h.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:h.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:h.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),k=async(C,N)=>{if(N){l(C);try{await N();}catch(E){console.error(`Export ${C} failed:`,E);}finally{l(null),d(false);}}},v=()=>{s?.(),i(true),setTimeout(()=>i(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,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:b.top,left:b.left,zIndex:99999,backgroundColor:w?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${w?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:w?"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:[x.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:w?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:x.map((C,N)=>jsxs(motion.button,{onClick:()=>k(C.id,C.handler),disabled:p!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:w?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:N*.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:p===C.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"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),x.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:w?"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:w?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:v,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:w?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:c?"rgba(34,197,94,0.15)":e.accentLight,color:c?"#22C55E":e.accent},children:c?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:c?h.toolbar.copied:h.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function hx({options:e,value:t,onChange:a,theme:r,layoutId:o="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 n=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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,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:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function yx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.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:o.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}})]},o.value)})})}function Fp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),p=Er(),l=Qs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let h=g.target;n.current&&!n.current.contains(h)&&d.current&&!d.current.contains(h)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let c=[{value:"all",label:p.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],i=t==="all"?p.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${p.toolbar.wbsLevel||"Level"}: ${i}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:i})]}),createPortal(jsx(AnimatePresence,{children:o&&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-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.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:c.map((m,g)=>{let h=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:h?e.accentLight:"transparent",borderBottom:g<c.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:h?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:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:h?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:h?600:500},children:m.label}),h&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Pp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),p=useRef(null),l=Er(),c=Qs(d,s,"left");useEffect(()=>{if(!s)return;let h=setTimeout(()=>{let b=f=>{let x=f.target;d.current&&!d.current.contains(x)&&p.current&&!p.current.contains(x)&&n(false);},w=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",w),p._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(h),p._cleanup&&p._cleanup();}},[s]);let i=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:h=>{h.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":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:l.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:p,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:c.top,left:c.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:i.map(h=>{let b=t===h.value&&!r,w=()=>h.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):h.icon;return jsxs(motion.button,{onClick:()=>{a(h.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?h.color:"text-gray-400"} flex-shrink-0`,children:w()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:h.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},h.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function xx({value:e,onChange:t,theme:a}){let r=Er(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function vx({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,p=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},l=t?.confidencePercent,c=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,i=t?.costAtCompletion,m=t?.currency||"$",g=i!=null?i>=1e6?`${m}${(i/1e6).toFixed(2)}M`:i>=1e3?`${m}${(i/1e3).toFixed(1)}K`:`${m}${i.toFixed(0)}`:"\u2014",h=t?.budgetVariancePercent,b=h!=null&&h!==0,w=h!=null?h>0?`+${h.toFixed(0)}% ${a.toolbar.budgetOver}`:`${h.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=h!=null&&h>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:h!=null&&h<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,": ",o]}),n&&d&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:p.bg,color:p.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),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:c,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.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:g}),b&&w&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:w})]})]})]})}function wx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:p,rowDensity:l,onRowDensityChange:c}){let[i,m]=useState(false),g=useRef(null),h=useRef(null),b=Er(),w=Qs(g,i,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!i)return;let v=C=>{let N=C.target;g.current&&!g.current.contains(N)&&h.current&&!h.current.contains(N)&&m(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);let x=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:p}],k=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!i),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:i?e.accent:e.textTertiary,backgroundColor:i?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:h,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:w.top,left:w.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:x.map((v,C)=>{let N=v.icon;return jsxs(motion.button,{onClick:()=>v.onChange?.(!v.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:v.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:v.label}),v.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},v.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((v,C)=>{let N=l===v.value;return jsxs(motion.button,{onClick:()=>c(v.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+C)*.03},children:[jsx("span",{style:{color:N?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:v.label}),N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},v.value)})]})]})}),document.body)]})}function Zs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:p,showThemeSelector:l=false,showCreateTaskButton:c=false,createTaskLabel:i,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:h,hideCompleted:b=false,onHideCompletedChange:w,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:v=4,viewMode:C="execution",onViewModeChange:N,projectForecast:E,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportCSV:I,onExportJSON:G,onExportMSProject:S,showCriticalPath:ce=true,onShowCriticalPathChange:M,showDependencies:q=true,onShowDependenciesChange:ke,highlightWeekends:_e=true,onHighlightWeekendsChange:P,showBaseline:V=false,onShowBaselineChange:re,onCopySnapshotLink:Te}){let $=Er(),Z=T||B||O||I||G||S,X=!!e.glassToolbar,[fe,Fe]=useState(false),Ke=useRef(null);useEffect(()=>{fe&&Ke.current&&Ke.current.focus();},[fe]);let qe=[{value:"day",label:$.toolbar.day},{value:"week",label:$.toolbar.week},{value:"month",label:$.toolbar.month}],ot=[{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"})}],ne=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(X){let ut=ne?"rgba(255,255,255,0.08)":e.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:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:ne?"#1A1A1A":e.bgSecondary,border:`1px solid ${ne?"rgba(255,255,255,0.08)":e.border}`},animate:{width:fe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Fe(!fe),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),fe&&jsx("input",{ref:Ke,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Fe(false),onKeyDown:Me=>{Me.key==="Escape"&&Fe(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),N&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ne?"#000000":e.bgSecondary,border:`1px solid ${ne?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>N("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?ne?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:$.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>N("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?ne?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:$.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(xx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),k&&jsx(Fp,{theme:e,value:x??"all",onChange:k,maxDepth:v}),h&&jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:b,onHideCompletedChange:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),jsx(wx,{theme:e,showCriticalPath:ce,onShowCriticalPathChange:M,showBaseline:V,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:P,showDependencies:q,onShowDependenciesChange:ke,rowDensity:d,onRowDensityChange:p}),jsx(Ep,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportMSProject:S,onCopySnapshotLink:Te}),c&&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, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ne?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ne?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:i||$.toolbar.createTask})]})]})]}),E&&jsx(vx,{theme:e,forecast:E})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(yx,{options:qe,value:t,onChange:ut=>a(ut),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.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:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.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:e.borderLight}}),k&&jsx(Fp,{theme:e,value:x??"all",onChange:k,maxDepth:v}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Pp,{theme:e,value:g,onChange:h,hideCompleted:b,onHideCompletedChange:w})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),c&&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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:i||$.toolbar.createTask})]}),(Z||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Ep,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportMSProject:S,onCopySnapshotLink:Te}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(hx,{options:ot,value:s,onChange:ut=>n(ut),theme:e})]})]})}function ei({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let c=i=>{d.current&&!d.current.contains(i.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let l=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let c=p.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!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(It,{children:jsx(motion.div,{ref:d,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"}),l.map(c=>jsxs("button",{onClick:()=>{t(c.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:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function gn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,i=r.length*36+8,m=8,g=window.innerWidth,h=window.innerHeight,b=t,w=a;t+c+m>g&&(b=t-c,b<m&&(b=m)),a+i+m>h&&(w=h-i-m,w<m&&(w=m)),p({x:b,y:w});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=m=>{n.current&&!n.current.contains(m.target)&&o();},i=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",i);}},[e,o]),!e)return null;let l=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:n,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:`${d.x}px`,top:`${d.y}px`,backgroundColor:l(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(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:i=>{c.disabled||(i.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var jt={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 $p({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:p,onTaskRename:l,onTaskToggleExpand:c,onOpenTaskModal:i,enableKeyboard:m=true}){let g=useRef(false),h=useCallback(k=>{g.current=k;},[]),b=useCallback(k=>{let v=[],C=N=>{for(let E of N)v.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&C(E.subtasks);};return C(k),v},[]),w=useCallback(()=>{let k=b(e);for(let v of k)if(t.has(v.id))return v;return null},[e,t,b]),f=useCallback((k,v)=>{let C=b(e);if(C.length===0)return;let N=w();if(!N){a(C[0].id,false);return}let E=C.findIndex(O=>O.id===N.id);if(E===-1)return;let T=k==="up"?E-1:E+1;if(T<0||T>=C.length)return;let B=C[T];a(B.id,v);},[e,w,b,a]),x=useCallback(k=>{if(!m)return;let v=k.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){k.key==="Escape"&&(v.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,T=Array.from(t),B=w();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(B&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!B.isExpanded||k.key==="ArrowLeft"&&B.isExpanded)&&c(B.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){T.length>0&&(k.preventDefault(),n(T,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){T.length>0&&(k.preventDefault(),d(T));return}if(k.key==="Tab"&&k.shiftKey){T.length>0&&(k.preventDefault(),p(T));return}if(k.key==="Enter"&&!k.shiftKey&&!E){B&&(k.preventDefault(),r(B.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!E){B&&(k.preventDefault(),r(B.id,"above"));return}if(k.key==="Enter"&&E){B&&(k.preventDefault(),i(B.id));return}if(k.key==="F2"){B&&(k.preventDefault(),l(B.id));return}if(k.key==="Delete"||k.key==="Backspace"&&E){T.length>0&&(k.preventDefault(),o(T));return}if(k.key==="d"&&E&&!k.shiftKey){T.length>0&&(k.preventDefault(),s(T));return}},[m,t,w,f,r,o,s,n,d,p,l,c,i]);return useEffect(()=>{if(m)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[m,x]),{setIsEditing:h}}function zp(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(i=>{t(new Set([i])),r(i);},[]),s=useCallback(i=>{t(m=>{let g=new Set(m);return g.has(i)?g.delete(i):g.add(i),g}),r(i);},[]),n=useCallback((i,m)=>{if(!a){o(i);return}let g=m.indexOf(a),h=m.indexOf(i);if(g===-1||h===-1){o(i);return}let b=Math.min(g,h),w=Math.max(g,h),f=m.slice(b,w+1);t(new Set(f)),r(i);},[a,o]),d=useCallback((i,m,g,h)=>{h?n(i,m):g?s(i):o(i);},[o,s,n]),p=useCallback((i,m)=>{m?t(g=>{let h=new Set(g);return h.add(i),h}):o(i);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:p,clearSelection:l,isTaskSelected:c}}function od(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?od(t.subtasks):t.subtasks}))}function fn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,p)=>(d.position??0)-(p.position??0));for(let d=0;d<n.length;d++){let p={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ti(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ti(a.subtasks,t);if(r)return r}}return null}function rd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=rd(a.subtasks,t);if(r)return r}return null}function nd(e,t){if(t.length===0)return e;let a=fn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let h=[];return {tasks:m.filter(w=>{if(g.has(w.id))return h.push(w),false;if(w.subtasks){let f=n(w.subtasks,g);w.subtasks=f.tasks,h.push(...f.removed);}return true}),removed:h}},d=(m,g,h)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...h],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,h)}:b),p=new Set(t),{tasks:l,removed:c}=n(e,p),i=d(l,s.id,c);return od(i)}function sd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=rd(a,r);if(!o)continue;let s=rd(a,o.id),n=(l,c,i)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===c&&g.subtasks){let h=g.subtasks.findIndex(b=>b.id===i);if(h!==-1){let[b]=g.subtasks.splice(h,1);return b}}if(g.subtasks){let h=n(g.subtasks,c,i);if(h)return h}}return null},d=(l,c,i)=>{let m=l.findIndex(g=>g.id===c);if(m!==-1)return l.splice(m+1,0,i),l;for(let g of l)g.subtasks&&d(g.subtasks,c,i);return l},p=n(a,o.id,r);p&&(s&&s.subtasks?d(s.subtasks,o.id,p):d(a,o.id,p));}return od(a)}function id(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,p)=>{let l=n.findIndex(i=>i.id===d);if(l===-1){for(let i of n)if(i.subtasks&&s(i.subtasks,d,p))return true;return false}let c=p==="up"?l-1:l+1;return c<0||c>=n.length?false:([n[l],n[c]]=[n[c],n[l]],n[l]={...n[l],position:l},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function ld(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Kn(e,t){let a=[...e],r=[];for(let o of t){let s=(p,l)=>p.map((c,i)=>({...c,id:`${c.id}-copy-${Date.now()}-${i}`,parentId:l,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${i}`):void 0})),n=p=>{let l=p.findIndex(g=>g.id===o);if(l===-1){for(let g of p)if(g.subtasks){let h=n(g.subtasks);if(h)return h}return null}let c=p[l],i=`${c.id}-copy-${Date.now()}`,m={...c,id:i,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,i):void 0};return p.splice(l+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function Up(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},d=p=>{let l=p.findIndex(i=>i.id===t);if(l===-1){for(let i of p)if(i.subtasks&&d(i.subtasks))return true;return false}let c=a==="above"?l:l+1;return p.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function dd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:dd(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 ud(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let h=a(g.subtasks);if(h)return h}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,p=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let h=p(g.subtasks);if(h>=0)return h}}return 0},l=p(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:l,parentId:t},i=m=>m.map(g=>{if(g.id===t){let h=g.subtasks||[];return {...g,subtasks:[...h,c],isExpanded:true}}return g.subtasks?{...g,subtasks:i(g.subtasks)}:g});return {tasks:i(e),newTask:c}}function Wp(e,t,a,r){if(t===a)return e;let o=ti(e,t);if(!o)return e;if(a){let d=(p,l)=>{if(!p.subtasks)return false;for(let c of p.subtasks)if(c.id===l||d(c,l))return true;return false};if(d(o,a))return e}let s=d=>{let p=d.filter(c=>c.id!==t),l=p.length<d.length;return p.map((c,i)=>{let m=l?{...c,position:i}:c;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((p,l)=>({...p,position:l}));}else {let d=p=>p.map(l=>{if(l.id===a){let c=l.subtasks||[],i=r!==void 0?r:c.length,m=[...c];m.splice(i,0,{...o,parentId:a});let g=m.map((h,b)=>({...h,position:b}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:d(l.subtasks)}:l});n=d(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((d,p)=>(p.startDate&&d.starts.push(new Date(p.startDate).getTime()),p.endDate&&d.ends.push(new Date(p.endDate).getTime()),d.progresses.push(p.progress??0),d),{starts:[],ends:[],progresses:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,p)=>d+p,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function ri({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:p,scrollTop:l,columns:c,onToggleColumn:i,onColumnResize:m,onTaskUpdate:g,onTaskIndent:h,onTaskOutdent:b,onTaskMove:w,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:v,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:T,scrollContainerRef:B}){let O=useContext(un),[I,G]=useState(null),[S,ce]=useState(null),[M,q]=useState(""),ke=useRef(null),[_e,P]=useState(null),[V,re]=useState(0),[Te,$]=useState(0),[Z,X]=useState({isOpen:false,x:0,y:0,type:"header"}),[fe,Fe]=useState(null),[Ke,qe]=useState(null),[ot,ne]=useState(null),ut=useRef(0),Me=5,ct=useRef(false),[Dt,Tt]=useState(null),[xe,rt]=useState(false),Ye=useRef(null),[Je,H]=useState(null),[le,D]=useState(false),j=useRef(null);useEffect(()=>{function K(he){j.current&&!j.current.contains(he.target)&&D(false);}if(le)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[le]),useEffect(()=>{S&&ke.current&&(ke.current.focus(),ke.current.select());},[S]),useEffect(()=>{if(!_e)return;let K=ee=>{let y=ee.clientX-V,L=Te+y;m?.(_e,L);},he=()=>{P(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",he),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",he),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,V,Te,m]);let{selectedTaskIds:se,handleTaskClick:ye,isTaskSelected:W}=zp(),{setIsEditing:te}=$p({tasks:e,selectedTaskIds:se,onTaskSelect:(K,he)=>{let y=fn(e).map(L=>L.id);ye(K,y,he||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:w||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:K=>{let he=fn(e).find(ee=>ee.id===K);he&&it(he);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:K=>{let he=fn(e).find(ee=>ee.id===K);he&&N&&N(he);},enableKeyboard:true}),Oe=(K,he=0,ee="")=>{let y=[],L=[...K].sort((z,J)=>(z.position??0)-(J.position??0));for(let z=0;z<L.length;z++){let J=L[z],de=z+1,ge=ee?`${ee}.${de}`:`${de}.0`;if(J.wbsCode=ge,y.push({task:J,level:he}),J.subtasks&&J.subtasks.length>0&&J.isExpanded){let Y=ee?`${ee}.${de}`:`${de}`;y.push(...Oe(J.subtasks,he+1,Y));}}return y},Ce=Oe(e),He=48,Ne=Math.max(Ce.length*a,600-He),ze=K=>!K.startDate||!K.endDate?"-":`${Math.ceil((K.endDate.getTime()-K.startDate.getTime())/(1e3*60*60*24))}d`,it=K=>{ce(K.id),q(K.name),te(true);},st=K=>{M.trim()&&M!==e.find(he=>he.id===K)?.name&&v?.(K,M.trim()),ce(null),q(""),te(false);},nt=()=>{ce(null),q(""),te(false);},pt=(K,he)=>{he.stopPropagation(),C?.(K.id);},Rt=(K,he)=>{he.preventDefault(),ut.current=he.clientY,Fe(K),ct.current=false,rt(false),Tt({x:he.clientX,y:he.clientY});},Et=K=>{if(!fe||(Math.abs(K.clientY-ut.current)>Me&&!ct.current&&(ct.current=true,rt(true)),Tt({x:K.clientX,y:K.clientY}),!ct.current))return;if(B?.current){let z=B.current,J=z.getBoundingClientRect(),de=60,ge=12;Ye.current&&(cancelAnimationFrame(Ye.current),Ye.current=null);let Y=K.clientY-J.top,Re=J.bottom-K.clientY;if(Y<de&&z.scrollTop>0){let je=Math.round(ge*(1-Y/de)),gt=()=>{z.scrollTop-=je,ct.current&&z.scrollTop>0&&(Ye.current=requestAnimationFrame(gt));};Ye.current=requestAnimationFrame(gt);}else if(Re<de&&z.scrollTop<z.scrollHeight-z.clientHeight){let je=Math.round(ge*(1-Re/de)),gt=()=>{z.scrollTop+=je,ct.current&&z.scrollTop<z.scrollHeight-z.clientHeight&&(Ye.current=requestAnimationFrame(gt));};Ye.current=requestAnimationFrame(gt);}}let ee=document.querySelectorAll("[data-task-row]"),y=null,L=null;ee.forEach(z=>{let J=z.getBoundingClientRect(),de=z.getAttribute("data-task-row");if(de&&de!==fe&&K.clientY>=J.top&&K.clientY<=J.bottom){y=de;let ge=K.clientY-J.top,Y=J.height;ge<Y*.25?L="above":ge>Y*.75?L="below":L="child";}}),qe(y),ne(L);},dt=()=>{if(ct.current&&fe&&Ke&&ot){if(ot==="child")T?.(fe,Ke);else if(ot==="above"||ot==="below"){let K=(L,z,J=null)=>{for(let de of L){if(de.id===z)return J;if(de.subtasks){let ge=K(de.subtasks,z,de.id);if(ge!==void 0)return ge}}},he=K(e,fe,null),ee=K(e,Ke,null),y=(L,z,J,de)=>{let ge=L.findIndex(je=>je.id===z),Y=de?L.findIndex(je=>je.id===J):-1,Re=ot==="below"?ge+1:ge;return de&&Y!==-1&&Y<ge&&(Re-=1),Math.max(0,Re)};if(ee===null){let z=y(e,Ke,fe,he===null);T?.(fe,null,z);}else {let L=Ce.find(z=>z.task.id===ee)?.task;if(L?.subtasks){let z=he===ee,J=y(L.subtasks,Ke,fe,z);T?.(fe,ee,J);}}}}Ye.current&&(cancelAnimationFrame(Ye.current),Ye.current=null),Fe(null),qe(null),ne(null),Tt(null),ct.current=false,rt(false);};useEffect(()=>{if(fe)return document.addEventListener("mousemove",Et),document.addEventListener("mouseup",dt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Et),document.removeEventListener("mouseup",dt),document.body.style.cursor="",document.body.style.userSelect="";}},[fe,Ke,ot]);let mt=(K,he,ee)=>{let y=he.subtasks&&he.subtasks.length>0;switch(K.id){case "name":let L=S===he.id,z=I===he.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ee*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:z?1:.3},onMouseDown:Se=>Rt(he.id,Se),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),he.subtasks&&he.subtasks.length>0?jsx("button",{onClick:Se=>{Se.stopPropagation(),p?.(he.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:he.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"}),L?jsx("input",{ref:ke,type:"text",value:M,onChange:Se=>q(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"?st(he.id):Se.key==="Escape"&&nt();},onBlur:()=>st(he.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:Se=>Se.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:he.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he.parentId?"13px":"14px",fontWeight:he.isMilestone?600:he.parentId?400:600,letterSpacing:he.parentId?"0":"-0.01em"},title:he.name,children:[he.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:he.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]}),z&&!L&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Se=>Se.stopPropagation(),children:[jsx("button",{onClick:Se=>pt(he,Se),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:Se=>{Se.stopPropagation(),it(he);},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 de=K.id==="startDate"?"startDate":"endDate",ge=he[de],Y=Je?.taskId===he.id&&Je?.field===de,Re=Se=>Se?(typeof Se=="string"?new Date(Se):Se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Se=>Se.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:y?.5:1,cursor:y?"default":"pointer"},title:y?"Auto-calculated from subtasks":void 0,onClick:Se=>{if(!y)if(Y)H(null);else {let ae=Se.currentTarget.getBoundingClientRect();H({taskId:he.id,field:de,month:ge?typeof ge=="string"?new Date(ge):ge:new Date,position:{top:ae.bottom+4,left:ae.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Re(ge)}),y&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Y&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(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:Je?.position.top,left:Je?.position.left},onClick:Se=>Se.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Se=new Date,ae=new Date(Se);ae.setDate(Se.getDate()+1);let me=new Date(Se);me.setDate(Se.getDate()+7);let Ge=new Date(Se);return Ge.setDate(Se.getDate()+14),[{label:"Hoy",date:Se},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:me},{label:"2 semanas",date:Ge}].map((ue,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Xe=>Xe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Xe=>Xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[de]:ue.date}),H(null);},children:ue.label},$e))})(),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:Se=>Se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[de]:void 0}),H(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:()=>H(Se=>Se?{...Se,month:new Date(Se.month.getFullYear(),Se.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:Je?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Se=>Se?{...Se,month:new Date(Se.month.getFullYear(),Se.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((Se,ae)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Se},ae))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Se=Je?.month||new Date,ae=Se.getFullYear(),me=Se.getMonth(),Ge=new Date(ae,me,1).getDay(),A=new Date(ae,me+1,0).getDate(),ue=new Date,$e=[];for(let ft=Ge-1;ft>=0;ft--)$e.push({day:new Date(ae,me,-ft).getDate(),date:new Date(ae,me-1,new Date(ae,me,-ft).getDate()),isCurrentMonth:false});for(let ft=1;ft<=A;ft++)$e.push({day:ft,date:new Date(ae,me,ft),isCurrentMonth:true});let Xe=42-$e.length;for(let ft=1;ft<=Xe;ft++)$e.push({day:ft,date:new Date(ae,me+1,ft),isCurrentMonth:false});return $e.map((ft,Va)=>{let Ta=ft.date.toDateString()===ue.toDateString(),xa=(ge?typeof ge=="string"?new Date(ge):ge:null)?.toDateString()===ft.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:ft.isCurrentMonth?xa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:xa?"#2E94FF":"transparent",boxShadow:Ta&&!xa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(he.id,{[de]:ft.date}),H(null);},children:ft.day},Va)})})()})]})]})]}),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:ze(he)})});case "assignees":if(y)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 je=r.filter(Se=>he.assignees?.some(ae=>ae.name===Se.name||ae.initials===Se.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(Fo,{assignedUsers:je,availableUsers:r,onChange:Se=>{let ae=Se.map(me=>({id:me.id,name:me.name,initials:me.initials,color:me.color}));g?.(he.id,{assignees:ae.length>0?ae:void 0});}})});case "status":if(y){let Se=he.progress===100?"\u2713":he.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:Se})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(gu,{status:he.status||"todo",onChange:Se=>{g?.(he.id,{status:Se,progress:Se==="completed"?100:he.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:y?.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:`${he.progress}%`,backgroundColor:he.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:[he.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},St={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Yt=gt[he.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(So,{priority:Yt,onChange:Se=>{Se&&g?.(he.id,{priority:St[Se]||"medium"});}})});default:return null}},Nt=K=>[{id:"hide",label:"Hide Column",icon:jt.Hide,onClick:()=>i(K),disabled:K==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:jt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:jt.SortDesc,onClick:()=>{}}],Lt=K=>K.subtasks&&K.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{C?.(K.id);}},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{x?.([K.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{E?E(K.id,K.name):f?.([K.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:jt.Pencil,onClick:()=>{n?.(K);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{C?.(K.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:jt.MarkIncomplete,onClick:()=>{g?.(K.id,{status:"todo",progress:0});},disabled:K.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:jt.SetInProgress,onClick:()=>{g?.(K.id,{status:"in-progress"});},disabled:K.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:jt.MarkComplete,onClick:()=>{g?.(K.id,{status:"completed",progress:100});},disabled:K.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{x?.([K.id]);}},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:jt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{E?E(K.id,K.name):f?.([K.id]);}}],Ie=c.filter(K=>K.visible),Be=Ie.reduce((K,he)=>K+he.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Be},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${He}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ie.map((K,he)=>{let ee=he===Ie.length-1,y=K.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${y?"":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.minWidth??(y?200:60)}px`,maxWidth:`${K.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:L=>{L.preventDefault(),X({isOpen:true,x:L.clientX,y:L.clientY,type:"header",columnId:K.id});},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:L=>{L.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:K.label,children:K.label}),K.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===K.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:L=>{L.preventDefault(),L.stopPropagation(),P(K.id),re(L.clientX),$(K.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},K.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(ei,{columns:c,onToggleColumn:i,theme:t}),jsx("button",{onClick:()=>D(!le),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"})}),le&&jsxs("div",{ref:j,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:K=>K.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:()=>D(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",style:{minHeight:Ne},children:Ce.map(({task:K,level:he},ee)=>{let y=W(K.id),L=Ke===K.id,z=L&&ot==="above",J=L&&ot==="below",de=L&&ot==="child",ge={};return de&&(ge.backgroundColor=`${t.accent}15`,ge.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":K.id,className:`flex items-center cursor-pointer group ${fe===K.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:y?t.accentLight:de?`${t.accent}15`:ee%2===0?t.bgPrimary:t.bgGrid,...ge},onMouseEnter:()=>G(K.id),onMouseLeave:()=>G(null),onClick:Y=>{let je=fn(e).map(Yt=>Yt.id),St=navigator.platform.toUpperCase().indexOf("MAC")>=0?Y.metaKey:Y.ctrlKey;ye(K.id,je,St,Y.shiftKey),s?.(K);},onDoubleClick:Y=>{Y.stopPropagation(),n?.(K);},onContextMenu:Y=>{Y.preventDefault(),X({isOpen:true,x:Y.clientX,y:Y.clientY,type:"task",task:K}),d?.(K,Y);},whileHover:{backgroundColor:y?t.accentLight:t.hoverBg},children:[z&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ie.map((Y,Re)=>{let je=Re===Ie.length-1,gt=Y.id==="name";return jsx("div",{className:`px-4 flex items-center ${gt?"justify-start":"justify-center"}`,style:{width:`${Y.width}px`,minWidth:`${Y.minWidth??(gt?200:60)}px`,maxWidth:`${Y.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:je?"none":`1px solid ${I===K.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:mt(Y,K,gt?he:0)},`${K.id}-${Y.id}`)})]},K.id)})}),jsx(gn,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Nt(Z.columnId):Z.type==="task"&&Z.task?Lt(Z.task):[],onClose:()=>X({...Z,isOpen:false}),theme:t}),xe&&Dt&&fe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Dt.x+12,top:Dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let K=Ce.find(he=>he.task.id===fe)?.task;return K?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:K.name})}):null})()}),document.body)]})}function Kp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[p,l]=useState(t),[c,i]=useState(null),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(0),[v,C]=useState(0),[N,E]=useState(null),[T,B]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:p,setGhostWidth:l,connectionLine:c,setConnectionLine:i,hoveredTaskId:m,setHoveredTaskId:g,activeZone:h,setActiveZone:b,draggedSegmentIndex:w,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:v,setSegmentDragOffsetX:C,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:T,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ce,M)=>{r("none"),i(null),g(null),d(ce),l(M),C(0),f(null),k(0);}}}function si({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:p,onDoubleClick:l,onContextMenu:c,onDateChange:i,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:h,onHoverChange:b,showBaseline:w,showTaskBarLabels:f=true,showCriticalPath:x=true,readOnly:k=false}){let v=Kp(t,r),C=useRef(null),N=useRef(false),E=useRef(null),T=useRef(null),{dragMode:B,setDragMode:O,dragOffset:I,setDragOffset:G,ghostX:S,setGhostX:ce,ghostWidth:M,setGhostWidth:q,connectionLine:ke,setConnectionLine:_e,hoveredTaskId:P,setHoveredTaskId:V,activeZone:re,setActiveZone:Te,draggedSegmentIndex:$,setDraggedSegmentIndex:Z,draggedSegmentStartX:X,setDraggedSegmentStartX:fe,segmentDragOffsetX:Fe,setSegmentDragOffsetX:Ke,hoveredSegmentIndex:qe,setHoveredSegmentIndex:ot,isHovered:ne,setIsHovered:ut,isDragging:Me,isResizing:ct,isConnecting:Dt,resetDragState:Tt}=v,xe=18,rt=!!o.executionBarBg,Ye=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Je=rt?3:6,H=e.subtasks&&e.subtasks.length>0,le=e.endDate&&(()=>{let ee=new Date;ee.setHours(0,0,0,0);let y=new Date(e.endDate);return y.setHours(0,0,0,0),y<ee})()&&e.progress<100,D=x&&e.isCriticalPath,j=o.name==="neutral"||o.today==="#1C1917",se=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=x&&e.isCriticalPath||le?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:o.taskBarPrimary,Oe=k?"default":Me?Dt?"crosshair":ct?"ew-resize":"grabbing":"grab",Ce=k?"default":"ew-resize",Ne=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),ze=r<50,it=r<40;useEffect(()=>{b&&(!ne||Me||e.segments)&&b(null);},[ne,Me,e.segments,b]);let st=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},pt=ee=>Math.round(ee/s)*s,Rt=ee=>{let y=Math.round(ee/s),L=new Date(n);return L.setDate(L.getDate()+y),L},Et=(ee,y)=>{for(let L of g){if(L.id===e.id)continue;let z=5;if(ee>=L.x-z&&ee<=L.x+L.width+z&&y>=L.y-z&&y<=L.y+L.height+z)return L.id}return null},dt=useCallback((ee,y,L)=>{if(k)return;ee.preventDefault(),ee.stopPropagation();let z=C.current?.ownerSVGElement;if(!z)return;let J=z.createSVGPoint();J.x=ee.clientX,J.y=ee.clientY;let de=J.matrixTransform(z.getScreenCTM()?.inverse()),ge=L!==void 0?L:t,Y=y;if(!Y){let Re=de.x-ge;ee.shiftKey?(Y="connect",_e({x:t+r,y:a+xe/2})):ee.ctrlKey||ee.metaKey?Y="move":ee.altKey?Y=Re<r/2?"resize-start":"resize-end":it?Re<r/2?Y="move":Y="resize-end":ze?Re<=Ne/2?Y="resize-start":Re>=r-Ne/2?Y="resize-end":Y="move":Re<=Ne?Y="resize-start":Re>=r-Ne?Y="resize-end":Y="move";}N.current=false,O(Y),ut(false),Te(null),Y==="move"?G(de.x-ge):Y==="connect"?_e({x:t+r,y:a+xe/2}):G(0),ce(ge),q(r);},[t,r,a,xe,k]),mt=useCallback(ee=>{let y=C.current?.ownerSVGElement;if(!y)return;let L=y.closest(".gantt-timeline-scroll");if(!L)return;let z=L.getBoundingClientRect(),J=60,de=15,ge=0;if(ee.clientX<z.left+J){let Y=z.left+J-ee.clientX;ge=-Math.min(de,Y/2);}else if(ee.clientX>z.right-J){let Y=ee.clientX-(z.right-J);ge=Math.min(de,Y/2);}return ge!==0&&(L.scrollLeft+=ge),ge!==0},[]),Nt=useCallback(ee=>{if(B==="none")return;N.current=true,T.current=ee;let y=C.current?.ownerSVGElement;if(!y)return;if(B==="move"||B==="resize-start"||B==="resize-end"){let J=mt(ee);J&&!E.current?E.current=window.setInterval(()=>{T.current&&(mt(T.current),Nt(T.current));},16):!J&&E.current&&(window.clearInterval(E.current),E.current=null);}let L=y.createSVGPoint();L.x=ee.clientX,L.y=ee.clientY;let z=L.matrixTransform(y.getScreenCTM()?.inverse());if(B==="connect"){_e({x:z.x,y:z.y});let J=Et(z.x,z.y);V(J);}else if(B==="move"){let J=z.x-I,de=pt(J);ce(de),q(r);let ge=Math.round((de-t)/s);if(h?.(e.id,ge,true),e.segments&&e.segments.length>0&&$!==null){let Y=de-X;Ke(Y);}}else if(B==="resize-start"){let J=z.x,de=pt(J),ge=t+r-de;ge>=s&&(ce(de),q(ge));}else if(B==="resize-end"){let J=z.x,ge=pt(J)-t;ge>=s&&q(ge);}},[B,t,r,s,I,e,pt,$,X,Et,V,_e,ce,q,Ke,h,mt]),Lt=useCallback(()=>{if(E.current&&(window.clearInterval(E.current),E.current=null),T.current=null,B!=="none"){if(B==="connect")P&&m&&m(e,P),_e(null),V(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),y,L,z=true;if(B==="move"){if(y=Rt(S),L=new Date(y.getTime()+ee),e.segments&&e.segments.length>0&&$!==null){let J=Math.round(Fe/s),de=e.segments.map((je,gt)=>{if(gt===$){let St=new Date(je.startDate),Yt=new Date(je.endDate);return St.setDate(St.getDate()+J),Yt.setDate(Yt.getDate()+J),{startDate:St,endDate:Yt}}return je}),ge=de.flatMap(je=>[je.startDate,je.endDate]),Y=new Date(Math.min(...ge.map(je=>je.getTime()))),Re=new Date(Math.max(...ge.map(je=>je.getTime())));i?.({...e,segments:de},Y,Re),Tt(t,r);return}}else B==="resize-start"?(y=Rt(S),L=e.endDate,y>L&&(console.warn("Invalid date range: start date must be before or equal to end date"),z=false)):B==="resize-end"?(y=e.startDate,L=Rt(S+M),L.setDate(L.getDate()-1),L<y&&(console.warn("Invalid date range: end date must be after or equal to start date"),z=false)):z=false;z&&y&&L&&(L.getTime()<y.getTime()?console.warn("Invalid date range: end date cannot be before start date"):i?.(e,y,L));}h?.(e.id,0,false),Tt(t,r);}},[B,S,M,e,i,P,m,t,r,s,Rt,Fe,$,Tt,h]);useEffect(()=>{if(B==="none")return;let ee=L=>{Nt(L);},y=()=>{Lt();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",y),E.current&&(window.clearInterval(E.current),E.current=null);}},[B,Nt,Lt]);let Ie=Me&&!Dt?S:t,Be=Me&&!Dt?M:r,K=d.taskClass(e);return jsxs("g",{ref:C,"data-task-bar":"true",onClick:()=>{!Me&&!N.current&&p?.(e),N.current=false;},onDoubleClick:ee=>{!Me&&!N.current&&(ee.stopPropagation(),l?.(e));},onContextMenu:ee=>{ee.preventDefault(),c?.(e,ee);},onMouseEnter:()=>!Me&&ut(true),onMouseMove:ee=>{b&&ne&&!Me&&!e.segments&&b({task:e,x:t,y:a,width:r,height:xe,showBelow:false,mouseX:ee.clientX,mouseY:ee.clientY});},onMouseLeave:()=>{Me||(ut(false),Te(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:xe,fill:"transparent",style:{pointerEvents:"all"}}),ne&&!Me&&!ze&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:xe,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-start"),onMouseDown:ee=>dt(ee,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:xe,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Te("move"),onMouseDown:ee=>dt(ee,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:xe,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-end"),onMouseDown:ee=>dt(ee,"resize-end")})]}),ne&&!Me&&it&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Te("move"),onMouseDown:ee=>dt(ee,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-end"),onMouseDown:ee=>dt(ee,"resize-end")}),ne&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Me&&!Dt&&!e.segments&&jsx(motion.rect,{x:S,y:a,width:M,height:xe,rx:Je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),w&&e.baselineStartDate&&e.baselineEndDate&&!Me&&(()=>{let ee=e.baselineStartDate.getTime(),y=e.baselineEndDate.getTime(),L=n.getTime(),z=864e5,J=(ee-L)/z,de=(y-ee)/z,ge=J*s,Y=Math.max(de*s,s),Re=Ie+Be,je=ge+Y,gt=e.endDate?.getTime()??0,St=Math.ceil((gt-y)/z),Yt=St>0,Se=St<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:ge,y:a,width:Y,height:xe,rx:Je,fill:"none",stroke:Ye?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Yt&&Re>je&&jsx("rect",{x:je,y:a,width:Re-je,height:xe,rx:0,fill:"#EF4444",opacity:.2}),Yt&&jsxs("text",{x:Math.max(Re,je)+6,y:a+xe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",St,"d"]}),Se&&jsxs("text",{x:Re+6,y:a+xe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[St,"d"]})]})})(),!e.segments&&rt&&H&&(()=>{let y=a+(xe-6)/2,L=14,z=a+(xe-L)/2,J=2;return jsxs("g",{"data-task-class":K,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ie,y,width:Be,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:Ie,y:z,width:J,height:L,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:Ie+Be-J,y:z,width:J,height:L,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&rt&&!H&&jsx(motion.rect,{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":K,initial:{opacity:0,scale:.95},animate:{opacity:Me&&!Dt?.15:e.parentId?.6:1,scale:ne&&!Me?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>dt(ee),style:{cursor:Oe,pointerEvents:"all"}}),!e.segments&&!rt&&jsx(motion.rect,{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:te,"data-task-class":K,initial:{opacity:0,scale:.95},animate:{opacity:Me&&!Dt?.15:e.parentId?.6:ne?.9:.8,scale:ne&&!Me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:ee=>dt(ee),style:{cursor:H?"default":Oe,pointerEvents:"all"}}),rt&&(le||D)&&!e.segments&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(rt&&H?null:jsx("rect",{x:Ie,y:a,width:Math.max(Be*(e.progress/100),Je*2),height:xe,rx:Je,fill:te,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let ee=e.progress>0?Be*(e.progress/100):0,y=Ie+ee,L=Be-ee,z=e.progress===0?Je:0,J=e.progress===0?Ie:y,de=e.progress===0?Be:L;return jsxs(Fragment,{children:[jsx("rect",{x:J,y:a,width:de,height:xe,rx:z,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:J,y:a,width:de,height:xe,rx:z,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),rt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Me&&(()=>{let ee=Ie+Be*(e.progress/100),y=8,L=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:ee,cy:a+xe/2,r:y,fill:L?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:ee,y:a+xe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:L?.initials||L?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((ee,y)=>{let L=(ee.startDate.getTime()-n.getTime())/864e5*s,J=(ee.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-L+s,de=Me&&B==="move"&&$===y,ge=qe===y,Y=de?L+Fe:L;return jsxs("g",{onMouseEnter:()=>!Me&&ot(y),onMouseLeave:()=>!Me&&ot(null),children:[jsx(motion.rect,{x:Y,y:a,width:J,height:xe,rx:Je,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:de||e.parentId?.6:ge?.9:.8,scale:ge&&!Me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Re=>{Re.stopPropagation(),Z(y),fe(L),dt(Re,void 0,L);},style:{cursor:Oe,pointerEvents:"all"}}),jsx("rect",{x:Y,y:a,width:J*(e.progress/100),height:xe,rx:Je,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${y}`)}),j&&(le||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!le&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),le&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Be>60&&!e.segments&&!(rt&&H)&&(()=>{let ee=d.taskLabel(e),y=typeof ee=="string"?ee:e.name,L=y.length>Math.floor(Be/8)?`${y.substring(0,Math.floor(Be/8))}...`:y;return jsx("text",{x:Ie+8,y:a+xe/2,dominantBaseline:"middle",fill:se?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:se?"line-through":"none"},children:L})})(),!Me&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(rt?jsxs("text",{x:Ie+Be+6,y:a+xe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxs("text",{x:Ie+Be-12,y:a+xe/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&&Be>80&&!Me&&!e.segments&&!(rt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ie+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ie+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ne||ct)&&!Dt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ie-2,y:a,width:16,height:xe,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Te("resize-start"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"resize-start");}}),jsx(motion.rect,{x:Ie+4,y:a+8,width:3,height:xe-16,rx:1.5,fill:re==="resize-start"||B==="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:Ie+Be-14,y:a,width:16,height:xe,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Te("resize-end"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"resize-end");}}),jsx(motion.rect,{x:Ie+Be-7,y:a+8,width:3,height:xe-16,rx:1.5,fill:re==="resize-end"||B==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ne&&!Me&&!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+xe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Te("connect"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+xe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Dt&&ke&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+xe/2,x2:ke.x,y2:ke.y,stroke:P?o.statusCompleted:o.accent,strokeWidth:P?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:P?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ke.x,cy:ke.y,r:P?8:6,fill:P?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),P&&jsx(motion.text,{x:ke.x+15,y:ke.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ke.x+10},animate:{opacity:1,x:ke.x+15},transition:{duration:.2},children:"Connect"})]}),(ne||Me)&&!Dt&&!e.segments&&jsx(motion.rect,{x:Ie-1,y:a-1,width:Be+2,height:xe+2,rx:Je+1,fill:"none",stroke:Me?o.accent:rt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:rt?1:2,opacity:Me||rt?.6:.4,initial:{opacity:0},animate:{opacity:Me||rt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ct&&jsxs(Fragment,{children:[jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:S+M,y1:0,x2:S+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ne&&!Me&&!e.segments&&!b&&(()=>{let L=a<100,z=L?a+xe+13:a-82-13,J=L?`M ${Ie+Be/2-6} ${a+xe+3} L ${Ie+Be/2} ${a+xe+13} L ${Ie+Be/2+6} ${a+xe+3}`:`M ${Ie+Be/2-6} ${a-13} L ${Ie+Be/2} ${a-3} L ${Ie+Be/2+6} ${a-13}`,de=z+22,ge=z+40,Y=z+55,Re=z+70,je=L?z+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:L?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:L?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:J,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ie+Be/2-120,y:z,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ie+Be/2,y:de,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ie+Be/2-110,y:ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ie+Be/2-70,y:ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:Ie+Be/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ie+Be/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:Ie+Be/2+10,y:ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ie+Be/2+65,y:ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:Ie+Be/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ie+Be/2+65,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ie+Be/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ie+Be/2-50,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(gt=>gt.name).join(", ").substring(0,30),e.assignees.map(gt=>gt.name).join(", ").length>30?"...":""]})]}),!L&&jsx("text",{x:Ie+Be/2,y:je,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:it?"Left: move \u2022 Right: resize":ze?"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 pd=260,bn=8,Xp=16,lv=-12;function Jp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:x,mouseX:k,mouseY:v}=e,N=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null?155:105,E=k+Xp,T=v+lv-N;E+pd>window.innerWidth-bn&&(E=k-pd-Xp),E<bn&&(E=bn);let B=T<bn;B&&(T=v+20),T+N>window.innerHeight-bn&&(T=window.innerHeight-bn-N),o({left:E,top:T,showBelow:B});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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"},p=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let x=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${x} d\xEDa${x!==1?"s":""}`:`${x} day${x!==1?"s":""}`},c=x=>{if(x==null||x===0)return "N/A";let k=Math.floor(x/60),v=x%60;return k===0?`${v}m`:v===0?`${k}h`:`${k}h ${v}m`},i=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",h=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",w=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:pd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${w}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(ii,{label:d.start,value:s.startDate?p(s.startDate):"N/A",labelColor:i,valueColor:m}),jsx(ii,{label:d.duration,value:l(),labelColor:i,valueColor:m}),jsx(ii,{label:d.end,value:s.endDate?p(s.endDate):"N/A",labelColor:i,valueColor:m}),jsx(ii,{label:d.progress,value:`${s.progress}%`,labelColor:i,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:i},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(x=>x.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:c(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.logged,":"]})," ",jsx("span",{style:{color:h,fontWeight:600},children:c(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:c(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function jl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let d=l=>{t(l),o(false);},p=e.reduce((l,c)=>{let i=c.category||"Other";return l[i]||(l[i]=[]),l[i].push(c),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!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:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.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:u("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(p).map(([l,c])=>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:l})}),jsx("div",{children:c.map(i=>jsxs("button",{onClick:()=>d(i),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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:i.name}),i.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:i.description})]})]},i.id))})]},l)),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 Yl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[p,l]=useState("json"),[c,i]=useState(null),m=useRef(null);if(!t)return null;let g=async()=>{let b=o?.current||void 0,w=await jc(e,p,b);Kc(w,p);},h=async b=>{let w=b.target.files?.[0];if(w){try{let f=await Xc(w),x=w.name.endsWith(".json")?"json":"csv",k=qc(f,x);i(k),k.success&&r&&r(k,f);}catch(f){i({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}m.current&&(m.current.value="");}};return jsxs("div",{className:u("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:()=>d("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>d("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="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(b=>jsxs("button",{onClick:()=>l(b),className:u("p-4 rounded-lg border-2 transition-all text-center",p===b?"border-blue-500 bg-blue-500/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:[b==="json"&&"\u{1F4C4}",b==="csv"&&"\u{1F4CA}",b==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:b})]},b))})]}),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:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="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:m,type:"file",accept:".json,.csv",onChange:h,className:"hidden"}),jsxs("button",{onClick:()=>m.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"})]})]}),c&&jsxs("div",{className:u("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((b,w)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",b]},w))})]})]})]})]})]})}var Iy=["URGENT","HIGH","MEDIUM","LOW"],By=[{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"}],Ry=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ql({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:p=[],availableLabels:l=[],availableColumns:c=[],showQuickFilters:i=true,compact:m=false,groupBy:g="none",onGroupByChange:h}){let[b,w]=useState(true),f=useCallback(N=>{a({search:N.target.value});},[a]),x=useCallback(N=>{a({dateFilter:N.target.value});},[a]),k=useCallback(N=>{r({by:N.target.value});},[r]),v=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=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 ${m?"filter-bar--compact":""} ${b?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>w(!b),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:b?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:b?"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"}),C&&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)"]})]}),!b&&jsxs("div",{className:"filter-bar__content",children:[i&&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"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),d&&jsx("button",{onClick:d,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:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:x,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:N=>{let E=N.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Iy.map(N=>jsx("option",{value:N,children:N},N))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let E=N.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let E=N.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(N=>jsx("option",{value:N,children:N},N))]})}),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:k,className:"filter-bar__select filter-bar__select--sm",children:By.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:v,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),h&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:N=>h(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ry.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),C&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Xl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:p}){let[l,c]=useState(false),i=useRef(null);useEffect(()=>{let g=h=>{i.current&&!i.current.contains(h.target)&&c(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let m=g=>{g(),c(false);};return jsxs("div",{className:u("relative",r),ref:i,children:[jsxs("button",{onClick:()=>c(!l),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,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"})]}),l&&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:[o==="kanban"?jsxs("button",{onClick:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(async()=>await n?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(async()=>await d?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(()=>p?.()),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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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:()=>m(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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.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 Jl={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:"#2E94FF",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"}},Ql={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:"#2E94FF",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"}},Zl={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"}},Bo={dark:Jl,light:Ql,neutral:Zl},Ys="dark";var qs=createContext(void 0),jy="asakaa-theme";function Tp({children:e,defaultTheme:t=Ys,storageKey:a=jy}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,p=Bo[r];Object.entries(p.colors).forEach(([c,i])=>{i&&d.style.setProperty(`--theme-${Ky(c)}`,i);}),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(([c,i])=>{let m=p.colors[c];m&&d.style.setProperty(i,m);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Bo};return jsx(qs.Provider,{value:n,children:e})}function dn(){let e=useContext(qs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Ky(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ed({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=dn();return e?jsxs("div",{className:u("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(Bo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/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:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.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}function Np(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return et[e]||et.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",et[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",et[e].bgSecondary),bgGrid:r("--theme-bg-card",et[e].bgGrid),bgWeekend:r("--theme-bg-hover",et[e].bgWeekend),border:r("--theme-border-primary",et[e].border),borderLight:r("--theme-border-subtle",et[e].borderLight),textPrimary:r("--theme-text-primary",et[e].textPrimary),textSecondary:r("--theme-text-secondary",et[e].textSecondary),textTertiary:r("--theme-text-tertiary",et[e].textTertiary),accent:r("--theme-accent-primary",et[e].accent),accentHover:r("--theme-accent-hover",et[e].accentHover),accentLight:r("--theme-accent-primary",et[e].accentLight),taskBarPrimary:r("--theme-accent-primary",et[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",et[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",et[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",et[e].dependency),dependencyHover:r("--theme-border-secondary",et[e].dependencyHover),criticalPath:r("--theme-error",et[e].criticalPath),criticalPathLight:r("--theme-error",et[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",et[e].today):e==="neutral"?r("--theme-text-primary",et[e].today):r("--theme-error",et[e].today),todayLight:e==="light"?r("--theme-accent-primary",et[e].todayLight):e==="neutral"?r("--theme-text-primary",et[e].todayLight):r("--theme-error",et[e].todayLight),milestone:r("--theme-warning",et[e].milestone),milestoneLight:r("--theme-warning",et[e].milestoneLight),statusTodo:r("--theme-text-tertiary",et[e].statusTodo),statusInProgress:r("--theme-accent-primary",et[e].statusInProgress),statusCompleted:r("--theme-success",et[e].statusCompleted),hoverBg:r("--theme-bg-hover",et[e].hoverBg),focusRing:r("--theme-accent-primary",et[e].focusRing),...et[e].dotGrid&&{dotGrid:et[e].dotGrid},...et[e].glassHeader&&{glassHeader:et[e].glassHeader},...et[e].glassToolbar&&{glassToolbar:et[e].glassToolbar},...et[e].forecastHud&&{forecastHud:et[e].forecastHud},...et[e].neonRedGlow&&{neonRedGlow:et[e].neonRedGlow},...et[e].executionBarBg&&{executionBarBg:et[e].executionBarBg}}}var Xs={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"}},Dp={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"}},td={en:Xs,es:Dp};function Sp(e){return td[e]||td.en}function ad(e,t){let a=Sp(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 un=createContext(Xs);function Er(){return useContext(un)}function Zs(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),d=n.bottom+4,p;a==="right"?p=n.right-r:p=n.left;let l=8;p+r>window.innerWidth-l&&(p=window.innerWidth-l-r),p<l&&(p=l),s({top:d,left:p});},[t,a,e,r]),o}function Fp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,d]=useState(false),[p,l]=useState(null),[c,i]=useState(false),m=useRef(null),g=useRef(null),h=Er(),b=Zs(m,n,"right",224),w=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=h.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let C=N=>{let E=N.target;m.current&&!m.current.contains(E)&&g.current&&!g.current.contains(E)&&d(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[n]);let x=[{id:"png",label:h.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:h.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:h.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:h.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(C=>C.handler),k=async(C,N)=>{if(N){l(C);try{await N();}catch(E){console.error(`Export ${C} failed:`,E);}finally{l(null),d(false);}}},v=()=>{s?.(),i(true),setTimeout(()=>i(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>d(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,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:b.top,left:b.left,zIndex:99999,backgroundColor:w?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${w?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:w?"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:[x.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:w?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:x.map((C,N)=>jsxs(motion.button,{onClick:()=>k(C.id,C.handler),disabled:p!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:w?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:N*.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:p===C.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"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),x.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:w?"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:w?"rgba(255,255,255,0.35)":e.textTertiary},children:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:v,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:w?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:c?"rgba(34,197,94,0.15)":e.accentLight,color:c?"#22C55E":e.accent},children:c?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:c?h.toolbar.copied:h.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function xx({options:e,value:t,onChange:a,theme:r,layoutId:o="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 n=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:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,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:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function vx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.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:o.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}})]},o.value)})})}function Pp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),d=useRef(null),p=Er(),l=Zs(n,o,"left");useEffect(()=>{if(!o)return;let m=g=>{let h=g.target;n.current&&!n.current.contains(h)&&d.current&&!d.current.contains(h)&&s(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[o]);let c=[{value:"all",label:p.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(m,g)=>({value:g+1,label:`L${g+1}`}))],i=t==="all"?p.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${p.toolbar.wbsLevel||"Level"}: ${i}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:i})]}),createPortal(jsx(AnimatePresence,{children:o&&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-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.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:c.map((m,g)=>{let h=t===m.value;return jsxs(motion.button,{onClick:()=>{a(m.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:h?e.accentLight:"transparent",borderBottom:g<c.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:h?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:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:h?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:h?600:500},children:m.label}),h&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(m.value))})})})}),document.body)]})}function Mp({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),p=useRef(null),l=Er(),c=Zs(d,s,"left");useEffect(()=>{if(!s)return;let h=setTimeout(()=>{let b=f=>{let x=f.target;d.current&&!d.current.contains(x)&&p.current&&!p.current.contains(x)&&n(false);},w=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",w),p._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(h),p._cleanup&&p._cleanup();}},[s]);let i=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],m=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:h=>{h.stopPropagation(),n(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:m?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#2E94FF":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:l.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:p,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:c.top,left:c.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"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:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:i.map(h=>{let b=t===h.value&&!r,w=()=>h.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):h.icon;return jsxs(motion.button,{onClick:()=>{a(h.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?h.color:"text-gray-400"} flex-shrink-0`,children:w()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:h.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},h.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"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?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function wx({value:e,onChange:t,theme:a}){let r=Er(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let d=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:d?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:d?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function kx({theme:e,forecast:t}){let a=Er(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,d=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,p=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},l=t?.confidencePercent,c=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,i=t?.costAtCompletion,m=t?.currency||"$",g=i!=null?i>=1e6?`${m}${(i/1e6).toFixed(2)}M`:i>=1e3?`${m}${(i/1e3).toFixed(1)}K`:`${m}${i.toFixed(0)}`:"\u2014",h=t?.budgetVariancePercent,b=h!=null&&h!==0,w=h!=null?h>0?`+${h.toFixed(0)}% ${a.toolbar.budgetOver}`:`${h.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=h!=null&&h>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:h!=null&&h<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,": ",o]}),n&&d&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:p.bg,color:p.text,fontFamily:"'JetBrains Mono', monospace"},children:d})]})]}),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:c,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.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:g}),b&&w&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:w})]})]})]})}function Cx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:d,onShowDependenciesChange:p,rowDensity:l,onRowDensityChange:c}){let[i,m]=useState(false),g=useRef(null),h=useRef(null),b=Er(),w=Zs(g,i,"right",208),f=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!i)return;let v=C=>{let N=C.target;g.current&&!g.current.contains(N)&&h.current&&!h.current.contains(N)&&m(false);};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]);let x=[{key:"criticalPath",label:b.toolbar.visibility==="Visibilidad"?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a},{key:"baselines",label:b.toolbar.visibility==="Visibilidad"?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:b.toolbar.visibility==="Visibilidad"?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:b.toolbar.visibility==="Visibilidad"?"Dependencias":"Dependencies",icon:GitBranch,active:d,onChange:p}],k=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:g,onClick:()=>m(!i),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:i?e.accent:e.textTertiary,backgroundColor:i?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:h,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:w.top,left:w.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${f?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:x.map((v,C)=>{let N=v.icon;return jsxs(motion.button,{onClick:()=>v.onChange?.(!v.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:C*.03},children:[jsx(N,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:v.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:v.label}),v.active&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},v.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"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:f?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((v,C)=>{let N=l===v.value;return jsxs(motion.button,{onClick:()=>c(v.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(x.length+C)*.03},children:[jsx("span",{style:{color:N?e.accent||"#2E94FF":f?"rgba(255,255,255,0.85)":e.textPrimary},children:v.label}),N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},v.value)})]})]})}),document.body)]})}function ei({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:p,showThemeSelector:l=false,showCreateTaskButton:c=false,createTaskLabel:i,onCreateTask:m,taskFilter:g="all",onTaskFilterChange:h,hideCompleted:b=false,onHideCompletedChange:w,toolbarRightContent:f,wbsLevel:x,onWbsLevelChange:k,maxWbsDepth:v=4,viewMode:C="execution",onViewModeChange:N,projectForecast:E,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportCSV:I,onExportJSON:G,onExportMSProject:S,showCriticalPath:ce=true,onShowCriticalPathChange:M,showDependencies:q=true,onShowDependenciesChange:ke,highlightWeekends:_e=true,onHighlightWeekendsChange:P,showBaseline:V=false,onShowBaselineChange:re,onCopySnapshotLink:Te}){let $=Er(),Z=T||B||O||I||G||S,X=!!e.glassToolbar,[fe,Fe]=useState(false),Ke=useRef(null);useEffect(()=>{fe&&Ke.current&&Ke.current.focus();},[fe]);let qe=[{value:"day",label:$.toolbar.day},{value:"week",label:$.toolbar.week},{value:"month",label:$.toolbar.month}],ot=[{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"})}],ne=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(X){let ut=ne?"rgba(255,255,255,0.08)":e.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:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:ne?"#1A1A1A":e.bgSecondary,border:`1px solid ${ne?"rgba(255,255,255,0.08)":e.border}`},animate:{width:fe?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Fe(!fe),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),fe&&jsx("input",{ref:Ke,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Fe(false),onKeyDown:Me=>{Me.key==="Escape"&&Fe(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),N&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ne?"#000000":e.bgSecondary,border:`1px solid ${ne?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>N("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="execution"?ne?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:C==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="execution"?{color:e.textSecondary}:{},children:$.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>N("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:C==="oracle"?ne?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:C==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:C!=="oracle"?{color:e.textSecondary}:{},children:$.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(wx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),k&&jsx(Pp,{theme:e,value:x??"all",onChange:k,maxDepth:v}),h&&jsx(Mp,{theme:e,value:g,onChange:h,hideCompleted:b,onHideCompletedChange:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:ut}}),jsx(Cx,{theme:e,showCriticalPath:ce,onShowCriticalPathChange:M,showBaseline:V,onShowBaselineChange:re,highlightWeekends:_e,onHighlightWeekendsChange:P,showDependencies:q,onShowDependenciesChange:ke,rowDensity:d,onRowDensityChange:p}),jsx(Fp,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportMSProject:S,onCopySnapshotLink:Te}),c&&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, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ne?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ne?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:i||$.toolbar.createTask})]})]})]}),E&&jsx(kx,{theme:e,forecast:E})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(vx,{options:qe,value:t,onChange:ut=>a(ut),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.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:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.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:e.borderLight}}),k&&jsx(Pp,{theme:e,value:x??"all",onChange:k,maxDepth:v}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Mp,{theme:e,value:g,onChange:h,hideCompleted:b,onHideCompletedChange:w})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),c&&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, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:i||$.toolbar.createTask})]}),(Z||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Fp,{theme:e,onExportPNG:T,onExportPDF:B,onExportExcel:O,onExportMSProject:S,onCopySnapshotLink:Te}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(xx,{options:ot,value:s,onChange:ut=>n(ut),theme:e})]})]})}function ti({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let c=i=>{d.current&&!d.current.contains(i.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let l=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let c=p.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!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(It,{children:jsx(motion.div,{ref:d,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"}),l.map(c=>jsxs("button",{onClick:()=>{t(c.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:i=>{i.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function gn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,i=r.length*36+8,m=8,g=window.innerWidth,h=window.innerHeight,b=t,w=a;t+c+m>g&&(b=t-c,b<m&&(b=m)),a+i+m>h&&(w=h-i-m,w<m&&(w=m)),p({x:b,y:w});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=m=>{n.current&&!n.current.contains(m.target)&&o();},i=m=>{m.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",i);}},[e,o]),!e)return null;let l=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:n,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:`${d.x}px`,top:`${d.y}px`,backgroundColor:l(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(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:i=>{c.disabled||(i.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var jt={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 Hp({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:p,onTaskRename:l,onTaskToggleExpand:c,onOpenTaskModal:i,enableKeyboard:m=true}){let g=useRef(false),h=useCallback(k=>{g.current=k;},[]),b=useCallback(k=>{let v=[],C=N=>{for(let E of N)v.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&C(E.subtasks);};return C(k),v},[]),w=useCallback(()=>{let k=b(e);for(let v of k)if(t.has(v.id))return v;return null},[e,t,b]),f=useCallback((k,v)=>{let C=b(e);if(C.length===0)return;let N=w();if(!N){a(C[0].id,false);return}let E=C.findIndex(O=>O.id===N.id);if(E===-1)return;let T=k==="up"?E-1:E+1;if(T<0||T>=C.length)return;let B=C[T];a(B.id,v);},[e,w,b,a]),x=useCallback(k=>{if(!m)return;let v=k.target;if(v.tagName==="INPUT"||v.tagName==="TEXTAREA"||v.isContentEditable||g.current){k.key==="Escape"&&(v.blur(),g.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?k.metaKey:k.ctrlKey,T=Array.from(t),B=w();if(k.key==="ArrowUp"){k.preventDefault(),f("up",k.shiftKey);return}if(k.key==="ArrowDown"){k.preventDefault(),f("down",k.shiftKey);return}if(B&&(k.key==="ArrowRight"||k.key==="ArrowLeft")){B.subtasks&&B.subtasks.length>0&&(k.preventDefault(),(k.key==="ArrowRight"&&!B.isExpanded||k.key==="ArrowLeft"&&B.isExpanded)&&c(B.id));return}if(k.altKey&&(k.key==="ArrowUp"||k.key==="ArrowDown")){T.length>0&&(k.preventDefault(),n(T,k.key==="ArrowUp"?"up":"down"));return}if(k.key==="Tab"&&!k.shiftKey){T.length>0&&(k.preventDefault(),d(T));return}if(k.key==="Tab"&&k.shiftKey){T.length>0&&(k.preventDefault(),p(T));return}if(k.key==="Enter"&&!k.shiftKey&&!E){B&&(k.preventDefault(),r(B.id,"below"));return}if(k.key==="Enter"&&k.shiftKey&&!E){B&&(k.preventDefault(),r(B.id,"above"));return}if(k.key==="Enter"&&E){B&&(k.preventDefault(),i(B.id));return}if(k.key==="F2"){B&&(k.preventDefault(),l(B.id));return}if(k.key==="Delete"||k.key==="Backspace"&&E){T.length>0&&(k.preventDefault(),o(T));return}if(k.key==="d"&&E&&!k.shiftKey){T.length>0&&(k.preventDefault(),s(T));return}},[m,t,w,f,r,o,s,n,d,p,l,c,i]);return useEffect(()=>{if(m)return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);}},[m,x]),{setIsEditing:h}}function Up(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(i=>{t(new Set([i])),r(i);},[]),s=useCallback(i=>{t(m=>{let g=new Set(m);return g.has(i)?g.delete(i):g.add(i),g}),r(i);},[]),n=useCallback((i,m)=>{if(!a){o(i);return}let g=m.indexOf(a),h=m.indexOf(i);if(g===-1||h===-1){o(i);return}let b=Math.min(g,h),w=Math.max(g,h),f=m.slice(b,w+1);t(new Set(f)),r(i);},[a,o]),d=useCallback((i,m,g,h)=>{h?n(i,m):g?s(i):o(i);},[o,s,n]),p=useCallback((i,m)=>{m?t(g=>{let h=new Set(g);return h.add(i),h}):o(i);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(i=>e.has(i),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:p,clearSelection:l,isTaskSelected:c}}function nd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?nd(t.subtasks):t.subtasks}))}function fn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((d,p)=>(d.position??0)-(p.position??0));for(let d=0;d<n.length;d++){let p={...n[d],parentId:o,level:s,position:n[d].position??d};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function ai(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ai(a.subtasks,t);if(r)return r}}return null}function od(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=od(a.subtasks,t);if(r)return r}return null}function sd(e,t){if(t.length===0)return e;let a=fn(e),r=t[0],o=a.findIndex(m=>m.id===r);if(o<=0)return e;let s=a[o-1],n=(m,g)=>{let h=[];return {tasks:m.filter(w=>{if(g.has(w.id))return h.push(w),false;if(w.subtasks){let f=n(w.subtasks,g);w.subtasks=f.tasks,h.push(...f.removed);}return true}),removed:h}},d=(m,g,h)=>m.map(b=>b.id===g?{...b,subtasks:[...b.subtasks||[],...h],isExpanded:true}:b.subtasks?{...b,subtasks:d(b.subtasks,g,h)}:b),p=new Set(t),{tasks:l,removed:c}=n(e,p),i=d(l,s.id,c);return nd(i)}function id(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=od(a,r);if(!o)continue;let s=od(a,o.id),n=(l,c,i)=>{for(let m=0;m<l.length;m++){let g=l[m];if(g.id===c&&g.subtasks){let h=g.subtasks.findIndex(b=>b.id===i);if(h!==-1){let[b]=g.subtasks.splice(h,1);return b}}if(g.subtasks){let h=n(g.subtasks,c,i);if(h)return h}}return null},d=(l,c,i)=>{let m=l.findIndex(g=>g.id===c);if(m!==-1)return l.splice(m+1,0,i),l;for(let g of l)g.subtasks&&d(g.subtasks,c,i);return l},p=n(a,o.id,r);p&&(s&&s.subtasks?d(s.subtasks,o.id,p):d(a,o.id,p));}return nd(a)}function ld(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,p)=>{let l=n.findIndex(i=>i.id===d);if(l===-1){for(let i of n)if(i.subtasks&&s(i.subtasks,d,p))return true;return false}let c=p==="up"?l-1:l+1;return c<0||c>=n.length?false:([n[l],n[c]]=[n[c],n[l]],n[l]={...n[l],position:l},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function dd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Kn(e,t){let a=[...e],r=[];for(let o of t){let s=(p,l)=>p.map((c,i)=>({...c,id:`${c.id}-copy-${Date.now()}-${i}`,parentId:l,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${i}`):void 0})),n=p=>{let l=p.findIndex(g=>g.id===o);if(l===-1){for(let g of p)if(g.subtasks){let h=n(g.subtasks);if(h)return h}return null}let c=p[l],i=`${c.id}-copy-${Date.now()}`,m={...c,id:i,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,i):void 0};return p.splice(l+1,0,m),m},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function Wp(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},d=p=>{let l=p.findIndex(i=>i.id===t);if(l===-1){for(let i of p)if(i.subtasks&&d(i.subtasks))return true;return false}let c=a==="above"?l:l+1;return p.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function cd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:cd(r.subtasks,t,a)}:r)}function ud(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:ud(a.subtasks,t)}:a)}function pd(e,t){let a=m=>{for(let g of m){if(g.id===t)return g;if(g.subtasks){let h=a(g.subtasks);if(h)return h}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,p=m=>{for(let g of m){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let h=p(g.subtasks);if(h>=0)return h}}return 0},l=p(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#2E94FF",position:l,parentId:t},i=m=>m.map(g=>{if(g.id===t){let h=g.subtasks||[];return {...g,subtasks:[...h,c],isExpanded:true}}return g.subtasks?{...g,subtasks:i(g.subtasks)}:g});return {tasks:i(e),newTask:c}}function Vp(e,t,a,r){if(t===a)return e;let o=ai(e,t);if(!o)return e;if(a){let d=(p,l)=>{if(!p.subtasks)return false;for(let c of p.subtasks)if(c.id===l||d(c,l))return true;return false};if(d(o,a))return e}let s=d=>{let p=d.filter(c=>c.id!==t),l=p.length<d.length;return p.map((c,i)=>{let m=l?{...c,position:i}:c;return m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m})},n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0}),n=n.map((p,l)=>({...p,position:l}));}else {let d=p=>p.map(l=>{if(l.id===a){let c=l.subtasks||[],i=r!==void 0?r:c.length,m=[...c];m.splice(i,0,{...o,parentId:a});let g=m.map((h,b)=>({...h,position:b}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:d(l.subtasks)}:l});n=d(n);}return n}function yr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=yr(t.subtasks),r=a.reduce((d,p)=>(p.startDate&&d.starts.push(new Date(p.startDate).getTime()),p.endDate&&d.ends.push(new Date(p.endDate).getTime()),d.progresses.push(p.progress??0),d),{starts:[],ends:[],progresses:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((d,p)=>d+p,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function oi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:p,scrollTop:l,columns:c,onToggleColumn:i,onColumnResize:m,onTaskUpdate:g,onTaskIndent:h,onTaskOutdent:b,onTaskMove:w,onMultiTaskDelete:f,onTaskDuplicate:x,onTaskCreate:k,onTaskRename:v,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:E,onTaskReparent:T,scrollContainerRef:B}){let O=useContext(un),[I,G]=useState(null),[S,ce]=useState(null),[M,q]=useState(""),ke=useRef(null),[_e,P]=useState(null),[V,re]=useState(0),[Te,$]=useState(0),[Z,X]=useState({isOpen:false,x:0,y:0,type:"header"}),[fe,Fe]=useState(null),[Ke,qe]=useState(null),[ot,ne]=useState(null),ut=useRef(0),Me=5,ct=useRef(false),[Dt,Tt]=useState(null),[xe,rt]=useState(false),Ye=useRef(null),[Je,H]=useState(null),[le,D]=useState(false),j=useRef(null);useEffect(()=>{function K(he){j.current&&!j.current.contains(he.target)&&D(false);}if(le)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[le]),useEffect(()=>{S&&ke.current&&(ke.current.focus(),ke.current.select());},[S]),useEffect(()=>{if(!_e)return;let K=ee=>{let y=ee.clientX-V,L=Te+y;m?.(_e,L);},he=()=>{P(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",K),document.addEventListener("mouseup",he),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",he),document.body.style.cursor="",document.body.style.userSelect="";}},[_e,V,Te,m]);let{selectedTaskIds:se,handleTaskClick:ye,isTaskSelected:W}=Up(),{setIsEditing:te}=Hp({tasks:e,selectedTaskIds:se,onTaskSelect:(K,he)=>{let y=fn(e).map(L=>L.id);ye(K,y,he||false,false);},onTaskCreate:k||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:w||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:b||(()=>{}),onTaskRename:K=>{let he=fn(e).find(ee=>ee.id===K);he&&it(he);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:K=>{let he=fn(e).find(ee=>ee.id===K);he&&N&&N(he);},enableKeyboard:true}),Oe=(K,he=0,ee="")=>{let y=[],L=[...K].sort((z,J)=>(z.position??0)-(J.position??0));for(let z=0;z<L.length;z++){let J=L[z],de=z+1,ge=ee?`${ee}.${de}`:`${de}.0`;if(J.wbsCode=ge,y.push({task:J,level:he}),J.subtasks&&J.subtasks.length>0&&J.isExpanded){let Y=ee?`${ee}.${de}`:`${de}`;y.push(...Oe(J.subtasks,he+1,Y));}}return y},Ce=Oe(e),He=48,Ne=Math.max(Ce.length*a,600-He),ze=K=>!K.startDate||!K.endDate?"-":`${Math.ceil((K.endDate.getTime()-K.startDate.getTime())/(1e3*60*60*24))}d`,it=K=>{ce(K.id),q(K.name),te(true);},st=K=>{M.trim()&&M!==e.find(he=>he.id===K)?.name&&v?.(K,M.trim()),ce(null),q(""),te(false);},nt=()=>{ce(null),q(""),te(false);},pt=(K,he)=>{he.stopPropagation(),C?.(K.id);},Rt=(K,he)=>{he.preventDefault(),ut.current=he.clientY,Fe(K),ct.current=false,rt(false),Tt({x:he.clientX,y:he.clientY});},Et=K=>{if(!fe||(Math.abs(K.clientY-ut.current)>Me&&!ct.current&&(ct.current=true,rt(true)),Tt({x:K.clientX,y:K.clientY}),!ct.current))return;if(B?.current){let z=B.current,J=z.getBoundingClientRect(),de=60,ge=12;Ye.current&&(cancelAnimationFrame(Ye.current),Ye.current=null);let Y=K.clientY-J.top,Re=J.bottom-K.clientY;if(Y<de&&z.scrollTop>0){let je=Math.round(ge*(1-Y/de)),gt=()=>{z.scrollTop-=je,ct.current&&z.scrollTop>0&&(Ye.current=requestAnimationFrame(gt));};Ye.current=requestAnimationFrame(gt);}else if(Re<de&&z.scrollTop<z.scrollHeight-z.clientHeight){let je=Math.round(ge*(1-Re/de)),gt=()=>{z.scrollTop+=je,ct.current&&z.scrollTop<z.scrollHeight-z.clientHeight&&(Ye.current=requestAnimationFrame(gt));};Ye.current=requestAnimationFrame(gt);}}let ee=document.querySelectorAll("[data-task-row]"),y=null,L=null;ee.forEach(z=>{let J=z.getBoundingClientRect(),de=z.getAttribute("data-task-row");if(de&&de!==fe&&K.clientY>=J.top&&K.clientY<=J.bottom){y=de;let ge=K.clientY-J.top,Y=J.height;ge<Y*.25?L="above":ge>Y*.75?L="below":L="child";}}),qe(y),ne(L);},dt=()=>{if(ct.current&&fe&&Ke&&ot){if(ot==="child")T?.(fe,Ke);else if(ot==="above"||ot==="below"){let K=(L,z,J=null)=>{for(let de of L){if(de.id===z)return J;if(de.subtasks){let ge=K(de.subtasks,z,de.id);if(ge!==void 0)return ge}}},he=K(e,fe,null),ee=K(e,Ke,null),y=(L,z,J,de)=>{let ge=L.findIndex(je=>je.id===z),Y=de?L.findIndex(je=>je.id===J):-1,Re=ot==="below"?ge+1:ge;return de&&Y!==-1&&Y<ge&&(Re-=1),Math.max(0,Re)};if(ee===null){let z=y(e,Ke,fe,he===null);T?.(fe,null,z);}else {let L=Ce.find(z=>z.task.id===ee)?.task;if(L?.subtasks){let z=he===ee,J=y(L.subtasks,Ke,fe,z);T?.(fe,ee,J);}}}}Ye.current&&(cancelAnimationFrame(Ye.current),Ye.current=null),Fe(null),qe(null),ne(null),Tt(null),ct.current=false,rt(false);};useEffect(()=>{if(fe)return document.addEventListener("mousemove",Et),document.addEventListener("mouseup",dt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Et),document.removeEventListener("mouseup",dt),document.body.style.cursor="",document.body.style.userSelect="";}},[fe,Ke,ot]);let mt=(K,he,ee)=>{let y=he.subtasks&&he.subtasks.length>0;switch(K.id){case "name":let L=S===he.id,z=I===he.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ee*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:z?1:.3},onMouseDown:Se=>Rt(he.id,Se),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),he.subtasks&&he.subtasks.length>0?jsx("button",{onClick:Se=>{Se.stopPropagation(),p?.(he.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:he.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"}),L?jsx("input",{ref:ke,type:"text",value:M,onChange:Se=>q(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"?st(he.id):Se.key==="Escape"&&nt();},onBlur:()=>st(he.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:Se=>Se.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1",style:{display:"inline-flex",alignItems:"baseline",gap:"6px",overflow:"hidden",color:he.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:he.parentId?"13px":"14px",fontWeight:he.isMilestone?600:he.parentId?400:600,letterSpacing:he.parentId?"0":"-0.01em"},title:he.name,children:[he.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:he.wbsCode}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:he.name})]}),z&&!L&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Se=>Se.stopPropagation(),children:[jsx("button",{onClick:Se=>pt(he,Se),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:Se=>{Se.stopPropagation(),it(he);},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 de=K.id==="startDate"?"startDate":"endDate",ge=he[de],Y=Je?.taskId===he.id&&Je?.field===de,Re=Se=>Se?(typeof Se=="string"?new Date(Se):Se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Se=>Se.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:y?.5:1,cursor:y?"default":"pointer"},title:y?"Auto-calculated from subtasks":void 0,onClick:Se=>{if(!y)if(Y)H(null);else {let ae=Se.currentTarget.getBoundingClientRect();H({taskId:he.id,field:de,month:ge?typeof ge=="string"?new Date(ge):ge:new Date,position:{top:ae.bottom+4,left:ae.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Re(ge)}),y&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Y&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>H(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:Je?.position.top,left:Je?.position.left},onClick:Se=>Se.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Se=new Date,ae=new Date(Se);ae.setDate(Se.getDate()+1);let me=new Date(Se);me.setDate(Se.getDate()+7);let Ge=new Date(Se);return Ge.setDate(Se.getDate()+14),[{label:"Hoy",date:Se},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:me},{label:"2 semanas",date:Ge}].map((ue,$e)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Xe=>Xe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Xe=>Xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[de]:ue.date}),H(null);},children:ue.label},$e))})(),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:Se=>Se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(he.id,{[de]:void 0}),H(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:()=>H(Se=>Se?{...Se,month:new Date(Se.month.getFullYear(),Se.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:Je?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>H(Se=>Se?{...Se,month:new Date(Se.month.getFullYear(),Se.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((Se,ae)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Se},ae))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Se=Je?.month||new Date,ae=Se.getFullYear(),me=Se.getMonth(),Ge=new Date(ae,me,1).getDay(),A=new Date(ae,me+1,0).getDate(),ue=new Date,$e=[];for(let ft=Ge-1;ft>=0;ft--)$e.push({day:new Date(ae,me,-ft).getDate(),date:new Date(ae,me-1,new Date(ae,me,-ft).getDate()),isCurrentMonth:false});for(let ft=1;ft<=A;ft++)$e.push({day:ft,date:new Date(ae,me,ft),isCurrentMonth:true});let Xe=42-$e.length;for(let ft=1;ft<=Xe;ft++)$e.push({day:ft,date:new Date(ae,me+1,ft),isCurrentMonth:false});return $e.map((ft,Va)=>{let Ta=ft.date.toDateString()===ue.toDateString(),xa=(ge?typeof ge=="string"?new Date(ge):ge:null)?.toDateString()===ft.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:ft.isCurrentMonth?xa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:xa?"#2E94FF":"transparent",boxShadow:Ta&&!xa?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(he.id,{[de]:ft.date}),H(null);},children:ft.day},Va)})})()})]})]})]}),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:ze(he)})});case "assignees":if(y)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 je=r.filter(Se=>he.assignees?.some(ae=>ae.name===Se.name||ae.initials===Se.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(Fo,{assignedUsers:je,availableUsers:r,onChange:Se=>{let ae=Se.map(me=>({id:me.id,name:me.name,initials:me.initials,color:me.color}));g?.(he.id,{assignees:ae.length>0?ae:void 0});}})});case "status":if(y){let Se=he.progress===100?"\u2713":he.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:Se})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(fu,{status:he.status||"todo",onChange:Se=>{g?.(he.id,{status:Se,progress:Se==="completed"?100:he.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:y?.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:`${he.progress}%`,backgroundColor:he.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:[he.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},St={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Yt=gt[he.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Se=>Se.stopPropagation(),children:jsx(So,{priority:Yt,onChange:Se=>{Se&&g?.(he.id,{priority:St[Se]||"medium"});}})});default:return null}},Nt=K=>[{id:"hide",label:"Hide Column",icon:jt.Hide,onClick:()=>i(K),disabled:K==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:jt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:jt.SortDesc,onClick:()=>{}}],Lt=K=>K.subtasks&&K.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{C?.(K.id);}},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{x?.([K.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{E?E(K.id,K.name):f?.([K.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:jt.Pencil,onClick:()=>{n?.(K);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{C?.(K.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:jt.MarkIncomplete,onClick:()=>{g?.(K.id,{status:"todo",progress:0});},disabled:K.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:jt.SetInProgress,onClick:()=>{g?.(K.id,{status:"in-progress"});},disabled:K.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:jt.MarkComplete,onClick:()=>{g?.(K.id,{status:"completed",progress:100});},disabled:K.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{x?.([K.id]);}},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:jt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{E?E(K.id,K.name):f?.([K.id]);}}],Ie=c.filter(K=>K.visible),Be=Ie.reduce((K,he)=>K+he.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Be},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${He}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ie.map((K,he)=>{let ee=he===Ie.length-1,y=K.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${y?"":"justify-center"}`,style:{width:`${K.width}px`,minWidth:`${K.minWidth??(y?200:60)}px`,maxWidth:`${K.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ee?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:L=>{L.preventDefault(),X({isOpen:true,x:L.clientX,y:L.clientY,type:"header",columnId:K.id});},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:L=>{L.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:K.label,children:K.label}),K.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:_e===K.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:L=>{L.preventDefault(),L.stopPropagation(),P(K.id),re(L.clientX),$(K.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},K.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(ti,{columns:c,onToggleColumn:i,theme:t}),jsx("button",{onClick:()=>D(!le),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"})}),le&&jsxs("div",{ref:j,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:K=>K.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:()=>D(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",style:{minHeight:Ne},children:Ce.map(({task:K,level:he},ee)=>{let y=W(K.id),L=Ke===K.id,z=L&&ot==="above",J=L&&ot==="below",de=L&&ot==="child",ge={};return de&&(ge.backgroundColor=`${t.accent}15`,ge.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":K.id,className:`flex items-center cursor-pointer group ${fe===K.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:y?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:y?t.accentLight:de?`${t.accent}15`:ee%2===0?t.bgPrimary:t.bgGrid,...ge},onMouseEnter:()=>G(K.id),onMouseLeave:()=>G(null),onClick:Y=>{let je=fn(e).map(Yt=>Yt.id),St=navigator.platform.toUpperCase().indexOf("MAC")>=0?Y.metaKey:Y.ctrlKey;ye(K.id,je,St,Y.shiftKey),s?.(K);},onDoubleClick:Y=>{Y.stopPropagation(),n?.(K);},onContextMenu:Y=>{Y.preventDefault(),X({isOpen:true,x:Y.clientX,y:Y.clientY,type:"task",task:K}),d?.(K,Y);},whileHover:{backgroundColor:y?t.accentLight:t.hoverBg},children:[z&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ie.map((Y,Re)=>{let je=Re===Ie.length-1,gt=Y.id==="name";return jsx("div",{className:`px-4 flex items-center ${gt?"justify-start":"justify-center"}`,style:{width:`${Y.width}px`,minWidth:`${Y.minWidth??(gt?200:60)}px`,maxWidth:`${Y.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:je?"none":`1px solid ${I===K.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:mt(Y,K,gt?he:0)},`${K.id}-${Y.id}`)})]},K.id)})}),jsx(gn,{isOpen:Z.isOpen,x:Z.x,y:Z.y,items:Z.type==="header"&&Z.columnId?Nt(Z.columnId):Z.type==="task"&&Z.task?Lt(Z.task):[],onClose:()=>X({...Z,isOpen:false}),theme:t}),xe&&Dt&&fe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Dt.x+12,top:Dt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let K=Ce.find(he=>he.task.id===fe)?.task;return K?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:K.name})}):null})()}),document.body)]})}function Yp(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[p,l]=useState(t),[c,i]=useState(null),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(0),[v,C]=useState(0),[N,E]=useState(null),[T,B]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:p,setGhostWidth:l,connectionLine:c,setConnectionLine:i,hoveredTaskId:m,setHoveredTaskId:g,activeZone:h,setActiveZone:b,draggedSegmentIndex:w,setDraggedSegmentIndex:f,draggedSegmentStartX:x,setDraggedSegmentStartX:k,segmentDragOffsetX:v,setSegmentDragOffsetX:C,hoveredSegmentIndex:N,setHoveredSegmentIndex:E,isHovered:T,setIsHovered:B,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ce,M)=>{r("none"),i(null),g(null),d(ce),l(M),C(0),f(null),k(0);}}}function ii({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:p,onDoubleClick:l,onContextMenu:c,onDateChange:i,onDependencyCreate:m,allTaskPositions:g=[],onDragMove:h,onHoverChange:b,showBaseline:w,showTaskBarLabels:f=true,showCriticalPath:x=true,readOnly:k=false}){let v=Yp(t,r),C=useRef(null),N=useRef(false),E=useRef(null),T=useRef(null),{dragMode:B,setDragMode:O,dragOffset:I,setDragOffset:G,ghostX:S,setGhostX:ce,ghostWidth:M,setGhostWidth:q,connectionLine:ke,setConnectionLine:_e,hoveredTaskId:P,setHoveredTaskId:V,activeZone:re,setActiveZone:Te,draggedSegmentIndex:$,setDraggedSegmentIndex:Z,draggedSegmentStartX:X,setDraggedSegmentStartX:fe,segmentDragOffsetX:Fe,setSegmentDragOffsetX:Ke,hoveredSegmentIndex:qe,setHoveredSegmentIndex:ot,isHovered:ne,setIsHovered:ut,isDragging:Me,isResizing:ct,isConnecting:Dt,resetDragState:Tt}=v,xe=18,rt=!!o.executionBarBg,Ye=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",Je=rt?3:6,H=e.subtasks&&e.subtasks.length>0,le=e.endDate&&(()=>{let ee=new Date;ee.setHours(0,0,0,0);let y=new Date(e.endDate);return y.setHours(0,0,0,0),y<ee})()&&e.progress<100,D=x&&e.isCriticalPath,j=o.name==="neutral"||o.today==="#1C1917",se=e.status==="completed"||e.progress===100,ye={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=x&&e.isCriticalPath||le?"#EF4444":e.color?e.color:e.priority&&ye[e.priority]?ye[e.priority]:o.taskBarPrimary,Oe=k?"default":Me?Dt?"crosshair":ct?"ew-resize":"grabbing":"grab",Ce=k?"default":"ew-resize",Ne=(ee=>ee>=80?20:ee>=60?15:ee>=50?12:10)(r),ze=r<50,it=r<40;useEffect(()=>{b&&(!ne||Me||e.segments)&&b(null);},[ne,Me,e.segments,b]);let st=ee=>ee.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let ee=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ee} day${ee!==1?"s":""}`},pt=ee=>Math.round(ee/s)*s,Rt=ee=>{let y=Math.round(ee/s),L=new Date(n);return L.setDate(L.getDate()+y),L},Et=(ee,y)=>{for(let L of g){if(L.id===e.id)continue;let z=5;if(ee>=L.x-z&&ee<=L.x+L.width+z&&y>=L.y-z&&y<=L.y+L.height+z)return L.id}return null},dt=useCallback((ee,y,L)=>{if(k)return;ee.preventDefault(),ee.stopPropagation();let z=C.current?.ownerSVGElement;if(!z)return;let J=z.createSVGPoint();J.x=ee.clientX,J.y=ee.clientY;let de=J.matrixTransform(z.getScreenCTM()?.inverse()),ge=L!==void 0?L:t,Y=y;if(!Y){let Re=de.x-ge;ee.shiftKey?(Y="connect",_e({x:t+r,y:a+xe/2})):ee.ctrlKey||ee.metaKey?Y="move":ee.altKey?Y=Re<r/2?"resize-start":"resize-end":it?Re<r/2?Y="move":Y="resize-end":ze?Re<=Ne/2?Y="resize-start":Re>=r-Ne/2?Y="resize-end":Y="move":Re<=Ne?Y="resize-start":Re>=r-Ne?Y="resize-end":Y="move";}N.current=false,O(Y),ut(false),Te(null),Y==="move"?G(de.x-ge):Y==="connect"?_e({x:t+r,y:a+xe/2}):G(0),ce(ge),q(r);},[t,r,a,xe,k]),mt=useCallback(ee=>{let y=C.current?.ownerSVGElement;if(!y)return;let L=y.closest(".gantt-timeline-scroll");if(!L)return;let z=L.getBoundingClientRect(),J=60,de=15,ge=0;if(ee.clientX<z.left+J){let Y=z.left+J-ee.clientX;ge=-Math.min(de,Y/2);}else if(ee.clientX>z.right-J){let Y=ee.clientX-(z.right-J);ge=Math.min(de,Y/2);}return ge!==0&&(L.scrollLeft+=ge),ge!==0},[]),Nt=useCallback(ee=>{if(B==="none")return;N.current=true,T.current=ee;let y=C.current?.ownerSVGElement;if(!y)return;if(B==="move"||B==="resize-start"||B==="resize-end"){let J=mt(ee);J&&!E.current?E.current=window.setInterval(()=>{T.current&&(mt(T.current),Nt(T.current));},16):!J&&E.current&&(window.clearInterval(E.current),E.current=null);}let L=y.createSVGPoint();L.x=ee.clientX,L.y=ee.clientY;let z=L.matrixTransform(y.getScreenCTM()?.inverse());if(B==="connect"){_e({x:z.x,y:z.y});let J=Et(z.x,z.y);V(J);}else if(B==="move"){let J=z.x-I,de=pt(J);ce(de),q(r);let ge=Math.round((de-t)/s);if(h?.(e.id,ge,true),e.segments&&e.segments.length>0&&$!==null){let Y=de-X;Ke(Y);}}else if(B==="resize-start"){let J=z.x,de=pt(J),ge=t+r-de;ge>=s&&(ce(de),q(ge));}else if(B==="resize-end"){let J=z.x,ge=pt(J)-t;ge>=s&&q(ge);}},[B,t,r,s,I,e,pt,$,X,Et,V,_e,ce,q,Ke,h,mt]),Lt=useCallback(()=>{if(E.current&&(window.clearInterval(E.current),E.current=null),T.current=null,B!=="none"){if(B==="connect")P&&m&&m(e,P),_e(null),V(null);else {let ee=e.endDate.getTime()-e.startDate.getTime(),y,L,z=true;if(B==="move"){if(y=Rt(S),L=new Date(y.getTime()+ee),e.segments&&e.segments.length>0&&$!==null){let J=Math.round(Fe/s),de=e.segments.map((je,gt)=>{if(gt===$){let St=new Date(je.startDate),Yt=new Date(je.endDate);return St.setDate(St.getDate()+J),Yt.setDate(Yt.getDate()+J),{startDate:St,endDate:Yt}}return je}),ge=de.flatMap(je=>[je.startDate,je.endDate]),Y=new Date(Math.min(...ge.map(je=>je.getTime()))),Re=new Date(Math.max(...ge.map(je=>je.getTime())));i?.({...e,segments:de},Y,Re),Tt(t,r);return}}else B==="resize-start"?(y=Rt(S),L=e.endDate,y>L&&(console.warn("Invalid date range: start date must be before or equal to end date"),z=false)):B==="resize-end"?(y=e.startDate,L=Rt(S+M),L.setDate(L.getDate()-1),L<y&&(console.warn("Invalid date range: end date must be after or equal to start date"),z=false)):z=false;z&&y&&L&&(L.getTime()<y.getTime()?console.warn("Invalid date range: end date cannot be before start date"):i?.(e,y,L));}h?.(e.id,0,false),Tt(t,r);}},[B,S,M,e,i,P,m,t,r,s,Rt,Fe,$,Tt,h]);useEffect(()=>{if(B==="none")return;let ee=L=>{Nt(L);},y=()=>{Lt();};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",y),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",y),E.current&&(window.clearInterval(E.current),E.current=null);}},[B,Nt,Lt]);let Ie=Me&&!Dt?S:t,Be=Me&&!Dt?M:r,K=d.taskClass(e);return jsxs("g",{ref:C,"data-task-bar":"true",onClick:()=>{!Me&&!N.current&&p?.(e),N.current=false;},onDoubleClick:ee=>{!Me&&!N.current&&(ee.stopPropagation(),l?.(e));},onContextMenu:ee=>{ee.preventDefault(),c?.(e,ee);},onMouseEnter:()=>!Me&&ut(true),onMouseMove:ee=>{b&&ne&&!Me&&!e.segments&&b({task:e,x:t,y:a,width:r,height:xe,showBelow:false,mouseX:ee.clientX,mouseY:ee.clientY});},onMouseLeave:()=>{Me||(ut(false),Te(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:xe,fill:"transparent",style:{pointerEvents:"all"}}),ne&&!Me&&!ze&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:xe,fill:re==="resize-start"?o.accent:"transparent",opacity:re==="resize-start"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-start"),onMouseDown:ee=>dt(ee,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:xe,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.1:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Te("move"),onMouseDown:ee=>dt(ee,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:xe,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.15:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-end"),onMouseDown:ee=>dt(ee,"resize-end")})]}),ne&&!Me&&it&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:xe,fill:re==="move"?o.accent:"transparent",opacity:re==="move"?.2:0,style:{cursor:k?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Te("move"),onMouseDown:ee=>dt(ee,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:xe,fill:re==="resize-end"?o.accent:"transparent",opacity:re==="resize-end"?.2:0,style:{cursor:Ce,pointerEvents:"all"},onMouseEnter:()=>Te("resize-end"),onMouseDown:ee=>dt(ee,"resize-end")}),ne&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+xe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Me&&!Dt&&!e.segments&&jsx(motion.rect,{x:S,y:a,width:M,height:xe,rx:Je,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),w&&e.baselineStartDate&&e.baselineEndDate&&!Me&&(()=>{let ee=e.baselineStartDate.getTime(),y=e.baselineEndDate.getTime(),L=n.getTime(),z=864e5,J=(ee-L)/z,de=(y-ee)/z,ge=J*s,Y=Math.max(de*s,s),Re=Ie+Be,je=ge+Y,gt=e.endDate?.getTime()??0,St=Math.ceil((gt-y)/z),Yt=St>0,Se=St<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:ge,y:a,width:Y,height:xe,rx:Je,fill:"none",stroke:Ye?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Yt&&Re>je&&jsx("rect",{x:je,y:a,width:Re-je,height:xe,rx:0,fill:"#EF4444",opacity:.2}),Yt&&jsxs("text",{x:Math.max(Re,je)+6,y:a+xe/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",St,"d"]}),Se&&jsxs("text",{x:Re+6,y:a+xe/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[St,"d"]})]})})(),!e.segments&&rt&&H&&(()=>{let y=a+(xe-6)/2,L=14,z=a+(xe-L)/2,J=2;return jsxs("g",{"data-task-class":K,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ie,y,width:Be,height:6,rx:1,fill:"rgba(255,255,255,0.12)"}),jsx("rect",{x:Ie,y:z,width:J,height:L,rx:.5,fill:"rgba(255,255,255,0.45)"}),jsx("rect",{x:Ie+Be-J,y:z,width:J,height:L,rx:.5,fill:"rgba(255,255,255,0.45)"})]})})(),!e.segments&&rt&&!H&&jsx(motion.rect,{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":K,initial:{opacity:0,scale:.95},animate:{opacity:Me&&!Dt?.15:e.parentId?.6:1,scale:ne&&!Me?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ee=>dt(ee),style:{cursor:Oe,pointerEvents:"all"}}),!e.segments&&!rt&&jsx(motion.rect,{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:te,"data-task-class":K,initial:{opacity:0,scale:.95},animate:{opacity:Me&&!Dt?.15:e.parentId?.6:ne?.9:.8,scale:ne&&!Me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:ee=>dt(ee),style:{cursor:H?"default":Oe,pointerEvents:"all"}}),rt&&(le||D)&&!e.segments&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&(rt&&H?null:jsx("rect",{x:Ie,y:a,width:Math.max(Be*(e.progress/100),Je*2),height:xe,rx:Je,fill:te,opacity:1,style:{pointerEvents:"none"}})),!e.segments&&!H&&e.progress<100&&(()=>{let ee=e.progress>0?Be*(e.progress/100):0,y=Ie+ee,L=Be-ee,z=e.progress===0?Je:0,J=e.progress===0?Ie:y,de=e.progress===0?Be:L;return jsxs(Fragment,{children:[jsx("rect",{x:J,y:a,width:de,height:xe,rx:z,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:J,y:a,width:de,height:xe,rx:z,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),rt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!Me&&(()=>{let ee=Ie+Be*(e.progress/100),y=8,L=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:ee,cy:a+xe/2,r:y,fill:L?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:ee,y:a+xe/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:L?.initials||L?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((ee,y)=>{let L=(ee.startDate.getTime()-n.getTime())/864e5*s,J=(ee.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-L+s,de=Me&&B==="move"&&$===y,ge=qe===y,Y=de?L+Fe:L;return jsxs("g",{onMouseEnter:()=>!Me&&ot(y),onMouseLeave:()=>!Me&&ot(null),children:[jsx(motion.rect,{x:Y,y:a,width:J,height:xe,rx:Je,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:de||e.parentId?.6:ge?.9:.8,scale:ge&&!Me?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Re=>{Re.stopPropagation(),Z(y),fe(L),dt(Re,void 0,L);},style:{cursor:Oe,pointerEvents:"all"}}),jsx("rect",{x:Y,y:a,width:J*(e.progress/100),height:xe,rx:Je,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${y}`)}),j&&(le||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!le&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),le&&jsx("rect",{x:Ie,y:a,width:Be,height:xe,rx:Je,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Be>60&&!e.segments&&!(rt&&H)&&(()=>{let ee=d.taskLabel(e),y=typeof ee=="string"?ee:e.name,L=y.length>Math.floor(Be/8)?`${y.substring(0,Math.floor(Be/8))}...`:y;return jsx("text",{x:Ie+8,y:a+xe/2,dominantBaseline:"middle",fill:se?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:se?"line-through":"none"},children:L})})(),!Me&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(rt?jsxs("text",{x:Ie+Be+6,y:a+xe/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Be>100?jsxs("text",{x:Ie+Be-12,y:a+xe/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&&Be>80&&!Me&&!e.segments&&!(rt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ie+Be-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ie+Be-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ne||ct)&&!Dt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ie-2,y:a,width:16,height:xe,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Te("resize-start"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"resize-start");}}),jsx(motion.rect,{x:Ie+4,y:a+8,width:3,height:xe-16,rx:1.5,fill:re==="resize-start"||B==="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:Ie+Be-14,y:a,width:16,height:xe,fill:"transparent",style:{cursor:Ce},onMouseEnter:()=>Te("resize-end"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"resize-end");}}),jsx(motion.rect,{x:Ie+Be-7,y:a+8,width:3,height:xe-16,rx:1.5,fill:re==="resize-end"||B==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ne&&!Me&&!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+xe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Te("connect"),onMouseLeave:()=>Te(null),onMouseDown:ee=>{ee.stopPropagation(),dt(ee,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+xe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:re==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Dt&&ke&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+xe/2,x2:ke.x,y2:ke.y,stroke:P?o.statusCompleted:o.accent,strokeWidth:P?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:P?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ke.x,cy:ke.y,r:P?8:6,fill:P?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),P&&jsx(motion.text,{x:ke.x+15,y:ke.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ke.x+10},animate:{opacity:1,x:ke.x+15},transition:{duration:.2},children:"Connect"})]}),(ne||Me)&&!Dt&&!e.segments&&jsx(motion.rect,{x:Ie-1,y:a-1,width:Be+2,height:xe+2,rx:Je+1,fill:"none",stroke:Me?o.accent:rt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:rt?1:2,opacity:Me||rt?.6:.4,initial:{opacity:0},animate:{opacity:Me||rt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ct&&jsxs(Fragment,{children:[jsx("line",{x1:S,y1:0,x2:S,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:S+M,y1:0,x2:S+M,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ne&&!Me&&!e.segments&&!b&&(()=>{let L=a<100,z=L?a+xe+13:a-82-13,J=L?`M ${Ie+Be/2-6} ${a+xe+3} L ${Ie+Be/2} ${a+xe+13} L ${Ie+Be/2+6} ${a+xe+3}`:`M ${Ie+Be/2-6} ${a-13} L ${Ie+Be/2} ${a-3} L ${Ie+Be/2+6} ${a-13}`,de=z+22,ge=z+40,Y=z+55,Re=z+70,je=L?z+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:L?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:L?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:J,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ie+Be/2-120,y:z,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ie+Be/2,y:de,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ie+Be/2-110,y:ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ie+Be/2-70,y:ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.startDate)}),jsx("text",{x:Ie+Be/2-110,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ie+Be/2-70,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:st(e.endDate)}),jsx("text",{x:Ie+Be/2+10,y:ge,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ie+Be/2+65,y:ge,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:Ie+Be/2+10,y:Y,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ie+Be/2+65,y:Y,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ie+Be/2-110,y:Re,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ie+Be/2-50,y:Re,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(gt=>gt.name).join(", ").substring(0,30),e.assignees.map(gt=>gt.name).join(", ").length>30?"...":""]})]}),!L&&jsx("text",{x:Ie+Be/2,y:je,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:it?"Left: move \u2022 Right: resize":ze?"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 md=260,bn=8,Jp=16,cv=-12;function Qp({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:x,mouseX:k,mouseY:v}=e,N=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null?155:105,E=k+Jp,T=v+cv-N;E+md>window.innerWidth-bn&&(E=k-md-Jp),E<bn&&(E=bn);let B=T<bn;B&&(T=v+20),T+N>window.innerHeight-bn&&(T=window.innerHeight-bn-N),o({left:E,top:T,showBelow:B});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,d={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"},p=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let x=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${x} d\xEDa${x!==1?"s":""}`:`${x} day${x!==1?"s":""}`},c=x=>{if(x==null||x===0)return "N/A";let k=Math.floor(x/60),v=x%60;return k===0?`${v}m`:v===0?`${k}h`:`${k}h ${v}m`},i=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",h=t.accent||"#3B82F6",b=t.bgSecondary||"#1F2937",w=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:md,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${w}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(li,{label:d.start,value:s.startDate?p(s.startDate):"N/A",labelColor:i,valueColor:m}),jsx(li,{label:d.duration,value:l(),labelColor:i,valueColor:m}),jsx(li,{label:d.end,value:s.endDate?p(s.endDate):"N/A",labelColor:i,valueColor:m}),jsx(li,{label:d.progress,value:`${s.progress}%`,labelColor:i,valueColor:m})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:i},children:[d.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:s.assignees.map(x=>x.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:c(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.logged,":"]})," ",jsx("span",{style:{color:h,fontWeight:600},children:c(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:i},children:[d.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:c(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return createPortal(f,document.body)}function ii({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 qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false,onHoverChange:p,hoverOverlayOnly:l=false}){let[,c]=useState(false),[i,m]=useState(null),g=r-t,h=g>0,b=Math.abs(g)<5,w=20,f=!b&&a<=e,x,k,v=a-e,C=e+v/2;if(k=C,n==="squared")if(b)x=`M ${e} ${t} L ${a} ${r}`;else if(f){let V=e+15,re=a-w,Te=h?t+20:t-20;k=re,x=`M ${e} ${t} L ${V} ${t} L ${V} ${Te} L ${re} ${Te} L ${re} ${r} L ${a} ${r}`;}else k=a-w,x=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`;else x=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let N=5,E=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,T=o.dependency,B=o.dependencyHover||T,O="#f87171",I="rgba(248, 113, 113, 0.15)",G=k,S=(t+r)/2;if(i)if(n==="squared")if(b)G=Math.max(e+10,Math.min(a-10,i.x)),S=t;else if(f){let P=e+15,V=a-w,re=h?t+20:t-20,Te=[[e,t,P,t],[P,t,P,re],[P,re,V,re],[V,re,V,r],[V,r,a,r]],$=1/0,Z={x:G,y:S};for(let X of Te){let fe=ce(i.x,i.y,X[0],X[1],X[2],X[3]),Fe=Math.hypot(i.x-fe.x,i.y-fe.y);Fe<$&&($=Fe,Z=fe);}G=Z.x,S=Z.y;}else {let P=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],V=1/0,re={x:G,y:S};for(let Te of P){let $=ce(i.x,i.y,Te[0],Te[1],Te[2],Te[3]),Z=Math.hypot(i.x-$.x,i.y-$.y);Z<V&&(V=Z,re=$);}G=re.x,S=re.y;}else {let P=C,V=t,re=C,Te=r,$=1/0,Z=G,X=S;for(let fe=0;fe<=1;fe+=.02){let Fe=1-fe,Ke=Fe*Fe*Fe*e+3*Fe*Fe*fe*P+3*Fe*fe*fe*re+fe*fe*fe*a,qe=Fe*Fe*Fe*t+3*Fe*Fe*fe*V+3*Fe*fe*fe*Te+fe*fe*fe*r,ot=Math.hypot(i.x-Ke,i.y-qe);ot<$&&($=ot,Z=Ke,X=qe);}G=Z,S=X;}function ce(P,V,re,Te,$,Z){let X=$-re,fe=Z-Te,Fe=X*X+fe*fe;if(Fe===0)return {x:re,y:Te};let Ke=((P-re)*X+(V-Te)*fe)/Fe;return Ke=Math.max(0,Math.min(1,Ke)),{x:re+Ke*X,y:Te+Ke*fe}}let M=P=>{let V=P.currentTarget.ownerSVGElement;if(!V)return;let re=V.getScreenCTM();if(!re)return;let Te=re.inverse();m({x:Te.a*P.clientX+Te.c*P.clientY+Te.e,y:Te.b*P.clientX+Te.d*P.clientY+Te.f});},q=()=>{c(false),m(null),p?.(false);},ke=()=>{c(true),p?.(true);},_e=P=>s?jsxs(motion.g,{initial:P,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:V=>{V.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:G,cy:S,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:G,cy:S,r:9,fill:I,stroke:O,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:G-3,y1:S-3,x2:G+3,y2:S+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:G+3,y1:S-3,x2:G-3,y2:S+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return d?jsxs("g",{"data-dependency-line":"true",onMouseLeave:q,onMouseMove:M,children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:B,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:B,opacity:.9,style:{pointerEvents:"none"}}),_e({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ke,onMouseLeave:q,onMouseMove:M,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:x,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:B,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:B,style:{pointerEvents:"none"}}),_e({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:ke,onMouseLeave:q,onMouseMove:M,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:x,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:E,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function ui({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),d=16,p=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,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-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+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:p(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 Ae={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 o=r.getDay();o!==0&&o!==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 o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,p=l=>{if(!n.has(l)){n.add(l),d.add(l);let c=r.get(l)||[];for(let i of c){if(!n.has(i)&&p(i))return true;if(d.has(i))return true}}return d.delete(l),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.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=Ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ae.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ae.findTaskById(e,o);if(s)a.unshift(s),o=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=Ae.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
130
+ `})]});return createPortal(f,document.body)}function li({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 qn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false,onHoverChange:p,hoverOverlayOnly:l=false}){let[,c]=useState(false),[i,m]=useState(null),g=r-t,h=g>0,b=Math.abs(g)<5,w=20,f=!b&&a<=e,x,k,v=a-e,C=e+v/2;if(k=C,n==="squared")if(b)x=`M ${e} ${t} L ${a} ${r}`;else if(f){let V=e+15,re=a-w,Te=h?t+20:t-20;k=re,x=`M ${e} ${t} L ${V} ${t} L ${V} ${Te} L ${re} ${Te} L ${re} ${r} L ${a} ${r}`;}else k=a-w,x=`M ${e} ${t} L ${k} ${t} L ${k} ${r} L ${a} ${r}`;else x=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let N=5,E=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,T=o.dependency,B=o.dependencyHover||T,O="#f87171",I="rgba(248, 113, 113, 0.15)",G=k,S=(t+r)/2;if(i)if(n==="squared")if(b)G=Math.max(e+10,Math.min(a-10,i.x)),S=t;else if(f){let P=e+15,V=a-w,re=h?t+20:t-20,Te=[[e,t,P,t],[P,t,P,re],[P,re,V,re],[V,re,V,r],[V,r,a,r]],$=1/0,Z={x:G,y:S};for(let X of Te){let fe=ce(i.x,i.y,X[0],X[1],X[2],X[3]),Fe=Math.hypot(i.x-fe.x,i.y-fe.y);Fe<$&&($=Fe,Z=fe);}G=Z.x,S=Z.y;}else {let P=[[e,t,k,t],[k,t,k,r],[k,r,a,r]],V=1/0,re={x:G,y:S};for(let Te of P){let $=ce(i.x,i.y,Te[0],Te[1],Te[2],Te[3]),Z=Math.hypot(i.x-$.x,i.y-$.y);Z<V&&(V=Z,re=$);}G=re.x,S=re.y;}else {let P=C,V=t,re=C,Te=r,$=1/0,Z=G,X=S;for(let fe=0;fe<=1;fe+=.02){let Fe=1-fe,Ke=Fe*Fe*Fe*e+3*Fe*Fe*fe*P+3*Fe*fe*fe*re+fe*fe*fe*a,qe=Fe*Fe*Fe*t+3*Fe*Fe*fe*V+3*Fe*fe*fe*Te+fe*fe*fe*r,ot=Math.hypot(i.x-Ke,i.y-qe);ot<$&&($=ot,Z=Ke,X=qe);}G=Z,S=X;}function ce(P,V,re,Te,$,Z){let X=$-re,fe=Z-Te,Fe=X*X+fe*fe;if(Fe===0)return {x:re,y:Te};let Ke=((P-re)*X+(V-Te)*fe)/Fe;return Ke=Math.max(0,Math.min(1,Ke)),{x:re+Ke*X,y:Te+Ke*fe}}let M=P=>{let V=P.currentTarget.ownerSVGElement;if(!V)return;let re=V.getScreenCTM();if(!re)return;let Te=re.inverse();m({x:Te.a*P.clientX+Te.c*P.clientY+Te.e,y:Te.b*P.clientX+Te.d*P.clientY+Te.f});},q=()=>{c(false),m(null),p?.(false);},ke=()=>{c(true),p?.(true);},_e=P=>s?jsxs(motion.g,{initial:P,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:V=>{V.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:G,cy:S,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:G,cy:S,r:9,fill:I,stroke:O,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:G-3,y1:S-3,x2:G+3,y2:S+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:G+3,y1:S-3,x2:G-3,y2:S+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return d?jsxs("g",{"data-dependency-line":"true",onMouseLeave:q,onMouseMove:M,children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:B,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:B,opacity:.9,style:{pointerEvents:"none"}}),_e({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ke,onMouseLeave:q,onMouseMove:M,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:x,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:x,fill:"none",stroke:B,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:B,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:B,style:{pointerEvents:"none"}}),_e({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:ke,onMouseLeave:q,onMouseMove:M,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:x,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:x,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:E,fill:"none",stroke:T,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function pi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),d=16,p=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,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-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+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:p(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 Ae={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 o=r.getDay();o!==0&&o!==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 o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=l=>{l.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,p=l=>{if(!n.has(l)){n.add(l),d.add(l);let c=r.get(l)||[];for(let i of c){if(!n.has(i)&&p(i))return true;if(d.has(i))return true}}return d.delete(l),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.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=Ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ae.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ae.findTaskById(e,o);if(s)a.unshift(s),o=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=Ae.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
131
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=Ae.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=Ae.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)=>Ae.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ae.findTaskById(e,t);return !a||!a.dependencies?[]:Ae.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ae.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ae.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 o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Ae.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ae.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'),o=new a,s=Ae.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],d=s.map(p=>{let l=p.startDate&&p.endDate?Ae.calculateDuration(p.startDate,p.endDate):0;return [p.name,p.startDate?Ae.formatDate(p.startDate):"N/A",p.endDate?Ae.formatDate(p.endDate):"N/A",l>0?`${l} days`:"N/A",`${p.progress}%`,p.status||"N/A"]});r(o,{head:n,body:d,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}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t)=>{let a=await import('xlsx'),r=Ae.flattenTasks(e),o=new Map,s=(c,i="")=>{[...c].sort((g,h)=>(g.position??0)-(h.position??0)).forEach((g,h)=>{let b=i?`${i}.${h+1}`:`${h+1}`;o.set(g.id,b),g.subtasks?.length&&s(g.subtasks,b);});};s(e);let n=r.map(c=>{let i=c.startDate&&c.endDate?Ae.calculateDuration(c.startDate,c.endDate):0,m=c.effortMinutes,g=c.timeLoggedMinutes,h=c.soldEffortMinutes;return {WBS:o.get(c.id)||"","Task Name":c.name,"Start Date":c.startDate?Ae.formatDate(c.startDate):"","End Date":c.endDate?Ae.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(b=>b.name).join(", ")||"","Estimated (h)":typeof m=="number"?+(m/60).toFixed(1):"","Logged (h)":typeof g=="number"?+(g/60).toFixed(1):"","Quoted (h)":typeof h=="number"?+(h/60).toFixed(1):"","Is Milestone":c.isMilestone?"Yes":"No"}}),d=a.utils.json_to_sheet(n),p=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},{wch:12}];d["!cols"]=p;let l=a.utils.book_new();if(a.utils.book_append_sheet(l,d,"Gantt Tasks"),!t){let c=new Date,i=g=>String(g).padStart(2,"0");t=`Project_${`${c.getFullYear()}-${i(c.getMonth()+1)}-${i(c.getDate())}_${i(c.getHours())}${i(c.getMinutes())}`}.xlsx`;}a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ae.flattenTasks(e),o=new Map;r.forEach((m,g)=>{o.set(m.id,g+1);});let s=m=>m.toISOString().replace("Z",""),n=Ae.getEarliestStartDate(e)||new Date,d=Ae.getLatestEndDate(e)||new Date,p=r.map((m,g)=>{let h=o.get(m.id),b=m.startDate&&m.endDate?Ae.calculateDuration(m.startDate,m.endDate):0,w=(m.dependencies||[]).filter(f=>o.has(f)).map(f=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${o.get(f)}</PredecessorUID>
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
358
358
  </Calendars>
359
359
  <Tasks>${p}
360
360
  </Tasks>
361
- </Project>`,c=new Blob([l],{type:"application/xml;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(c),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=Ae.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let c=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,i=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let h=t.find(b=>b.id===g);if(h){o(h);let b=r.get(g)?.ef||0;i=Math.max(i,b);}}let m=i+c;r.set(l.id,{es:i,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,d=l=>{if(n.has(l.id))return;let c=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,i=t.filter(h=>h.dependencies&&h.dependencies.includes(l.id)),m=s;if(i.length>0)for(let h of i){d(h);let b=n.get(h.id)?.ls||0;m=Math.min(m,b);}let g=m-c;n.set(l.id,{ls:g,lf:m});};a.forEach(d);let p=[];for(let l of a){let c=r.get(l.id),i=n.get(l.id);if(c&&i){let m=i.ls-c.es;Math.abs(m)<.01&&p.push(l.id);}}return p},calculateSlack:(e,t)=>{let a=Ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ae.calculateCriticalPath(e).includes(t))return 0;let o=Ae.getDependentTasks(e,t);if(o.length===0){let d=Ae.getLatestEndDate(e);if(!d)return null;let p=Ae.calculateDuration(a.endDate,d);return Math.max(0,p)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,p)=>d-p)[0];if(!s)return null;let n=Ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Ae.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ae.getDependentTasks(e,t);if(n.length===0)return e;let d=[...e];for(let p of n){if(o.has(p.id)||!p.startDate||!p.endDate)continue;let l=Ae.calculateDuration(p.startDate,p.endDate),c;if(a!==void 0?(c=new Date(p.startDate),c.setDate(c.getDate()+a)):(c=new Date(s.endDate),c.setDate(c.getDate()+1)),a!==void 0){let g=new Date(s.endDate),h=new Date(g);h.setDate(h.getDate()+1),c<h&&(c=h);}let i=Ae.calculateEndDate(c,l),m=g=>g.map(h=>h.id===p.id?{...h,startDate:c,endDate:i}:h.subtasks?{...h,subtasks:m(h.subtasks)}:h);d=m(d),d=Ae.autoScheduleDependents(d,p.id,a,o);}return d},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let p=[],l=o.getTime(),c=1e3*60*60*24,i=Ae.findTaskById(e,t);if(!i||!i.endDate)return [];let m=(g,h,b=new Set)=>{if(b.has(g))return;b.add(g);let w=Ae.getDependentTasks(e,g);for(let f of w){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(I=>I.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),C=(f.endDate.getTime()-k)/c,E=(k-l)/c*s,T=E+h*s,B=Math.max(C*s,s),O=d+x*n+(n-18)/2;p.push({taskId:f.id,taskName:f.name,originalX:E,previewX:T,width:B,y:O,rowIndex:x,daysDelta:h,color:f.color}),m(f.id,h,b);}};return m(t,a),p},splitTask:(e,t,a,r=3)=>{let o=Ae.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.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 n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],l=c=>c.map(i=>i.id===o.id?{...i,endDate:d,segments:p}:i.subtasks?{...i,subtasks:l(i.subtasks)}:i);return l(e)}};function mi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:p,dependencyLineStyle:l="curved",showTaskBarLabels:c=true,onTaskClick:i,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:h,onDependencyCreate:b,onDependencyDelete:w,showBaseline:f,showCriticalPath:x=true,showDependencies:k=true,highlightWeekends:v=true,canEditTask:C}){let E=Er(),T=useRef(null),[B,O]=useState([]),[I,G]=useState(null),[S,ce]=useState(null),[M,q]=useState(null),ke=useRef(false),[_e,P]=useState(new Set),[V,re]=useState(null),Te=useCallback(H=>{if(M&&!ke.current){let le=H.target,D=false;for(;le&&le!==H.currentTarget;){if(le.getAttribute?.("data-dependency-line")==="true"||le.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}le=le.parentElement;}D||q(null);}},[M]),$=useCallback(H=>{ce(H);},[]),Z=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),X=r==="day"?60:r==="week"?20:8,fe=Z*X*n,Fe=H=>{let le=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=le.getUTCDay()||7;le.setUTCDate(le.getUTCDate()+4-D);let j=new Date(Date.UTC(le.getUTCFullYear(),0,1));return Math.ceil(((le.getTime()-j.getTime())/864e5+1)/7)},Ke=H=>{let le=H.getDay();return le===0||le===6},qe=useCallback(H=>{let le=Math.round(H/(X*n)),D=new Date(o);return D.setDate(D.getDate()+le),D},[o,X,n]),ot=useCallback((H,le)=>{if(le.startDate&&le.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let j=D.createSVGPoint();j.x=H.clientX,j.y=H.clientY;let se=j.matrixTransform(D.getScreenCTM()?.inverse()),ye=qe(se.x),W=new Date(ye);W.setDate(W.getDate()+1),re(null),h?.(le,ye,W);},[qe,h]),ne=useCallback((H,le,D)=>{let j=H.currentTarget.ownerSVGElement;if(!j)return;let se=j.createSVGPoint();se.x=H.clientX,se.y=H.clientY;let ye=se.matrixTransform(j.getScreenCTM()?.inverse()),W=qe(ye.x),Oe=Math.round(ye.x/(X*n))*X*n;re({taskId:le.id,x:Oe,y:D*a+a/2,date:W});},[qe,X,n,a]),ut=useCallback(()=>{re(null);},[]),Me=useMemo(()=>{let H=se=>se.map(ye=>{if(ye.subtasks&&ye.subtasks.length>0){let W=H(ye.subtasks),te=W.filter(Oe=>Oe.startDate&&Oe.endDate);if(te.length>0){let Oe=te.map(ze=>ze.startDate.getTime()),Ce=te.map(ze=>ze.endDate.getTime()),He=new Date(Math.min(...Oe)),Ne=new Date(Math.max(...Ce));return {...ye,subtasks:W,startDate:He,endDate:Ne}}return {...ye,subtasks:W}}return ye}),le=(se,ye=[])=>{let W=[...se].sort((te,Oe)=>(te.position??0)-(Oe.position??0));for(let te of W)ye.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&le(te.subtasks,ye);return ye},D=H(e);return le(D)},[e]),ct=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let le=H.startDate.getTime(),D=H.endDate.getTime(),j=o.getTime(),se=(le-j)/(1e3*60*60*24),ye=(D-le)/(1e3*60*60*24)+1,W=se*X*n,te=Math.max(X*n,40),Oe=Math.max(ye*X*n,te);return {x:W,width:Oe}},[o,X,n]),Dt=useMemo(()=>Me.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:le,width:D}=ct(H),se=Me.findIndex(ye=>ye.id===H.id)*a+(a-18)/2;return {id:H.id,x:le,y:se,width:D,height:18}}),[Me,ct]),Tt=useCallback((H,le,D)=>{if(!D){O([]),G(null);return}if(G({taskId:H,daysDelta:le}),le===0){O([]);return}let j=Ae.calculateCascadePreview(e,H,le,Me,o,X*n,a,48);O(j);},[e,Me,o,X,n,a,48]),xe=useCallback((H,le)=>{if(!I)return le;let D=X*n,j=I.daysDelta*D;if(H===I.taskId)return {x:le.x+j,width:le.width};let se=B.find(ye=>ye.taskId===H);return se?{x:se.previewX,width:se.width}:le},[I,B,X,n]),rt=useMemo(()=>{let H=[],le=new Date(o);for(;le<=s;){let se=(le.getTime()-o.getTime())/864e5*X*n;if(r==="day")H.push({date:new Date(le),label:le.toLocaleDateString(d,{day:"numeric",month:"short"}),x:se}),le.setDate(le.getDate()+1);else if(r==="week"){let ye=Fe(le);H.push({date:new Date(le),label:`${E.labels.week} ${ye}`,x:se}),le.setDate(le.getDate()+7);}else H.push({date:new Date(le),label:le.toLocaleDateString(d,{month:"short",year:"numeric"}),x:se}),le.setMonth(le.getMonth()+1);}return H},[o,s,r,X,n,d,E.labels.week]),Ye=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*X*n,[o,X,n]),Je=Math.max(Me.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,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(fe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),rt.map((H,le)=>jsxs("g",{children:[le>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${le}`)),Ye>=0&&Ye<=fe&&jsxs("g",{children:[jsx("circle",{cx:Ye,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:Ye,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${Ye-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:E.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(fe,1e3),height:Je,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Te,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:"#2E94FF",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(fe,1e3),height:Je,fill:t.bgPrimary}),Me.map((H,le)=>jsx("rect",{x:0,y:le*a,width:Math.max(fe,1e3),height:a,fill:le%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),rt.map((H,le)=>le>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:Me.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${le}`):null),v&&rt.map((H,le)=>{let D=rt[le+1]?.x||fe;return Ke(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:D-H.x,height:Me.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:H.x,y:0,width:D-H.x,height:Me.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${le}`):null}),Me.map((H,le)=>{let D=H.startDate&&H.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:le*a,width:fe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>ot(j,H),onMouseMove:j=>ne(j,H,le),onMouseLeave:()=>{ut();}},`clickable-${H.id}`),V&&V.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:V.x,y1:le*a+4,x2:V.x,y2:le*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:V.x,cy:V.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:V.x,cy:V.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${V.x}, ${le*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:V.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!V||V.taskId!==H.id)&&jsx("text",{x:Ye>0?Ye:100,y:le*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),Me.map((H,le)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:j}=ct(H),se=le*a+(a-18)/2,ye=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(ui,{task:H,x:D+j/2,y:se+12,theme:t,onClick:i},H.id);if(ye){let te=se+(a-18)/2+8,Oe=1.5,Ce=6,He="rgba(255,255,255,0.25)";return jsxs("g",{onClick:()=>i?.(H),onContextMenu:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),g?.(H,Ne);},onMouseMove:Ne=>{$({task:H,x:D,y:te,width:j,height:2,showBelow:te<100,mouseX:Ne.clientX,mouseY:Ne.clientY});},onMouseLeave:()=>$(null),style:{cursor:"default"},children:[jsx("rect",{x:D,y:se,width:j,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:te,width:j,height:2,fill:He}),jsx("rect",{x:D,y:te,width:Oe,height:2+Ce,fill:He}),jsx("rect",{x:D+j-Oe,y:te,width:Oe,height:2+Ce,fill:He})]},H.id)}return jsx(si,{task:H,x:D,y:se,width:j,theme:t,dayWidth:X*n,startDate:o,templates:p,onClick:i,onDoubleClick:m,onContextMenu:g,onDateChange:h,onDependencyCreate:b,allTaskPositions:Dt,onDragMove:Tt,onHoverChange:$,showBaseline:f,showTaskBarLabels:c,showCriticalPath:x,readOnly:C?!C(H):false},H.id)}),k&&Me.map((H,le)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let j=Me.find(ze=>ze.id===D);if(!j||!j.startDate||!j.endDate)return null;let se=Me.findIndex(ze=>ze.id===D),ye=xe(j.id,ct(j)),W=xe(H.id,ct(H)),te=ye.x+ye.width,Oe=se*a+26,Ce=W.x,He=le*a+26,Ne=`dep-${D}-${H.id}`;return _e.has(Ne)?null:jsx(qn,{x1:te,y1:Oe,x2:Ce,y2:He,theme:t,lineStyle:l,onDelete:()=>w?.(H.id,D),onHoverChange:ze=>{ke.current=ze,ze&&q({key:Ne,fromId:D,toId:H.id,exitX:te,exitY:Oe,enterX:Ce,enterY:He});}},Ne)})),B.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),k&&M&&jsx(qn,{x1:M.exitX,y1:M.exitY,x2:M.enterX,y2:M.enterY,theme:t,lineStyle:l,onDelete:()=>{let H=M.key;q(null),ke.current=false,P(le=>new Set(le).add(H)),w?.(M.toId,M.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{ke.current=H,H||q(null);}},`${M.key}-hover-overlay`),Ye>=0&&Ye<=fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:Ye,y1:0,x2:Ye,y2:Je,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:Ye,y1:0,x2:Ye,y2:Je,stroke:t.today,strokeWidth:1,opacity:1})]})]}),S&&jsx(Jp,{tooltipData:S,theme:t,locale:d==="es"?"es":"en"})]})}var pv=['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"'],em=({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"})}),mv=()=>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"})}),gv=()=>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"})}),fv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),bv=()=>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 bi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:p}){let[l,c]=useState(false),[i,m]=useState(false),[g,h]=useState([]),[b,w]=useState(""),[f,x]=useState(false),[k,v]=useState(true),[C,N]=useState(""),[E,T]=useState(-1),[B,O]=useState(false),[I,G]=useState(0),S=useRef(null),ce=useRef(null),M=useRef(null),q=useRef(null),{enabled:ke=true,placeholder:_e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:V,suggestions:re=pv,maxHistory:Te=50,persistHistory:$,mentionableUsers:Z=[]}=a,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",fe=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Fe=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ke=X?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",qe=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",ot=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ut=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Me=X?"rgba(46, 148, 255, 0.9)":"#2E94FF",ct=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Dt=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Tt=X?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",xe=X?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",rt=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",Ye=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Je=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",le=X?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=X?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",j=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",se=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ye="rgba(46, 148, 255, 0.04)",W=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Oe=X?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ce=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=X?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ze=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",it=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",st="rgba(46, 148, 255, 0.06)",nt=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Rt=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",dt=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",mt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Nt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Lt=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ie=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",K=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",he=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ee=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",y=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",L=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",z=$?.storageKey||"gantt-ai-history",J=$?.maxMessages??5,de=Z.filter(ae=>{if(!C)return true;let me=C.toLowerCase();return ae.name.toLowerCase().includes(me)||ae.email&&ae.email.toLowerCase().includes(me)}).slice(0,5),ge=useCallback(ae=>{if(w(ae),Z.length===0)return;let me=S.current;if(!me)return;let Ge=me.selectionStart||ae.length,A=ae.slice(0,Ge),ue=A.lastIndexOf("@");if(ue>=0&&((ue>0?A[ue-1]:" ")===" "||ue===0)){let Xe=A.slice(ue+1);if(Xe.length<=40){N(Xe),T(ue),O(true),G(0);return}}O(false),N(""),T(-1);},[Z.length]),Y=useCallback(ae=>{let me=b.slice(0,E),Ge=b.slice(E+1+C.length),A=`${me}@${ae.name} ${Ge}`;w(A),O(false),N(""),T(-1),setTimeout(()=>S.current?.focus(),0);},[b,E,C]),Re=useCallback(ae=>{if(!B||de.length===0)return false;if(ae.key==="ArrowDown")return ae.preventDefault(),G(me=>me<de.length-1?me+1:0),true;if(ae.key==="ArrowUp")return ae.preventDefault(),G(me=>me>0?me-1:de.length-1),true;if(ae.key==="Enter"||ae.key==="Tab"){ae.preventDefault();let me=de[I];return me&&Y(me),true}return ae.key==="Escape"?(O(false),true):false},[B,de,I,Y]);useEffect(()=>{if($?.enabled)try{let ae=localStorage.getItem(z);if(ae){let Ge=JSON.parse(ae).map(A=>({...A,timestamp:new Date(A.timestamp)}));h(Ge.slice(-J));}}catch(ae){console.warn("[GanttAIAssistant] Failed to load persisted history:",ae);}},[$?.enabled,z,J]),useEffect(()=>{if($?.enabled&&g.length>0)try{let ae=g.filter(me=>!me.isLoading).slice(-J);localStorage.setItem(z,JSON.stringify(ae));}catch(ae){console.warn("[GanttAIAssistant] Failed to persist history:",ae);}},[g,$?.enabled,z,J]),useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!i&&S.current&&setTimeout(()=>S.current?.focus(),100);},[l,i]);let je=useCallback(ae=>{if(ae.success)switch(ae.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":ae.taskId&&ae.updates&&o?.(ae.taskId,ae.updates);break;case "create_task":ae.newTask&&s?.(ae.newTask);break;case "delete_task":ae.taskId&&n?.(ae.taskId);break;case "link_tasks":ae.dependencyFrom&&ae.dependencyTo&&d?.(ae.dependencyFrom,ae.dependencyTo);break;case "unlink_tasks":ae.taskId&&ae.dependencyFrom&&p?.(ae.taskId,ae.dependencyFrom);break}},[o,s,n,d,p]),gt=useCallback(async ae=>{if(!ae.trim()||f)return;let me={id:`user-${Date.now()}`,role:"user",content:ae,timestamp:new Date};h(A=>[...A.slice(-(Te-1)),me]),w(""),v(false),x(true);let Ge={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};h(A=>[...A,Ge]);try{if(V){let A=await V(ae,e);h(ue=>{let $e=ue.filter(ft=>!ft.isLoading),Xe={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...$e,Xe]}),je(A);}else h(A=>[...A.filter($e=>!$e.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(A){h(ue=>[...ue.filter(Xe=>!Xe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,Te,V,e,je]),St=ae=>{ae.preventDefault(),gt(b);},Yt=ae=>{w(ae),S.current?.focus();};if(useEffect(()=>{let ae=me=>{(me.metaKey||me.ctrlKey)&&me.key==="k"&&(me.preventDefault(),c(Ge=>!Ge),l||m(false)),me.key==="Escape"&&l&&c(false);};return document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)},[l]),useEffect(()=>{if(!l)return;let ae=Ge=>{let A=Ge.target;M.current&&!M.current.contains(A)&&c(false);},me=setTimeout(()=>{document.addEventListener("mousedown",ae);},100);return ()=>{clearTimeout(me),document.removeEventListener("mousedown",ae);}},[l]),!ke)return null;let Se={"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(It,{children:[jsx(AnimatePresence,{children:!l&&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 ${Se[P]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:fe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Fe}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ke,overflow:"visible"},onClick:()=>c(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(em,{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:Me,background:ne,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ut}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
361
+ </Project>`,c=new Blob([l],{type:"application/xml;charset=utf-8;"}),i=document.createElement("a");i.href=URL.createObjectURL(c),i.download=a,i.click(),URL.revokeObjectURL(i.href);},calculateCriticalPath:e=>{let t=Ae.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let c=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,i=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let h=t.find(b=>b.id===g);if(h){o(h);let b=r.get(g)?.ef||0;i=Math.max(i,b);}}let m=i+c;r.set(l.id,{es:i,ef:m});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,d=l=>{if(n.has(l.id))return;let c=l.startDate&&l.endDate?Ae.calculateDuration(l.startDate,l.endDate):0,i=t.filter(h=>h.dependencies&&h.dependencies.includes(l.id)),m=s;if(i.length>0)for(let h of i){d(h);let b=n.get(h.id)?.ls||0;m=Math.min(m,b);}let g=m-c;n.set(l.id,{ls:g,lf:m});};a.forEach(d);let p=[];for(let l of a){let c=r.get(l.id),i=n.get(l.id);if(c&&i){let m=i.ls-c.es;Math.abs(m)<.01&&p.push(l.id);}}return p},calculateSlack:(e,t)=>{let a=Ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ae.calculateCriticalPath(e).includes(t))return 0;let o=Ae.getDependentTasks(e,t);if(o.length===0){let d=Ae.getLatestEndDate(e);if(!d)return null;let p=Ae.calculateDuration(a.endDate,d);return Math.max(0,p)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,p)=>d-p)[0];if(!s)return null;let n=Ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Ae.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Ae.getDependentTasks(e,t);if(n.length===0)return e;let d=[...e];for(let p of n){if(o.has(p.id)||!p.startDate||!p.endDate)continue;let l=Ae.calculateDuration(p.startDate,p.endDate),c;if(a!==void 0?(c=new Date(p.startDate),c.setDate(c.getDate()+a)):(c=new Date(s.endDate),c.setDate(c.getDate()+1)),a!==void 0){let g=new Date(s.endDate),h=new Date(g);h.setDate(h.getDate()+1),c<h&&(c=h);}let i=Ae.calculateEndDate(c,l),m=g=>g.map(h=>h.id===p.id?{...h,startDate:c,endDate:i}:h.subtasks?{...h,subtasks:m(h.subtasks)}:h);d=m(d),d=Ae.autoScheduleDependents(d,p.id,a,o);}return d},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let p=[],l=o.getTime(),c=1e3*60*60*24,i=Ae.findTaskById(e,t);if(!i||!i.endDate)return [];let m=(g,h,b=new Set)=>{if(b.has(g))return;b.add(g);let w=Ae.getDependentTasks(e,g);for(let f of w){if(!f.startDate||!f.endDate)continue;let x=r.findIndex(I=>I.id===f.id);if(x===-1)continue;let k=f.startDate.getTime(),C=(f.endDate.getTime()-k)/c,E=(k-l)/c*s,T=E+h*s,B=Math.max(C*s,s),O=d+x*n+(n-18)/2;p.push({taskId:f.id,taskName:f.name,originalX:E,previewX:T,width:B,y:O,rowIndex:x,daysDelta:h,color:f.color}),m(f.id,h,b);}};return m(t,a),p},splitTask:(e,t,a,r=3)=>{let o=Ae.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.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 n=new Date(a);n.setDate(n.getDate()+r);let d=new Date(o.endDate);d.setDate(d.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],l=c=>c.map(i=>i.id===o.id?{...i,endDate:d,segments:p}:i.subtasks?{...i,subtasks:l(i.subtasks)}:i);return l(e)}};function gi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:p,dependencyLineStyle:l="curved",showTaskBarLabels:c=true,onTaskClick:i,onTaskDblClick:m,onTaskContextMenu:g,onTaskDateChange:h,onDependencyCreate:b,onDependencyDelete:w,showBaseline:f,showCriticalPath:x=true,showDependencies:k=true,highlightWeekends:v=true,canEditTask:C}){let E=Er(),T=useRef(null),[B,O]=useState([]),[I,G]=useState(null),[S,ce]=useState(null),[M,q]=useState(null),ke=useRef(false),[_e,P]=useState(new Set),[V,re]=useState(null),Te=useCallback(H=>{if(M&&!ke.current){let le=H.target,D=false;for(;le&&le!==H.currentTarget;){if(le.getAttribute?.("data-dependency-line")==="true"||le.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}le=le.parentElement;}D||q(null);}},[M]),$=useCallback(H=>{ce(H);},[]),Z=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),X=r==="day"?60:r==="week"?20:8,fe=Z*X*n,Fe=H=>{let le=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=le.getUTCDay()||7;le.setUTCDate(le.getUTCDate()+4-D);let j=new Date(Date.UTC(le.getUTCFullYear(),0,1));return Math.ceil(((le.getTime()-j.getTime())/864e5+1)/7)},Ke=H=>{let le=H.getDay();return le===0||le===6},qe=useCallback(H=>{let le=Math.round(H/(X*n)),D=new Date(o);return D.setDate(D.getDate()+le),D},[o,X,n]),ot=useCallback((H,le)=>{if(le.startDate&&le.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let j=D.createSVGPoint();j.x=H.clientX,j.y=H.clientY;let se=j.matrixTransform(D.getScreenCTM()?.inverse()),ye=qe(se.x),W=new Date(ye);W.setDate(W.getDate()+1),re(null),h?.(le,ye,W);},[qe,h]),ne=useCallback((H,le,D)=>{let j=H.currentTarget.ownerSVGElement;if(!j)return;let se=j.createSVGPoint();se.x=H.clientX,se.y=H.clientY;let ye=se.matrixTransform(j.getScreenCTM()?.inverse()),W=qe(ye.x),Oe=Math.round(ye.x/(X*n))*X*n;re({taskId:le.id,x:Oe,y:D*a+a/2,date:W});},[qe,X,n,a]),ut=useCallback(()=>{re(null);},[]),Me=useMemo(()=>{let H=se=>se.map(ye=>{if(ye.subtasks&&ye.subtasks.length>0){let W=H(ye.subtasks),te=W.filter(Oe=>Oe.startDate&&Oe.endDate);if(te.length>0){let Oe=te.map(ze=>ze.startDate.getTime()),Ce=te.map(ze=>ze.endDate.getTime()),He=new Date(Math.min(...Oe)),Ne=new Date(Math.max(...Ce));return {...ye,subtasks:W,startDate:He,endDate:Ne}}return {...ye,subtasks:W}}return ye}),le=(se,ye=[])=>{let W=[...se].sort((te,Oe)=>(te.position??0)-(Oe.position??0));for(let te of W)ye.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&le(te.subtasks,ye);return ye},D=H(e);return le(D)},[e]),ct=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let le=H.startDate.getTime(),D=H.endDate.getTime(),j=o.getTime(),se=(le-j)/(1e3*60*60*24),ye=(D-le)/(1e3*60*60*24)+1,W=se*X*n,te=Math.max(X*n,40),Oe=Math.max(ye*X*n,te);return {x:W,width:Oe}},[o,X,n]),Dt=useMemo(()=>Me.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:le,width:D}=ct(H),se=Me.findIndex(ye=>ye.id===H.id)*a+(a-18)/2;return {id:H.id,x:le,y:se,width:D,height:18}}),[Me,ct]),Tt=useCallback((H,le,D)=>{if(!D){O([]),G(null);return}if(G({taskId:H,daysDelta:le}),le===0){O([]);return}let j=Ae.calculateCascadePreview(e,H,le,Me,o,X*n,a,48);O(j);},[e,Me,o,X,n,a,48]),xe=useCallback((H,le)=>{if(!I)return le;let D=X*n,j=I.daysDelta*D;if(H===I.taskId)return {x:le.x+j,width:le.width};let se=B.find(ye=>ye.taskId===H);return se?{x:se.previewX,width:se.width}:le},[I,B,X,n]),rt=useMemo(()=>{let H=[],le=new Date(o);for(;le<=s;){let se=(le.getTime()-o.getTime())/864e5*X*n;if(r==="day")H.push({date:new Date(le),label:le.toLocaleDateString(d,{day:"numeric",month:"short"}),x:se}),le.setDate(le.getDate()+1);else if(r==="week"){let ye=Fe(le);H.push({date:new Date(le),label:`${E.labels.week} ${ye}`,x:se}),le.setDate(le.getDate()+7);}else H.push({date:new Date(le),label:le.toLocaleDateString(d,{month:"short",year:"numeric"}),x:se}),le.setMonth(le.getMonth()+1);}return H},[o,s,r,X,n,d,E.labels.week]),Ye=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*X*n,[o,X,n]),Je=Math.max(Me.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,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(fe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(fe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),rt.map((H,le)=>jsxs("g",{children:[le>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${le}`)),Ye>=0&&Ye<=fe&&jsxs("g",{children:[jsx("circle",{cx:Ye,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:Ye,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${Ye-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:E.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(fe,1e3),height:Je,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Te,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:"#2E94FF",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(fe,1e3),height:Je,fill:t.bgPrimary}),Me.map((H,le)=>jsx("rect",{x:0,y:le*a,width:Math.max(fe,1e3),height:a,fill:le%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),rt.map((H,le)=>le>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:Me.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${le}`):null),v&&rt.map((H,le)=>{let D=rt[le+1]?.x||fe;return Ke(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:D-H.x,height:Me.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:H.x,y:0,width:D-H.x,height:Me.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${le}`):null}),Me.map((H,le)=>{let D=H.startDate&&H.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:le*a,width:fe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:j=>ot(j,H),onMouseMove:j=>ne(j,H,le),onMouseLeave:()=>{ut();}},`clickable-${H.id}`),V&&V.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:V.x,y1:le*a+4,x2:V.x,y2:le*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:V.x,cy:V.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:V.x,cy:V.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${V.x}, ${le*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:V.date.toLocaleDateString(d==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!V||V.taskId!==H.id)&&jsx("text",{x:Ye>0?Ye:100,y:le*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),Me.map((H,le)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:j}=ct(H),se=le*a+(a-18)/2,ye=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(pi,{task:H,x:D+j/2,y:se+12,theme:t,onClick:i},H.id);if(ye){let te=se+(a-18)/2+8,Oe=1.5,Ce=6,He="rgba(255,255,255,0.25)";return jsxs("g",{onClick:()=>i?.(H),onContextMenu:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),g?.(H,Ne);},onMouseMove:Ne=>{$({task:H,x:D,y:te,width:j,height:2,showBelow:te<100,mouseX:Ne.clientX,mouseY:Ne.clientY});},onMouseLeave:()=>$(null),style:{cursor:"default"},children:[jsx("rect",{x:D,y:se,width:j,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:te,width:j,height:2,fill:He}),jsx("rect",{x:D,y:te,width:Oe,height:2+Ce,fill:He}),jsx("rect",{x:D+j-Oe,y:te,width:Oe,height:2+Ce,fill:He})]},H.id)}return jsx(ii,{task:H,x:D,y:se,width:j,theme:t,dayWidth:X*n,startDate:o,templates:p,onClick:i,onDoubleClick:m,onContextMenu:g,onDateChange:h,onDependencyCreate:b,allTaskPositions:Dt,onDragMove:Tt,onHoverChange:$,showBaseline:f,showTaskBarLabels:c,showCriticalPath:x,readOnly:C?!C(H):false},H.id)}),k&&Me.map((H,le)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let j=Me.find(ze=>ze.id===D);if(!j||!j.startDate||!j.endDate)return null;let se=Me.findIndex(ze=>ze.id===D),ye=xe(j.id,ct(j)),W=xe(H.id,ct(H)),te=ye.x+ye.width,Oe=se*a+26,Ce=W.x,He=le*a+26,Ne=`dep-${D}-${H.id}`;return _e.has(Ne)?null:jsx(qn,{x1:te,y1:Oe,x2:Ce,y2:He,theme:t,lineStyle:l,onDelete:()=>w?.(H.id,D),onHoverChange:ze=>{ke.current=ze,ze&&q({key:Ne,fromId:D,toId:H.id,exitX:te,exitY:Oe,enterX:Ce,enterY:He});}},Ne)})),B.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),k&&M&&jsx(qn,{x1:M.exitX,y1:M.exitY,x2:M.enterX,y2:M.enterY,theme:t,lineStyle:l,onDelete:()=>{let H=M.key;q(null),ke.current=false,P(le=>new Set(le).add(H)),w?.(M.toId,M.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{ke.current=H,H||q(null);}},`${M.key}-hover-overlay`),Ye>=0&&Ye<=fe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:Ye,y1:0,x2:Ye,y2:Je,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:Ye,y1:0,x2:Ye,y2:Je,stroke:t.today,strokeWidth:1,opacity:1})]})]}),S&&jsx(Qp,{tooltipData:S,theme:t,locale:d==="es"?"es":"en"})]})}var gv=['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"'],tm=({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"})}),fv=()=>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"})}),bv=()=>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"})}),hv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),yv=()=>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 hi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:p}){let[l,c]=useState(false),[i,m]=useState(false),[g,h]=useState([]),[b,w]=useState(""),[f,x]=useState(false),[k,v]=useState(true),[C,N]=useState(""),[E,T]=useState(-1),[B,O]=useState(false),[I,G]=useState(0),S=useRef(null),ce=useRef(null),M=useRef(null),q=useRef(null),{enabled:ke=true,placeholder:_e='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:P="bottom-right",onCommand:V,suggestions:re=gv,maxHistory:Te=50,persistHistory:$,mentionableUsers:Z=[]}=a,X=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",fe=X?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Fe=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",Ke=X?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",qe=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",ot=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=X?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",ut=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",Me=X?"rgba(46, 148, 255, 0.9)":"#2E94FF",ct=X?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Dt=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Tt=X?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",xe=X?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",rt=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",Ye=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",Je=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=X?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",le=X?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=X?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",j=X?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",se=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",ye="rgba(46, 148, 255, 0.04)",W=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=X?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Oe=X?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Ce=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",He=X?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=X?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ze=X?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",it=X?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",st="rgba(46, 148, 255, 0.06)",nt=X?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Rt=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Et=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",dt=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",mt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Nt=X?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Lt=X?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ie=X?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Be=X?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",K=X?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",he=X?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ee=X?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",y=X?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",L=X?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",z=$?.storageKey||"gantt-ai-history",J=$?.maxMessages??5,de=Z.filter(ae=>{if(!C)return true;let me=C.toLowerCase();return ae.name.toLowerCase().includes(me)||ae.email&&ae.email.toLowerCase().includes(me)}).slice(0,5),ge=useCallback(ae=>{if(w(ae),Z.length===0)return;let me=S.current;if(!me)return;let Ge=me.selectionStart||ae.length,A=ae.slice(0,Ge),ue=A.lastIndexOf("@");if(ue>=0&&((ue>0?A[ue-1]:" ")===" "||ue===0)){let Xe=A.slice(ue+1);if(Xe.length<=40){N(Xe),T(ue),O(true),G(0);return}}O(false),N(""),T(-1);},[Z.length]),Y=useCallback(ae=>{let me=b.slice(0,E),Ge=b.slice(E+1+C.length),A=`${me}@${ae.name} ${Ge}`;w(A),O(false),N(""),T(-1),setTimeout(()=>S.current?.focus(),0);},[b,E,C]),Re=useCallback(ae=>{if(!B||de.length===0)return false;if(ae.key==="ArrowDown")return ae.preventDefault(),G(me=>me<de.length-1?me+1:0),true;if(ae.key==="ArrowUp")return ae.preventDefault(),G(me=>me>0?me-1:de.length-1),true;if(ae.key==="Enter"||ae.key==="Tab"){ae.preventDefault();let me=de[I];return me&&Y(me),true}return ae.key==="Escape"?(O(false),true):false},[B,de,I,Y]);useEffect(()=>{if($?.enabled)try{let ae=localStorage.getItem(z);if(ae){let Ge=JSON.parse(ae).map(A=>({...A,timestamp:new Date(A.timestamp)}));h(Ge.slice(-J));}}catch(ae){console.warn("[GanttAIAssistant] Failed to load persisted history:",ae);}},[$?.enabled,z,J]),useEffect(()=>{if($?.enabled&&g.length>0)try{let ae=g.filter(me=>!me.isLoading).slice(-J);localStorage.setItem(z,JSON.stringify(ae));}catch(ae){console.warn("[GanttAIAssistant] Failed to persist history:",ae);}},[g,$?.enabled,z,J]),useEffect(()=>{ce.current&&ce.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!i&&S.current&&setTimeout(()=>S.current?.focus(),100);},[l,i]);let je=useCallback(ae=>{if(ae.success)switch(ae.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":ae.taskId&&ae.updates&&o?.(ae.taskId,ae.updates);break;case "create_task":ae.newTask&&s?.(ae.newTask);break;case "delete_task":ae.taskId&&n?.(ae.taskId);break;case "link_tasks":ae.dependencyFrom&&ae.dependencyTo&&d?.(ae.dependencyFrom,ae.dependencyTo);break;case "unlink_tasks":ae.taskId&&ae.dependencyFrom&&p?.(ae.taskId,ae.dependencyFrom);break}},[o,s,n,d,p]),gt=useCallback(async ae=>{if(!ae.trim()||f)return;let me={id:`user-${Date.now()}`,role:"user",content:ae,timestamp:new Date};h(A=>[...A.slice(-(Te-1)),me]),w(""),v(false),x(true);let Ge={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};h(A=>[...A,Ge]);try{if(V){let A=await V(ae,e);h(ue=>{let $e=ue.filter(ft=>!ft.isLoading),Xe={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...$e,Xe]}),je(A);}else h(A=>[...A.filter($e=>!$e.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(A){h(ue=>[...ue.filter(Xe=>!Xe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{x(false);}},[f,Te,V,e,je]),St=ae=>{ae.preventDefault(),gt(b);},Yt=ae=>{w(ae),S.current?.focus();};if(useEffect(()=>{let ae=me=>{(me.metaKey||me.ctrlKey)&&me.key==="k"&&(me.preventDefault(),c(Ge=>!Ge),l||m(false)),me.key==="Escape"&&l&&c(false);};return document.addEventListener("keydown",ae),()=>document.removeEventListener("keydown",ae)},[l]),useEffect(()=>{if(!l)return;let ae=Ge=>{let A=Ge.target;M.current&&!M.current.contains(A)&&c(false);},me=setTimeout(()=>{document.addEventListener("mousedown",ae);},100);return ()=>{clearTimeout(me),document.removeEventListener("mousedown",ae);}},[l]),!ke)return null;let Se={"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(It,{children:[jsx(AnimatePresence,{children:!l&&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 ${Se[P]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:fe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Fe}`,color:"#2E94FF",cursor:"pointer",boxShadow:Ke,overflow:"visible"},onClick:()=>c(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(tm,{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:Me,background:ne,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${ut}`},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:l&&jsxs(motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Se[P]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ct,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Dt}`,boxShadow:Tt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:xe,borderBottom:`1px solid ${rt}`},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:Ye,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsx(em,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(ae=>!ae),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:ae=>{ae.currentTarget.style.background=j,ae.currentTarget.style.color=D;},onMouseLeave:ae=>{ae.currentTarget.style.background="transparent",ae.currentTarget.style.color=le;},children:jsx(fv,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:ae=>{ae.currentTarget.style.background=j,ae.currentTarget.style.color=D;},onMouseLeave:ae=>{ae.currentTarget.style.background="transparent",ae.currentTarget.style.color=le;},children:jsx(gv,{})})]})]}),jsx(AnimatePresence,{children:!i&&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:[g.length===0&&k&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:se,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:re.slice(0,4).map((ae,me)=>jsx("button",{onClick:()=>Yt(ae),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ye,color:te,border:`1px solid ${W}`},onMouseEnter:Ge=>{Ge.currentTarget.style.borderColor=Oe,Ge.currentTarget.style.color="#2E94FF";},onMouseLeave:Ge=>{Ge.currentTarget.style.borderColor=W,Ge.currentTarget.style.color=te;},children:ae.length>30?ae.slice(0,30)+"...":ae},me))})]}),g.map(ae=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${ae.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${ae.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:ae.role==="user"?Ce:Ne,color:ae.role==="user"?"#2E94FF":it,border:ae.role==="user"?`1px solid ${He}`:`1px solid ${ze}`},children:[ae.isLoading?jsx(bv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:ae.content}),ae.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:ae.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:ae.command.success?"#10B981":"#EF4444",border:`1px solid ${ae.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[ae.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:ae.command.type.replace(/_/g," ")})]})]})},ae.id)),jsx("div",{ref:ce})]}),jsxs("form",{onSubmit:ae=>{if(B&&de.length>0){ae.preventDefault();return}St(ae);},className:"p-3 relative",style:{borderTop:`1px solid ${st}`},children:[jsx(AnimatePresence,{children:B&&de.length>0&&jsx(motion.div,{ref:q,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:Lt,border:`1px solid ${Ie}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:de.map((ae,me)=>jsxs("button",{type:"button",onClick:()=>Y(ae),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:me===I?K:"transparent",color:he},onMouseEnter:()=>G(me),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:y,border:`1px solid ${L}`,color:"#2E94FF"},children:ae.name.split(" ").map(Ge=>Ge[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:ae.name}),ae.email&&jsx("div",{className:"text-xs truncate",style:{color:ee},children:ae.email})]})]},ae.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${pt}`},children:[jsx("input",{ref:S,type:"text",value:b,onChange:ae=>ge(ae.target.value),onKeyDown:ae=>{Re(ae);},placeholder:_e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Rt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Et:"transparent",color:b.trim()?"#2E94FF":mt,border:b.trim()?`1px solid ${dt}`:"1px solid transparent"},children:jsx(mv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Nt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function tm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,c=true)=>{r(i=>{let m=typeof l=="function"?l(i.present):l;if(o.current)return {...i,present:m};if(!c)return {...i,present:m};let g=[...i.past,i.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let c=l.past[l.past.length-1],i=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:c,future:[l.present,...l.future]}});},[]),d=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let c=l.future[0],i=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:c,future:i}});},[]),p=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function am({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=d?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&p&&n.key==="y"){n.preventDefault(),t();return}if(d&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var vv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ae.formatDate(e.startDate)} - ${Ae.formatDate(e.endDate)}`);let a=Ae.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=>Ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function rm(e){return {...vv,...e}}var Ev=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},sm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:p=true,showExportButton:l=true,projectName:c,availableUsers:i=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:h,persistFilter:b,clearFiltersKey:w,aiAssistant:f,locale:x="en",customTranslations:k,showCreateTaskButton:v=false,createTaskLabel:C,onCreateTask:N,taskFilter:E,onTaskFilterChange:T,toolbarRightContent:B,showBaseline:O,viewMode:I,onViewModeChange:G,projectForecast:S,onThemeChange:ce,onTaskClick:M,onTaskDblClick:q,onTaskContextMenu:ke,onTaskUpdate:_e,onDependentTasksScheduled:P,onProgressChange:V,onTaskEdit:re,onTaskAddSubtask:Te,onTaskMarkIncomplete:$,onTaskSetInProgress:Z,onDependencyCreate:X,onDependencyDelete:fe,onBeforeTaskAdd:Fe,onAfterTaskAdd:Ke,onBeforeTaskUpdate:qe,onAfterTaskUpdate:ot,onBeforeTaskDelete:ne,onAfterTaskDelete:ut,permissions:Me,onCopySnapshotLink:ct}=a,Tt=useContext(Ys)?.theme,[xe,rt]=useState(Tt||s||"dark"),[Ye,Je]=useState(n),[H,le]=useState(d),[D,j]=useState(1),[se,ye]=useState("all"),[W,te]=useState(I||"execution"),Oe=I??W,Ce=useCallback(F=>{te(F),G?.(F);},[G]),He=O??Oe==="oracle",[Ne,ze]=useState(a.showCriticalPath!==false),[it,st]=useState(a.showDependencies!==false),[nt,pt]=useState(a.highlightWeekends!==false),Rt=useCallback(F=>{ze(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Et=useCallback(F=>{st(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),dt=useCallback(F=>{pt(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Ye);},[Ye]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let mt=useRef(a.onDateRangeChange);mt.current=a.onDateRangeChange;let Nt=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Lt,Ie]=useState(()=>{if(!b)return "all";try{let F=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Be=E??Lt,K=T??Ie,[he,ee]=useState(()=>{if(!b)return false;try{let F=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=Nt();if(F)try{let R={taskFilter:Be,hideCompleted:he};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,he,Nt]);let y=useRef(w);useEffect(()=>{if(y.current!==w&&w!==void 0){Ie("all"),ee(false);let F=Nt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}y.current=w;},[w,Nt]);let[L,z]=useState(0),[J,de]=useState(false),[ge,Y]=useState(null),[Re,je]=useState({isOpen:false,x:0,y:0,task:null}),[gt,St]=useState(null),[Yt,Se]=useState(null);useEffect(()=>{Tt&&Tt!==xe&&rt(Tt);},[Tt]),useEffect(()=>{s&&s!==xe&&rt(s);},[s]);let ae=useCallback(F=>{rt(F),ce?.(F);},[ce]),{state:me,setState:Ge,undo:A,redo:ue,canUndo:$e,canRedo:Xe,clearHistory:ft}=tm(t,50),Va=useMemo(()=>{let F=(R,_=0)=>{let Q=_;for(let we of R)we.subtasks?.length&&(Q=Math.max(Q,F(we.subtasks,_+1)));return Q};return F(me)+1},[me]),Ta=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Ua=useRef(new Map),xa=useRef(false);if(!xa.current&&h){xa.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Ua.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ia=useCallback(()=>{let F=Ta();if(F)try{let R=Array.from(Ua.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ta]),ir=useRef(0),Cc=useRef(me);useEffect(()=>{Cc.current=me;},[me]);let _o=useRef(false),Tc=useCallback(F=>{ye(F),ir.current+=1,Ge(R=>{let _=(we,Pe=0)=>we.map(bt=>{let Ze=F==="all"||Pe<F-1;return bt.subtasks?.length&&Ua.current.set(bt.id,Ze),{...bt,isExpanded:Ze,subtasks:bt.subtasks?_(bt.subtasks,Pe+1):void 0}}),Q=_(R);return Ia(),Q});},[Ge,Ia]);useEffect(()=>{if(ir.current>0){ir.current-=1;return}let F=_=>{let Q=new Map;for(let we of _){let Pe=we.id;Q.get(Pe)||Q.set(Pe,we);}return Array.from(Q.values())},R=_=>_.map(Q=>{let we=Ua.current.get(Q.id),Pe=we!==void 0?{...Q,isExpanded:we}:Q;if(Pe.subtasks?.length){let bt=F(Pe.subtasks);return {...Pe,subtasks:R(bt)}}return Pe});if(Ua.current.size>0)Ge(yr(R(t)));else {let _=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:F(_(we.subtasks))}:we);Ge(yr(_(t)));}},[t,Ge]);let gs=useRef(t),Nc=useRef(true);useEffect(()=>{if(Nc.current){Nc.current=false,gs.current=me;return}if(_o.current){_o.current=false,gs.current=me;return}if(!r)return;let F=JSON.stringify(gs.current),R=JSON.stringify(me);F!==R&&(gs.current=me,r(me));},[me,r]);let Ga=useMemo(()=>td(x,k),[x,k]),O0=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[jo,Gi]=useState(()=>O0(Ga));useEffect(()=>{Gi(F=>F.map(R=>({...R,label:Ga.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ga]);let fs=useMemo(()=>jo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[jo]),Dc=useRef(jo.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=jo.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),_=Dc.current;if(R!==_){let Q=F.some(Pe=>Pe.id!=="name"),we=_.includes(",");Q?!we&&Q&&Y(null):Y(null),Dc.current=R;}},[jo]);let Sc=60,Ec=.6,$0=useMemo(()=>{let R=fs+Sc,_=typeof window<"u"?window.innerWidth*Ec:800,Q=Math.max(R,_);return ge!==null?Math.max(200,Math.min(ge,Q)):Math.max(200,R)},[ge,fs]),ro=useRef(null),bs=useRef(null),Ir=useRef(null),En=useRef(null),Qt=useMemo(()=>Tp(xe),[xe]),H0=useMemo(()=>({theme:Qt,themeName:xe}),[Qt,xe]),Fc=useMemo(()=>rm(m),[m]),_i=useMemo(()=>{if(!g)return me;let F=Ae.calculateCriticalPath(me),R=_=>_.map(Q=>({...Q,isCriticalPath:F.includes(Q.id),subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(me)},[me,g]),Pc=useMemo(()=>{if(Be==="all"&&!he)return _i;let F=R=>{let _=[];for(let Q of R){let we=Q.subtasks?.length?F(Q.subtasks):void 0,Pe=false;if(he)Pe=Q.progress<100;else switch(Be){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||we&&we.length>0)&&_.push({...Q,subtasks:we});}return _};return F(_i)},[_i,Be,he]),hs=Ev(H);am({undo:A,redo:ue,canUndo:$e,canRedo:Xe,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Ae.findTaskById(me,F),addTask:(F,R)=>{Ge(_=>{if(!R)return [..._,{...F,level:0}];let Q=we=>we.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...F,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},updateTask:(F,R)=>{Ge(_=>{let Q=we=>we.map(Pe=>Pe.id===F?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},deleteTask:F=>{Ge(R=>{let _=Q=>Q.filter(we=>we.id===F?false:(we.subtasks&&(we.subtasks=_(we.subtasks)),true));return _(R)});},deleteTasks:F=>{Ge(R=>ld(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Ae.findTaskById(me,F);R&&a.onTaskDuplicate(R);}else Ge(R=>Kn(R,[F]).tasks);},splitTask:(F,R,_=3)=>{Ge(Q=>Ae.splitTask(Q,F,R,_));},calculateEndDate:Ae.calculateEndDate,calculateDuration:Ae.calculateDuration,validateDependency:(F,R)=>!Ae.validateDependencies(me,F,R),getAllTasks:()=>Ae.flattenTasks(me),getTasksByStatus:F=>Ae.flattenTasks(me).filter(R=>R.status===F),getTasksByParent:F=>F?Ae.findTaskById(me,F)?.subtasks||[]:me.filter(_=>!_.parentId),getCriticalPath:()=>Ae.flattenTasks(me).filter(F=>F.isCriticalPath),indentTask:F=>{Ge(R=>yr(nd(R,[F])));},outdentTask:F=>{Ge(R=>yr(sd(R,[F])));},moveTask:(F,R)=>{Ge(_=>id(_,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:_}=ud(me,F);if(Fe){let Q=Fe({..._,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}Ge(yr(R)),Ke&&Ke({..._,parentId:F});},scrollToTask:F=>{let _=Ae.flattenTasks(me).findIndex(Q=>Q.id===F);if(_!==-1&&ro.current){let Q=_*hs;ro.current.scrollTo({top:Q,behavior:"smooth"}),Ir.current&&Ir.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{Ge(R=>{let _=Q=>Q.map(we=>we.id===F?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:_(we.subtasks)}:we);return _(R)});},collapseTask:F=>{Ge(R=>{let _=Q=>Q.map(we=>we.id===F?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:_(we.subtasks)}:we);return _(R)});},expandAll:()=>{Ge(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{Ge(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Tc(F);},undo:A,redo:ue,canUndo:()=>$e,canRedo:()=>Xe,clearHistory:ft,exportToPNG:async()=>{if(!En.current||!ro.current||!Ir.current)throw new Error("Gantt container not found");let F=En.current,R=ro.current,_=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Ir.current,we=_?.scrollTop||0,Pe=Q.scrollTop,bt=F.style.overflow,Ze=F.style.height,Ea=R.style.overflow;try{let Ot=_?.querySelector(".gantt-taskgrid-content"),qt=Q.querySelector("svg"),Wa=Ot?.scrollHeight||_?.scrollHeight||600,lr=qt?.getBoundingClientRect().height||Q.scrollHeight,No=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Wa,lr)+20;_&&(_.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${No}px`,R.style.overflow="visible",await new Promise(Jo=>setTimeout(Jo,100));let Br=await toPng(F,{backgroundColor:Qt.bgPrimary,pixelRatio:2,filter:Jo=>{if(!(Jo instanceof Element))return !0;let ys=window.getComputedStyle(Jo),Pn=parseInt(ys.zIndex,10);return (isNaN(Pn)||Pn<50)&&ys.position!=="fixed"}});return await(await fetch(Br)).blob()}finally{F.style.overflow=bt,F.style.height=Ze,R.style.overflow=Ea,_&&(_.scrollTop=we),Q.scrollTop=Pe;}},exportToPDF:async F=>{await Ae.exportToPDF(me,F);},exportToExcel:async F=>{await Ae.exportToExcel(me,F);},exportToJSON:()=>Ae.exportToJSON(me),exportToCSV:()=>Ae.exportToCSV(me),importFromJSON:F=>{let R=Ae.importFromJSON(F);Ge(R);},getTasks:()=>me,refresh:()=>{Ge(F=>[...F]);},clearAll:()=>{Ge([]);}}),[me,A,ue,$e,Xe,ft,Qt,hs]);let z0=useCallback(F=>{Gi(R=>R.map(_=>_.id===F?{..._,visible:!_.visible}:_));},[]),U0=useCallback((F,R)=>{Gi(_=>_.map(Q=>{if(Q.id!==F)return Q;let we=Q.minWidth??100,Pe=Q.maxWidth??800,bt=Math.max(we,Math.min(Pe,R));return {...Q,width:bt}}));},[]),W0=useCallback(F=>{Ge(R=>{let _=cd(R,F),Q=we=>{for(let Pe of we){if(Pe.id===F){Ua.current.set(F,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(_),Ia(),_}),a.onTaskToggleExpand?.(F);},[a,Ia]),Ko=useCallback((F,R)=>{if(qe&&qe(F,R)===false)return;let Q=Ae.findTaskById(me,F)?.progress,we=bt=>bt.map(Ze=>Ze.id===F?{...Ze,...R}:Ze.subtasks?{...Ze,subtasks:we(Ze.subtasks)}:Ze);Ge(we(me));let Pe=Ae.findTaskById(we(me),F);Pe&&(_e?.(Pe),ot?.(Pe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&V?.(F,Q,R.progress));},[me,_e,qe,ot,V]),V0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(R=>yr(nd(R,F))),a.onTaskIndent?.(F[0]));},[a]),G0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(R=>yr(sd(R,F))),a.onTaskOutdent?.(F[0]));},[a]),_0=useCallback((F,R,_)=>{ir.current+=1,_o.current=true,Ge(Q=>yr(Wp(Q,F,R,_))),a.onTaskReparent?.(F,R,_);},[a]),j0=useCallback((F,R)=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(_=>id(_,F,R)),a.onTaskMove?.(F[0],R));},[a]),ji=useCallback(async F=>{let R=[];for(let _ of F)ne&&await Promise.resolve(ne(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(Ge(_=>yr(ld(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),ut&&R.forEach(_=>ut(_)));},[a,ne,ut]),K0=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let _=Ae.findTaskById(me,R);_&&a.onTaskDuplicate(_);}):Ge(R=>Kn(R,F).tasks);},[a,me]),Y0=useCallback((F,R)=>{Ge(_=>{let{tasks:Q,newTask:we}=Up(_,F,R);return Fe&&Fe(we)===false?_:(a.onTaskCreate?.(we.parentId,we.position||0),Ke?.(we),Q)});},[a,Fe,Ke]),q0=useCallback((F,R)=>{Ge(_=>dd(_,F,R)),a.onTaskRename?.(F,R);},[a]),Ki=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let _=ti(me,F);if(_){R(_);return}}Ge(_=>{let{tasks:Q}=ud(_,F);return a.onTaskCreate?.(F,0),Q});},[a,me]),X0=useCallback((F,R,_)=>{let Q=!F.startDate&&!F.endDate,we=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Pe=Ot=>Ot.map(qt=>qt.id===F.id?{...qt,startDate:R,endDate:_,...F.segments&&{segments:F.segments}}:qt.subtasks?{...qt,subtasks:Pe(qt.subtasks)}:qt),bt=Pe(me),Ze=bt;bt=Ae.autoScheduleDependents(bt,F.id,we),bt=yr(bt),Ge(bt);let Ea={...F,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,_):_e?.(Ea),P&&we!==0){let Ot=Ae.flattenTasks(Ze),qt=Ae.flattenTasks(bt),Wa=[];for(let lr of qt){if(lr.id===F.id)continue;let oo=Ot.find(Br=>Br.id===lr.id);if(!oo)continue;let Xo=lr.startDate?.getTime()!==oo.startDate?.getTime(),No=lr.endDate?.getTime()!==oo.endDate?.getTime();(Xo||No)&&Wa.push(lr);}Wa.length>0&&P(Wa);}},[me,_e,P,a]),J0=useCallback((F,R)=>{ke?.(F,R),je({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[ke]),Q0=useCallback((F,R)=>{let _=Ae.splitTask(me,F.id,R);Ge(_),je({isOpen:false,x:0,y:0,task:null});},[me]),Mc=useCallback(F=>{let R=Ae.findTaskById(me,F.id)||F;q?.(R),re||St(R);},[me,q,re]),Ac=useCallback((F,R,_)=>{let Q=new Map,we=Ot=>{Ot.forEach(qt=>{qt.dependencies&&Q.set(qt.id,qt.dependencies),qt.subtasks&&we(qt.subtasks);});};we(_);let Pe=Q.get(R)||[];Q.set(R,[...Pe,F]);let bt=new Set,Ze=new Set,Ea=Ot=>{if(!bt.has(Ot)){bt.add(Ot),Ze.add(Ot);let qt=Q.get(Ot)||[];for(let Wa of qt){if(!bt.has(Wa)&&Ea(Wa))return true;if(Ze.has(Wa))return true}}return Ze.delete(Ot),false};return Ea(R)},[]),Lc=useCallback((F,R)=>{if(Ac(F.id,R,Cc.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:l&&jsxs(motion.div,{ref:M,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:i?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Se[P]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ct,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Dt}`,boxShadow:Tt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:xe,borderBottom:`1px solid ${rt}`},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:Ye,border:`1px solid ${Je}`,color:"#2E94FF"},children:jsx(tm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>m(ae=>!ae),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:ae=>{ae.currentTarget.style.background=j,ae.currentTarget.style.color=D;},onMouseLeave:ae=>{ae.currentTarget.style.background="transparent",ae.currentTarget.style.color=le;},children:jsx(hv,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:ae=>{ae.currentTarget.style.background=j,ae.currentTarget.style.color=D;},onMouseLeave:ae=>{ae.currentTarget.style.background="transparent",ae.currentTarget.style.color=le;},children:jsx(bv,{})})]})]}),jsx(AnimatePresence,{children:!i&&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:[g.length===0&&k&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:se,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:re.slice(0,4).map((ae,me)=>jsx("button",{onClick:()=>Yt(ae),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:ye,color:te,border:`1px solid ${W}`},onMouseEnter:Ge=>{Ge.currentTarget.style.borderColor=Oe,Ge.currentTarget.style.color="#2E94FF";},onMouseLeave:Ge=>{Ge.currentTarget.style.borderColor=W,Ge.currentTarget.style.color=te;},children:ae.length>30?ae.slice(0,30)+"...":ae},me))})]}),g.map(ae=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${ae.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${ae.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:ae.role==="user"?Ce:Ne,color:ae.role==="user"?"#2E94FF":it,border:ae.role==="user"?`1px solid ${He}`:`1px solid ${ze}`},children:[ae.isLoading?jsx(yv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:ae.content}),ae.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:ae.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:ae.command.success?"#10B981":"#EF4444",border:`1px solid ${ae.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[ae.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:ae.command.type.replace(/_/g," ")})]})]})},ae.id)),jsx("div",{ref:ce})]}),jsxs("form",{onSubmit:ae=>{if(B&&de.length>0){ae.preventDefault();return}St(ae);},className:"p-3 relative",style:{borderTop:`1px solid ${st}`},children:[jsx(AnimatePresence,{children:B&&de.length>0&&jsx(motion.div,{ref:q,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:Lt,border:`1px solid ${Ie}`,boxShadow:Be,backdropFilter:"blur(12px)"},children:de.map((ae,me)=>jsxs("button",{type:"button",onClick:()=>Y(ae),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:me===I?K:"transparent",color:he},onMouseEnter:()=>G(me),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:y,border:`1px solid ${L}`,color:"#2E94FF"},children:ae.name.split(" ").map(Ge=>Ge[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:ae.name}),ae.email&&jsx("div",{className:"text-xs truncate",style:{color:ee},children:ae.email})]})]},ae.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${pt}`},children:[jsx("input",{ref:S,type:"text",value:b,onChange:ae=>ge(ae.target.value),onKeyDown:ae=>{Re(ae);},placeholder:_e,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Rt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!b.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:b.trim()?Et:"transparent",color:b.trim()?"#2E94FF":mt,border:b.trim()?`1px solid ${dt}`:"1px solid transparent"},children:jsx(fv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Nt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function am(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,c=true)=>{r(i=>{let m=typeof l=="function"?l(i.present):l;if(o.current)return {...i,present:m};if(!c)return {...i,present:m};let g=[...i.past,i.present];return g.length>t&&g.shift(),{past:g,present:m,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let c=l.past[l.past.length-1],i=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:i,present:c,future:[l.present,...l.future]}});},[]),d=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let c=l.future[0],i=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:c,future:i}});},[]),p=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function rm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=d?n.metaKey:n.ctrlKey;if(p&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&p&&n.key==="y"){n.preventDefault(),t();return}if(d&&p&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var kv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ae.formatDate(e.startDate)} - ${Ae.formatDate(e.endDate)}`);let a=Ae.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=>Ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function om(e){return {...kv,...e}}var Pv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},im=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:p=true,showExportButton:l=true,projectName:c,availableUsers:i=[],templates:m,enableAutoCriticalPath:g=true,persistExpandedState:h,persistFilter:b,clearFiltersKey:w,aiAssistant:f,locale:x="en",customTranslations:k,showCreateTaskButton:v=false,createTaskLabel:C,onCreateTask:N,taskFilter:E,onTaskFilterChange:T,toolbarRightContent:B,showBaseline:O,viewMode:I,onViewModeChange:G,projectForecast:S,onThemeChange:ce,onTaskClick:M,onTaskDblClick:q,onTaskContextMenu:ke,onTaskUpdate:_e,onDependentTasksScheduled:P,onProgressChange:V,onTaskEdit:re,onTaskAddSubtask:Te,onTaskMarkIncomplete:$,onTaskSetInProgress:Z,onDependencyCreate:X,onDependencyDelete:fe,onBeforeTaskAdd:Fe,onAfterTaskAdd:Ke,onBeforeTaskUpdate:qe,onAfterTaskUpdate:ot,onBeforeTaskDelete:ne,onAfterTaskDelete:ut,permissions:Me,onCopySnapshotLink:ct}=a,Tt=useContext(qs)?.theme,[xe,rt]=useState(Tt||s||"dark"),[Ye,Je]=useState(n),[H,le]=useState(d),[D,j]=useState(1),[se,ye]=useState("all"),[W,te]=useState(I||"execution"),Oe=I??W,Ce=useCallback(F=>{te(F),G?.(F);},[G]),He=O??Oe==="oracle",[Ne,ze]=useState(a.showCriticalPath!==false),[it,st]=useState(a.showDependencies!==false),[nt,pt]=useState(a.highlightWeekends!==false),Rt=useCallback(F=>{ze(F),a.onShowCriticalPathChange?.(F);},[a.onShowCriticalPathChange]),Et=useCallback(F=>{st(F),a.onShowDependenciesChange?.(F);},[a.onShowDependenciesChange]),dt=useCallback(F=>{pt(F),a.onHighlightWeekendsChange?.(F);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Ye);},[Ye]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let mt=useRef(a.onDateRangeChange);mt.current=a.onDateRangeChange;let Nt=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Lt,Ie]=useState(()=>{if(!b)return "all";try{let F=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(_.taskFilter)return _.taskFilter}}catch(F){console.warn("[GanttBoard] Error loading filter state from localStorage:",F);}return "all"}),Be=E??Lt,K=T??Ie,[he,ee]=useState(()=>{if(!b)return false;try{let F=typeof b=="string"?b:"gantt-filter-state",R=localStorage.getItem(F);if(R){let _=JSON.parse(R);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(F){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",F);}return false});useEffect(()=>{let F=Nt();if(F)try{let R={taskFilter:Be,hideCompleted:he};localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving filter state to localStorage:",R);}},[Be,he,Nt]);let y=useRef(w);useEffect(()=>{if(y.current!==w&&w!==void 0){Ie("all"),ee(false);let F=Nt();if(F)try{localStorage.removeItem(F);}catch(R){console.warn("[GanttBoard] Error clearing filter state from localStorage:",R);}}y.current=w;},[w,Nt]);let[L,z]=useState(0),[J,de]=useState(false),[ge,Y]=useState(null),[Re,je]=useState({isOpen:false,x:0,y:0,task:null}),[gt,St]=useState(null),[Yt,Se]=useState(null);useEffect(()=>{Tt&&Tt!==xe&&rt(Tt);},[Tt]),useEffect(()=>{s&&s!==xe&&rt(s);},[s]);let ae=useCallback(F=>{rt(F),ce?.(F);},[ce]),{state:me,setState:Ge,undo:A,redo:ue,canUndo:$e,canRedo:Xe,clearHistory:ft}=am(t,50),Va=useMemo(()=>{let F=(R,_=0)=>{let Q=_;for(let we of R)we.subtasks?.length&&(Q=Math.max(Q,F(we.subtasks,_+1)));return Q};return F(me)+1},[me]),Ta=useCallback(()=>h?typeof h=="string"?h:"gantt-expanded-tasks":null,[h]),Ua=useRef(new Map),xa=useRef(false);if(!xa.current&&h){xa.current=true;let F=typeof h=="string"?h:"gantt-expanded-tasks";try{let R=localStorage.getItem(F);if(R){let _=JSON.parse(R);Array.isArray(_)&&(Ua.current=new Map(_));}}catch(R){console.warn("[GanttBoard] Error loading expanded state from localStorage:",R);}}let Ia=useCallback(()=>{let F=Ta();if(F)try{let R=Array.from(Ua.current.entries());localStorage.setItem(F,JSON.stringify(R));}catch(R){console.warn("[GanttBoard] Error saving expanded state to localStorage:",R);}},[Ta]),ir=useRef(0),Tc=useRef(me);useEffect(()=>{Tc.current=me;},[me]);let _o=useRef(false),Nc=useCallback(F=>{ye(F),ir.current+=1,Ge(R=>{let _=(we,Pe=0)=>we.map(bt=>{let Ze=F==="all"||Pe<F-1;return bt.subtasks?.length&&Ua.current.set(bt.id,Ze),{...bt,isExpanded:Ze,subtasks:bt.subtasks?_(bt.subtasks,Pe+1):void 0}}),Q=_(R);return Ia(),Q});},[Ge,Ia]);useEffect(()=>{if(ir.current>0){ir.current-=1;return}let F=_=>{let Q=new Map;for(let we of _){let Pe=we.id;Q.get(Pe)||Q.set(Pe,we);}return Array.from(Q.values())},R=_=>_.map(Q=>{let we=Ua.current.get(Q.id),Pe=we!==void 0?{...Q,isExpanded:we}:Q;if(Pe.subtasks?.length){let bt=F(Pe.subtasks);return {...Pe,subtasks:R(bt)}}return Pe});if(Ua.current.size>0)Ge(yr(R(t)));else {let _=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:F(_(we.subtasks))}:we);Ge(yr(_(t)));}},[t,Ge]);let gs=useRef(t),Dc=useRef(true);useEffect(()=>{if(Dc.current){Dc.current=false,gs.current=me;return}if(_o.current){_o.current=false,gs.current=me;return}if(!r)return;let F=JSON.stringify(gs.current),R=JSON.stringify(me);F!==R&&(gs.current=me,r(me));},[me,r]);let Ga=useMemo(()=>ad(x,k),[x,k]),$0=useCallback(F=>[{id:"name",label:F.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:F.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:F.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:F.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:F.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:F.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:F.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:F.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[jo,_i]=useState(()=>$0(Ga));useEffect(()=>{_i(F=>F.map(R=>({...R,label:Ga.columns[R.id==="name"?"taskName":R.id]||R.label})));},[Ga]);let fs=useMemo(()=>jo.filter(R=>R.visible).reduce((R,_)=>R+_.width,0),[jo]),Sc=useRef(jo.filter(F=>F.visible).map(F=>F.id).join(","));useEffect(()=>{let F=jo.filter(Q=>Q.visible),R=F.map(Q=>Q.id).join(","),_=Sc.current;if(R!==_){let Q=F.some(Pe=>Pe.id!=="name"),we=_.includes(",");Q?!we&&Q&&Y(null):Y(null),Sc.current=R;}},[jo]);let Ec=60,Fc=.6,H0=useMemo(()=>{let R=fs+Ec,_=typeof window<"u"?window.innerWidth*Fc:800,Q=Math.max(R,_);return ge!==null?Math.max(200,Math.min(ge,Q)):Math.max(200,R)},[ge,fs]),ro=useRef(null),bs=useRef(null),Ir=useRef(null),En=useRef(null),Qt=useMemo(()=>Np(xe),[xe]),z0=useMemo(()=>({theme:Qt,themeName:xe}),[Qt,xe]),Pc=useMemo(()=>om(m),[m]),ji=useMemo(()=>{if(!g)return me;let F=Ae.calculateCriticalPath(me),R=_=>_.map(Q=>({...Q,isCriticalPath:F.includes(Q.id),subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(me)},[me,g]),Mc=useMemo(()=>{if(Be==="all"&&!he)return ji;let F=R=>{let _=[];for(let Q of R){let we=Q.subtasks?.length?F(Q.subtasks):void 0,Pe=false;if(he)Pe=Q.progress<100;else switch(Be){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||we&&we.length>0)&&_.push({...Q,subtasks:we});}return _};return F(ji)},[ji,Be,he]),hs=Pv(H);rm({undo:A,redo:ue,canUndo:$e,canRedo:Xe,enabled:true}),useImperativeHandle(o,()=>({getTask:F=>Ae.findTaskById(me,F),addTask:(F,R)=>{Ge(_=>{if(!R)return [..._,{...F,level:0}];let Q=we=>we.map(Pe=>Pe.id===R?{...Pe,subtasks:[...Pe.subtasks||[],{...F,parentId:R,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},updateTask:(F,R)=>{Ge(_=>{let Q=we=>we.map(Pe=>Pe.id===F?{...Pe,...R}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(_)});},deleteTask:F=>{Ge(R=>{let _=Q=>Q.filter(we=>we.id===F?false:(we.subtasks&&(we.subtasks=_(we.subtasks)),true));return _(R)});},deleteTasks:F=>{Ge(R=>dd(R,F));},duplicateTask:F=>{if(a.onTaskDuplicate){let R=Ae.findTaskById(me,F);R&&a.onTaskDuplicate(R);}else Ge(R=>Kn(R,[F]).tasks);},splitTask:(F,R,_=3)=>{Ge(Q=>Ae.splitTask(Q,F,R,_));},calculateEndDate:Ae.calculateEndDate,calculateDuration:Ae.calculateDuration,validateDependency:(F,R)=>!Ae.validateDependencies(me,F,R),getAllTasks:()=>Ae.flattenTasks(me),getTasksByStatus:F=>Ae.flattenTasks(me).filter(R=>R.status===F),getTasksByParent:F=>F?Ae.findTaskById(me,F)?.subtasks||[]:me.filter(_=>!_.parentId),getCriticalPath:()=>Ae.flattenTasks(me).filter(F=>F.isCriticalPath),indentTask:F=>{Ge(R=>yr(sd(R,[F])));},outdentTask:F=>{Ge(R=>yr(id(R,[F])));},moveTask:(F,R)=>{Ge(_=>ld(_,[F],R));},createSubtask:async F=>{let{tasks:R,newTask:_}=pd(me,F);if(Fe){let Q=Fe({..._,parentId:F});if((Q instanceof Promise?await Q:Q)===false)return}Ge(yr(R)),Ke&&Ke({..._,parentId:F});},scrollToTask:F=>{let _=Ae.flattenTasks(me).findIndex(Q=>Q.id===F);if(_!==-1&&ro.current){let Q=_*hs;ro.current.scrollTo({top:Q,behavior:"smooth"}),Ir.current&&Ir.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(F,R=2e3)=>{},expandTask:F=>{Ge(R=>{let _=Q=>Q.map(we=>we.id===F?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:_(we.subtasks)}:we);return _(R)});},collapseTask:F=>{Ge(R=>{let _=Q=>Q.map(we=>we.id===F?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:_(we.subtasks)}:we);return _(R)});},expandAll:()=>{Ge(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseAll:()=>{Ge(F=>{let R=_=>_.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?R(Q.subtasks):void 0}));return R(F)});},collapseToLevel:F=>{Nc(F);},undo:A,redo:ue,canUndo:()=>$e,canRedo:()=>Xe,clearHistory:ft,exportToPNG:async()=>{if(!En.current||!ro.current||!Ir.current)throw new Error("Gantt container not found");let F=En.current,R=ro.current,_=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Ir.current,we=_?.scrollTop||0,Pe=Q.scrollTop,bt=F.style.overflow,Ze=F.style.height,Ea=R.style.overflow;try{let Ot=_?.querySelector(".gantt-taskgrid-content"),qt=Q.querySelector("svg"),Wa=Ot?.scrollHeight||_?.scrollHeight||600,lr=qt?.getBoundingClientRect().height||Q.scrollHeight,No=(F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(Wa,lr)+20;_&&(_.scrollTop=0),Q.scrollTop=0,F.style.overflow="visible",F.style.height=`${No}px`,R.style.overflow="visible",await new Promise(Jo=>setTimeout(Jo,100));let Br=await toPng(F,{backgroundColor:Qt.bgPrimary,pixelRatio:2,filter:Jo=>{if(!(Jo instanceof Element))return !0;let ys=window.getComputedStyle(Jo),Pn=parseInt(ys.zIndex,10);return (isNaN(Pn)||Pn<50)&&ys.position!=="fixed"}});return await(await fetch(Br)).blob()}finally{F.style.overflow=bt,F.style.height=Ze,R.style.overflow=Ea,_&&(_.scrollTop=we),Q.scrollTop=Pe;}},exportToPDF:async F=>{await Ae.exportToPDF(me,F);},exportToExcel:async F=>{await Ae.exportToExcel(me,F);},exportToJSON:()=>Ae.exportToJSON(me),exportToCSV:()=>Ae.exportToCSV(me),importFromJSON:F=>{let R=Ae.importFromJSON(F);Ge(R);},getTasks:()=>me,refresh:()=>{Ge(F=>[...F]);},clearAll:()=>{Ge([]);}}),[me,A,ue,$e,Xe,ft,Qt,hs]);let U0=useCallback(F=>{_i(R=>R.map(_=>_.id===F?{..._,visible:!_.visible}:_));},[]),W0=useCallback((F,R)=>{_i(_=>_.map(Q=>{if(Q.id!==F)return Q;let we=Q.minWidth??100,Pe=Q.maxWidth??800,bt=Math.max(we,Math.min(Pe,R));return {...Q,width:bt}}));},[]),V0=useCallback(F=>{Ge(R=>{let _=ud(R,F),Q=we=>{for(let Pe of we){if(Pe.id===F){Ua.current.set(F,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(_),Ia(),_}),a.onTaskToggleExpand?.(F);},[a,Ia]),Ko=useCallback((F,R)=>{if(qe&&qe(F,R)===false)return;let Q=Ae.findTaskById(me,F)?.progress,we=bt=>bt.map(Ze=>Ze.id===F?{...Ze,...R}:Ze.subtasks?{...Ze,subtasks:we(Ze.subtasks)}:Ze);Ge(we(me));let Pe=Ae.findTaskById(we(me),F);Pe&&(_e?.(Pe),ot?.(Pe),R.progress!==void 0&&Q!==void 0&&R.progress!==Q&&V?.(F,Q,R.progress));},[me,_e,qe,ot,V]),G0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(R=>yr(sd(R,F))),a.onTaskIndent?.(F[0]));},[a]),_0=useCallback(F=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(R=>yr(id(R,F))),a.onTaskOutdent?.(F[0]));},[a]),j0=useCallback((F,R,_)=>{ir.current+=1,_o.current=true,Ge(Q=>yr(Vp(Q,F,R,_))),a.onTaskReparent?.(F,R,_);},[a]),K0=useCallback((F,R)=>{F.length!==0&&(ir.current+=1,_o.current=true,Ge(_=>ld(_,F,R)),a.onTaskMove?.(F[0],R));},[a]),Ki=useCallback(async F=>{let R=[];for(let _ of F)ne&&await Promise.resolve(ne(_))===false||R.push(_);R.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(R):(Ge(_=>yr(dd(_,R))),R.forEach(_=>a.onTaskDelete?.(_))),ut&&R.forEach(_=>ut(_)));},[a,ne,ut]),Y0=useCallback(F=>{a.onTaskDuplicate?F.forEach(R=>{let _=Ae.findTaskById(me,R);_&&a.onTaskDuplicate(_);}):Ge(R=>Kn(R,F).tasks);},[a,me]),q0=useCallback((F,R)=>{Ge(_=>{let{tasks:Q,newTask:we}=Wp(_,F,R);return Fe&&Fe(we)===false?_:(a.onTaskCreate?.(we.parentId,we.position||0),Ke?.(we),Q)});},[a,Fe,Ke]),X0=useCallback((F,R)=>{Ge(_=>cd(_,F,R)),a.onTaskRename?.(F,R);},[a]),Yi=useCallback(F=>{let{onTaskAddSubtask:R}=a;if(R){let _=ai(me,F);if(_){R(_);return}}Ge(_=>{let{tasks:Q}=pd(_,F);return a.onTaskCreate?.(F,0),Q});},[a,me]),J0=useCallback((F,R,_)=>{let Q=!F.startDate&&!F.endDate,we=F.startDate?Math.round((R.getTime()-F.startDate.getTime())/(1e3*60*60*24)):0,Pe=Ot=>Ot.map(qt=>qt.id===F.id?{...qt,startDate:R,endDate:_,...F.segments&&{segments:F.segments}}:qt.subtasks?{...qt,subtasks:Pe(qt.subtasks)}:qt),bt=Pe(me),Ze=bt;bt=Ae.autoScheduleDependents(bt,F.id,we),bt=yr(bt),Ge(bt);let Ea={...F,startDate:R,endDate:_};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(F,R,_):_e?.(Ea),P&&we!==0){let Ot=Ae.flattenTasks(Ze),qt=Ae.flattenTasks(bt),Wa=[];for(let lr of qt){if(lr.id===F.id)continue;let oo=Ot.find(Br=>Br.id===lr.id);if(!oo)continue;let Xo=lr.startDate?.getTime()!==oo.startDate?.getTime(),No=lr.endDate?.getTime()!==oo.endDate?.getTime();(Xo||No)&&Wa.push(lr);}Wa.length>0&&P(Wa);}},[me,_e,P,a]),Q0=useCallback((F,R)=>{ke?.(F,R),je({isOpen:true,x:R.clientX,y:R.clientY,task:F});},[ke]),Z0=useCallback((F,R)=>{let _=Ae.splitTask(me,F.id,R);Ge(_),je({isOpen:false,x:0,y:0,task:null});},[me]),Ac=useCallback(F=>{let R=Ae.findTaskById(me,F.id)||F;q?.(R),re||St(R);},[me,q,re]),Lc=useCallback((F,R,_)=>{let Q=new Map,we=Ot=>{Ot.forEach(qt=>{qt.dependencies&&Q.set(qt.id,qt.dependencies),qt.subtasks&&we(qt.subtasks);});};we(_);let Pe=Q.get(R)||[];Q.set(R,[...Pe,F]);let bt=new Set,Ze=new Set,Ea=Ot=>{if(!bt.has(Ot)){bt.add(Ot),Ze.add(Ot);let qt=Q.get(Ot)||[];for(let Wa of qt){if(!bt.has(Wa)&&Ea(Wa))return true;if(Ze.has(Wa))return true}}return Ze.delete(Ot),false};return Ea(R)},[]),Ic=useCallback((F,R)=>{if(Lc(F.id,R,Tc.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 _=Q=>Q.map(we=>{if(we.id===R){let Pe=we.dependencies||[];if(!Pe.includes(F.id))return {...we,dependencies:[...Pe,F.id]}}return we.subtasks?{...we,subtasks:_(we.subtasks)}:we});ir.current+=1,Ge(Q=>_(Q)),X?.(F.id,R);},[X,Ac]),Ic=useCallback((F,R)=>{let _=Q=>Q.map(we=>{if(we.id===F&&we.dependencies){let Pe=we.dependencies.filter(bt=>bt!==R);return {...we,dependencies:Pe}}return we.subtasks?{...we,subtasks:_(we.subtasks)}:we});ir.current+=1,Ge(Q=>_(Q)),fe?.(F,R);},[fe]),{startDate:Yo,endDate:Yi}=useMemo(()=>{let F=me.filter(Pe=>Pe.startDate&&Pe.endDate);if(F.length===0){let Pe=new Date,bt=new Date(Pe);bt.setDate(bt.getDate()-30);let Ze=new Date(Pe);return Ze.setDate(Ze.getDate()+60),{startDate:bt,endDate:Ze}}let R=F.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),_=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),we=Ye==="day"?7:Ye==="week"?14:30;return _.setDate(_.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:_,endDate:Q}},[me,Ye]);useEffect(()=>{mt.current?.(Yo,Yi);},[Yo,Yi]);let Z0=useCallback(async()=>{if(!En.current||!ro.current||!Ir.current)return;await new Promise(No=>setTimeout(No,200));let F=En.current,R=ro.current,_=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Ir.current,we=_?.scrollTop||0,Pe=_?.scrollLeft||0,bt=Q.scrollTop,Ze=Q.scrollLeft,Ea=F.style.overflow,Ot=F.style.height,qt=_?.style.overflow||"",Wa=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Xo=Q.style.width;try{let No=_?.querySelector(".gantt-taskgrid-content"),Br=Q.querySelector("svg"),Xi=Br?.getAttribute("height")?parseInt(Br.getAttribute("height"),10):Br?.getBoundingClientRect().height||0,Jo=No?.scrollHeight||_?.scrollHeight||600,ys=Math.max(Xi,Q.scrollHeight),Pn=Br?.getAttribute("width")?parseInt(Br.getAttribute("width"),10):Br?.getBoundingClientRect().width||Q.scrollWidth,lf=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Ji=Math.max(Jo,ys,Xi),Oc=lf+Ji+50,$c=(_?.offsetWidth||R.offsetWidth||300)+Pn+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${Oc}px`,F.style.width=`${$c}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${Ji+50}px`),Q.style.overflow="visible",Q.style.height=`${Ji+50}px`,Q.style.width=`${Pn+10}px`,await new Promise(xs=>setTimeout(xs,150));let df=await toPng(F,{backgroundColor:Qt.bgPrimary,pixelRatio:2,width:$c,height:Oc,skipFonts:!1,filter:xs=>{if(!(xs instanceof Element))return !0;let Hc=window.getComputedStyle(xs),zc=parseInt(Hc.zIndex,10);return !(!isNaN(zc)&&zc>=50||Hc.position==="fixed")}}),Qi=document.createElement("a");Qi.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Qi.href=df,Qi.click();}finally{F.style.overflow=Ea,F.style.height=Ot,F.style.width=oo,R.style.overflow=lr,_&&(_.style.overflow=qt,_.style.height="",_.scrollTop=we,_.scrollLeft=Pe),Q.style.overflow=Wa,Q.style.height="",Q.style.width=Xo,Q.scrollTop=bt,Q.scrollLeft=Ze;}},[Qt]),ef=useCallback(async()=>{await Ae.exportToPDF(me);},[me]),tf=useCallback(async()=>{let F=new Date,R=we=>String(we).padStart(2,"0"),_=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Q=c?c.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ae.exportToExcel(me,`${Q}_${_}.xlsx`);},[me,c]),af=useCallback(()=>{let F=Ae.exportToCSV(me),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[me]),rf=useCallback(()=>{let F=Ae.exportToJSON(me),R=new Blob([F],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[me]),of=useCallback(()=>{Ae.exportToMSProject(me,"Gantt Project","project.xml");},[me]),nf=F=>{F.preventDefault(),de(true);},qo=useRef(false),[qi,Bc]=useState(false),Fn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Ir.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let _=()=>{if(qo.current)return;qo.current=true;let Ze=F.scrollTop;z(Ze),R.scrollTop=Ze,requestAnimationFrame(()=>{qo.current=false;});},Q=()=>{if(qo.current)return;qo.current=true;let Ze=R.scrollTop;z(Ze),F.scrollTop=Ze,requestAnimationFrame(()=>{qo.current=false;});},we=Ze=>{if(J&&R){let Ot=R.parentElement?.getBoundingClientRect()?.left||0,qt=Ze.clientX-Ot,Wa=200,lr=fs+Sc,oo=window.innerWidth*Ec,Xo=Math.max(lr,oo);qt>=Wa&&qt<=Xo&&Y(qt);}if(qi&&F){let Ea=Ze.clientX-Fn.current.x,Ot=Ze.clientY-Fn.current.y;F.scrollLeft=Fn.current.scrollLeft-Ea,F.scrollTop=Fn.current.scrollTop-Ot;}},Pe=()=>{de(false),Bc(false);},bt=Ze=>{if(Ze.button!==0)return;let Ea=Ze.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Bc(true),Fn.current={x:Ze.clientX,y:Ze.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},Ze.preventDefault());};return F.addEventListener("scroll",_),R.addEventListener("scroll",Q),F.addEventListener("mousedown",bt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Pe),()=>{F.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Pe);}},[J,qi,fs]);let Rc=useRef(false),sf=useRef(null);return useLayoutEffect(()=>{if(Rc.current||me.length===0||!Ir.current)return;Rc.current=true,sf.current=Yo;let F=Ir.current,R=new Date,_=Ye==="day"?60:Ye==="week"?20:8,Q=(R.getTime()-Yo.getTime())/(1e3*60*60*24),we=F.clientWidth,bt=Q*_*D-we/2;Q>=0&&we>0&&(F.scrollLeft=Math.max(0,bt));},[me.length,Yo,Ye,D]),jsx(un.Provider,{value:Ga,children:jsx(rl.Provider,{value:H0,children:jsxs("div",{ref:En,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:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Zs,{theme:Qt,timeScale:Ye,onTimeScaleChange:Je,zoom:D,onZoomChange:j,currentTheme:xe,onThemeChange:ae,rowDensity:H,onRowDensityChange:le,showThemeSelector:p,showCreateTaskButton:v&&Me?.canCreateTask!==false&&!Me?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:N,taskFilter:Be,onTaskFilterChange:K,hideCompleted:he,onHideCompletedChange:ee,toolbarRightContent:B,wbsLevel:se,onWbsLevelChange:Tc,maxWbsDepth:Va,viewMode:Oe,onViewModeChange:Ce,projectForecast:S,onExportPNG:l?Z0:void 0,onExportPDF:l?ef:void 0,onExportExcel:l?tf:void 0,onExportCSV:l?af:void 0,onExportJSON:l?rf:void 0,onExportMSProject:l?of:void 0,showCriticalPath:Ne,onShowCriticalPathChange:Rt,showDependencies:it,onShowDependenciesChange:Et,highlightWeekends:nt,onHighlightWeekendsChange:dt,showBaseline:He,onShowBaselineChange:F=>{F&&Oe!=="oracle"&&Ce("oracle"),!F&&Oe==="oracle"&&Ce("execution");},onCopySnapshotLink:ct})}),jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:bs,className:"gantt-grid-scroll flex-shrink-0",style:{width:$0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ri,{tasks:Pc,theme:Qt,rowHeight:hs,availableUsers:i,templates:Fc,onTaskClick:M,onTaskDblClick:Mc,onTaskContextMenu:ke,onTaskToggle:W0,scrollTop:L,columns:jo,onToggleColumn:z0,onColumnResize:U0,onTaskUpdate:Ko,onTaskIndent:V0,onTaskOutdent:G0,onTaskMove:j0,onMultiTaskDelete:ji,onTaskDuplicate:K0,onTaskCreate:Y0,onTaskRename:q0,onCreateSubtask:Ki,onOpenTaskModal:M?F=>M(F):void 0,onDeleteRequest:(F,R)=>Se({taskId:F,taskName:R}),onTaskReparent:_0,scrollContainerRef:bs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Qt.border,zIndex:15},onMouseDown:nf}),jsx("div",{ref:Ir,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:qi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(mi,{tasks:Pc,theme:Qt,rowHeight:hs,timeScale:Ye,startDate:Yo,endDate:Yi,zoom:D,locale:x,templates:Fc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:M,onTaskDblClick:Mc,onTaskContextMenu:J0,onTaskDateChange:X0,onDependencyCreate:Lc,onDependencyDelete:Ic,showBaseline:He,showCriticalPath:Ne,showDependencies:it,highlightWeekends:nt,canEditTask:Me?.canEditTask})})]}),Re.task&&jsx(gn,{isOpen:Re.isOpen,x:Re.x,y:Re.y,theme:Qt,onClose:()=>je({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Re.task;if(!F)return [];let R=Ae.findTaskById(me,F.id)||F,_=R.subtasks&&R.subtasks.length>0,Q=Me?.canCreateTask!==false,we=Me?.canDeleteTask!==false;if(_){let Ot=[],qt=Me?.canDuplicateTask!==false;return Q&&Ot.push({id:"addSubtask",label:Ga.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{Te?Te(R):Ki(R.id);}}),qt&&Ot.push({id:"duplicate",label:Ga.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Ge(Wa=>Kn(Wa,[R.id]).tasks),je({isOpen:false,x:0,y:0,task:null});}}),we&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:Ga.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{Se({taskId:R.id,taskName:R.name});}})),Ot}let Pe=Me?.canUpdateTask!==false,bt=Me?.canDuplicateTask!==false,Ze=[];return Pe&&Ze.push({id:"edit",label:Ga.contextMenu?.editTask||"Edit Task",icon:jt.Pencil,onClick:()=>{re?re(R):St(R);}}),Q&&Ze.push({id:"addSubtask",label:Ga.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{Te?Te(R):Ki(R.id);}}),Ze.length>0&&Pe&&Ze.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(Ze.push({id:"markIncomplete",label:Ga.contextMenu?.markIncomplete||"Mark Incomplete",icon:jt.MarkIncomplete,onClick:()=>{$?$(R):Ko(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),Ze.push({id:"setInProgress",label:Ga.contextMenu?.setInProgress||"Set In Progress",icon:jt.SetInProgress,onClick:()=>{Z?Z(R):Ko(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),Ze.push({id:"markComplete",label:Ga.contextMenu?.markComplete||"Mark Complete",icon:jt.MarkComplete,onClick:()=>{Ko(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(bt||Pe&&R.startDate&&R.endDate)&&Ze.length>0&&Ze.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),bt&&Ze.push({id:"duplicate",label:Ga.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Ge(Ot=>Kn(Ot,[R.id]).tasks),je({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&Ze.push({id:"split",label:Ga.contextMenu?.splitTask||"Split Task",icon:jt.Split,onClick:()=>{let Ot=R.startDate.getTime(),qt=R.endDate.getTime(),Wa=Ot+(qt-Ot)/2,lr=new Date(Wa);Q0(R,lr);}}),we&&(Ze.length>0&&Ze.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ze.push({id:"delete",label:Ga.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{Se({taskId:R.id,taskName:R.name});}})),Ze})()}),jsx(Xr,{task:gt,isOpen:!!gt,onClose:()=>St(null),onTaskUpdate:F=>{gt&&(Ko(gt.id,F),St(null));},theme:xe==="light"?"light":"dark",locale:x==="es"?"es":"en",availableUsers:i,availableTasks:t}),jsx(AnimatePresence,{children:Yt&&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:()=>Se(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:F=>F.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:[Ga.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:x==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:[x==="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:['"',Yt.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:()=>Se(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=Qt.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ji([Yt.taskId]),Se(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),x==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(bi,{tasks:me,theme:Qt,config:f,onTasksUpdate:Ge,onTaskUpdate:Ko,onTaskCreate:F=>{Ge(R=>[...R,F]);},onTaskDelete:F=>{ji([F]);},onDependencyCreate:(F,R)=>{let _=Ae.findTaskById(me,F);_&&Lc(_,R);},onDependencyDelete:Ic})]})})})});function Hv(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 zv(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 d=parseInt(a[1],10),p=parseInt(a[2],10);return d*60+p}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var gd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],fd=[{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 cm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:p="dark",customStatuses:l=[],availableTags:c=[],onCreateTag:i,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:b}){let w=[...gd,...l.filter(D=>!gd.some(j=>j.id===D.id))],f=et[p]||et.dark,[x,k]=useState(false),[v,C]=useState(false),[N,E]=useState(false),[T,B]=useState(false),[O,I]=useState({top:0,left:0}),[G,S]=useState(null),[ce,M]=useState(new Date),[q,ke]=useState({top:0,left:0}),[_e,P]=useState(false),[V,re]=useState([]),[Te,$]=useState(false),[Z,X$1]=useState(""),fe=useRef(null),Fe=useRef(null),Ke=useRef(null),qe=useRef(null),ot=useRef(null),[ne,ut]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Me,ct]=useState({});useEffect(()=>{a?(ut({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&P(true)):(ut({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),P(false),re([]));},[a,e,b]),useEffect(()=>{let D=j=>{fe.current&&!fe.current.contains(j.target)&&k(false),Fe.current&&!Fe.current.contains(j.target)&&C(false),Ke.current&&!Ke.current.contains(j.target)&&E(false),qe.current&&!qe.current.contains(j.target)&&B(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let Dt=()=>{let D={};return ne.name.trim()||(D.name="El nombre es requerido"),ne.startDate&&ne.endDate&&ne.startDate>ne.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),ct(D),Object.keys(D).length===0},Tt=async D=>{if(D.preventDefault(),!!Dt())try{let j=d==="create"&&V.length>0?{...ne,pendingFiles:V}:ne;await s(j),re([]),t();}catch(j){console.error("Error submitting task:",j);}},xe=(D,j)=>{ut(se=>{let ye={...se,[D]:j};if(D==="status"){let W=j;W==="todo"?ye.progress=0:W==="in-progress"?(se.progress===0||se.progress===100)&&(ye.progress=50):W==="completed"||W==="closed"?ye.progress=100:(W==="in-review"||W==="review")&&(ye.progress=75);}if(D==="progress"){let W=typeof j=="number"?j:parseInt(j,10);W===100&&se.status!=="completed"?ye.status="completed":W>0&&W<100&&se.status==="todo"?ye.status="in-progress":W===0&&se.status!=="todo"&&(ye.status="todo");}return ye}),Me[D]&&ct(se=>{let ye={...se};return delete ye[D],ye});},rt=w.find(D=>D.id===ne.status)??gd[0],Ye=fd.find(D=>D.id===ne.priority)??fd[1],Je=Mo.find(D=>D.value===ne.color)??Mo[0],H=p==="dark",le={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.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-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=f.hoverBg,D.currentTarget.style.color=f.textPrimary;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Tt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:ne.name,onChange:D=>xe("name",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ne.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsx("div",{children:jsx("textarea",{value:ne.description||"",onChange:D=>xe("description",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...le,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsx("span",{style:{color:rt.color},children:rt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsx(AnimatePresence,{children:x&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:w.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("status",D.id),k(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ne.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&C(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Ye.color}}),jsx("span",{children:Ye.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:fd.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("priority",D.id),C(false);},children:[jsx("span",{children:D.icon}),D.label,ne.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:Ke,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&E(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[ne.assignees&&ne.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ne.assignees.slice(0,3).map((D,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:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},j))}),ne.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ne.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:N&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let j=ne.assignees?.some(se=>se.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let se=j?(ne.assignees||[]).filter(ye=>ye.name!==D.name):[...ne.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(ye=>ye[0]).join("").toUpperCase().slice(0,2),color:f.accent}];xe("assignees",se);},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:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.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:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:qe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)B(false);else {if(qe.current){let D=qe.current.getBoundingClientRect(),j=window.innerHeight,se=120,W=j-D.bottom<se?D.top-se-8:D.bottom+8;I({top:W,left:D.left});}B(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ne.color}}),jsx("span",{children:Je.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(It,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(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:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Mo.slice(0,18).map(D=>{let j=ne.color===D.value;return jsx("button",{type:"button",onClick:se=>{se.preventDefault(),se.stopPropagation(),xe("color",D.value),B(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:j?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),c.length>0||i?jsx(lo,{selectedTags:ne.tags||[],availableTags:c,onChange:D=>xe("tags",D),onCreateTag:i,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ne.isMilestone)if(G==="start")S(null);else {if(ot.current){let D=ot.current.getBoundingClientRect(),j=window.innerHeight,se=320,W=j-D.bottom<se?D.top-se-8:D.bottom+8;ke({top:W,left:D.left});}S("start"),M(ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:n||ne.isMilestone,children:ne.startDate?ne.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ne.isMilestone)if(G==="end")S(null);else {if(ot.current){let D=ot.current.getBoundingClientRect(),j=window.innerHeight,se=320,W=j-D.bottom<se?D.top-se-8:D.bottom+8;ke({top:W,left:D.left});}S("end"),M(ne.endDate||ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:n||ne.isMilestone,children:ne.endDate?ne.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:G&&jsxs(It,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(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:`${q.top}px`,left:`${q.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,j=new Date(D);j.setDate(D.getDate()+1);let se=new Date(D);se.setDate(D.getDate()+7);let ye=new Date(D);return ye.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:se},{label:"2 semanas",date:ye}].map((te,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{G==="start"?(xe("startDate",te.date),(!ne.endDate||te.date>ne.endDate)&&xe("endDate",te.date),S("end")):(xe("endDate",te.date),(!ne.startDate||te.date<ne.startDate)&&xe("startDate",te.date),S(null));},children:te.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("startDate",void 0),xe("endDate",void 0),S(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:()=>M(new Date(ce.getFullYear(),ce.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ce.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>M(new Date(ce.getFullYear(),ce.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,j)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},j))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ce.getFullYear(),j=ce.getMonth(),se=new Date(D,j,1).getDay(),ye=new Date(D,j+1,0).getDate(),W=new Date,te=[];for(let Ce=se-1;Ce>=0;Ce--)te.push({day:new Date(D,j,-Ce).getDate(),date:new Date(D,j-1,new Date(D,j,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=ye;Ce++)te.push({day:Ce,date:new Date(D,j,Ce),isCurrentMonth:true});let Oe=42-te.length;for(let Ce=1;Ce<=Oe;Ce++)te.push({day:Ce,date:new Date(D,j+1,Ce),isCurrentMonth:false});return te.map((Ce,He)=>{let Ne=Ce.date.toDateString()===W.toDateString(),ze=ne.startDate?.toDateString()===Ce.date.toDateString(),it=ne.endDate?.toDateString()===Ce.date.toDateString(),st=ne.startDate&&ne.endDate&&Ce.date>=ne.startDate&&Ce.date<=ne.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ce.isCurrentMonth?ze||it?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:ze?f.accent:it?"#7C3AED":st?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!ze&&!it?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{G==="start"?(xe("startDate",Ce.date),ne.endDate&&Ce.date>ne.endDate&&xe("endDate",Ce.date),S("end")):(xe("endDate",Ce.date),ne.startDate&&Ce.date<ne.startDate&&xe("startDate",Ce.date),S(null));},children:Ce.day},He)})})()})]})]})]})})]}),Me.endDate&&jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ne.progress,onChange:D=>xe("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981"}20`,color:ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ne.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>P(!_e),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${_e?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:_e&&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:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ne.effortMinutes?Hv(ne.effortMinutes):"",onChange:D=>{let j=zv(D.target.value);xe("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="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:f.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:f.textTertiary},children:["Adjuntos ",d==="create"?V.length>0&&`(${V.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsx(zr,{cardId:"pending",attachments:V.map((D,j)=>({id:`pending-${j}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>re(j=>[...j,...D]),onDelete:D=>{let j=parseInt(D.replace("pending-",""),10);re(se=>se.filter((ye,W)=>W!==j));},maxSizeMB:10,maxFiles:20}):jsx(zr,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),d==="create"&&V.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[V.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ne.isMilestone,onChange:D=>xe("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ne.dependencies&&ne.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ne.dependencies.map(D=>{let j=r.find(se=>se.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[j?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let se=(ne.dependencies||[]).filter(ye=>ye!==D);xe("dependencies",se);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{$(!Te),X$1("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),X$1("");}}),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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"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 ${f.border}`},children:jsx("input",{type:"text",value:Z,onChange:D=>X$1(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>Z===""||D.name.toLowerCase().includes(Z.toLowerCase())).map(D=>{let j=ne.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let se=ne.dependencies||[],ye;j?ye=se.filter(W=>W!==D.id):ye=[...se,D.id],xe("dependencies",ye);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${f.accent}10`:"transparent"},onMouseEnter:se=>{j||(se.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:se=>{se.currentTarget.style.backgroundColor=j?`${f.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?f.accent:"transparent",borderColor:j?f.accent:f.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:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:D=>!n&&(D.currentTarget.style.opacity="0.9"),onMouseLeave:D=>!n&&(D.currentTarget.style.opacity="1"),children:n?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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var um=`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 _=Q=>Q.map(we=>{if(we.id===R){let Pe=we.dependencies||[];if(!Pe.includes(F.id))return {...we,dependencies:[...Pe,F.id]}}return we.subtasks?{...we,subtasks:_(we.subtasks)}:we});ir.current+=1,Ge(Q=>_(Q)),X?.(F.id,R);},[X,Lc]),Bc=useCallback((F,R)=>{let _=Q=>Q.map(we=>{if(we.id===F&&we.dependencies){let Pe=we.dependencies.filter(bt=>bt!==R);return {...we,dependencies:Pe}}return we.subtasks?{...we,subtasks:_(we.subtasks)}:we});ir.current+=1,Ge(Q=>_(Q)),fe?.(F,R);},[fe]),{startDate:Yo,endDate:qi}=useMemo(()=>{let F=me.filter(Pe=>Pe.startDate&&Pe.endDate);if(F.length===0){let Pe=new Date,bt=new Date(Pe);bt.setDate(bt.getDate()-30);let Ze=new Date(Pe);return Ze.setDate(Ze.getDate()+60),{startDate:bt,endDate:Ze}}let R=F.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),_=new Date(Math.min(...R.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...R.map(Pe=>Pe.getTime()))),we=Ye==="day"?7:Ye==="week"?14:30;return _.setDate(_.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:_,endDate:Q}},[me,Ye]);useEffect(()=>{mt.current?.(Yo,qi);},[Yo,qi]);let ef=useCallback(async()=>{if(!En.current||!ro.current||!Ir.current)return;await new Promise(No=>setTimeout(No,200));let F=En.current,R=ro.current,_=bs.current||R.querySelector(".gantt-grid-scroll"),Q=Ir.current,we=_?.scrollTop||0,Pe=_?.scrollLeft||0,bt=Q.scrollTop,Ze=Q.scrollLeft,Ea=F.style.overflow,Ot=F.style.height,qt=_?.style.overflow||"",Wa=Q.style.overflow,lr=R.style.overflow,oo=F.style.width,Xo=Q.style.width;try{let No=_?.querySelector(".gantt-taskgrid-content"),Br=Q.querySelector("svg"),Ji=Br?.getAttribute("height")?parseInt(Br.getAttribute("height"),10):Br?.getBoundingClientRect().height||0,Jo=No?.scrollHeight||_?.scrollHeight||600,ys=Math.max(Ji,Q.scrollHeight),Pn=Br?.getAttribute("width")?parseInt(Br.getAttribute("width"),10):Br?.getBoundingClientRect().width||Q.scrollWidth,df=F.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Qi=Math.max(Jo,ys,Ji),$c=df+Qi+50,Hc=(_?.offsetWidth||R.offsetWidth||300)+Pn+10;_&&(_.scrollTop=0,_.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,F.style.overflow="visible",F.style.height=`${$c}px`,F.style.width=`${Hc}px`,R.style.overflow="visible",_&&(_.style.overflow="visible",_.style.height=`${Qi+50}px`),Q.style.overflow="visible",Q.style.height=`${Qi+50}px`,Q.style.width=`${Pn+10}px`,await new Promise(xs=>setTimeout(xs,150));let cf=await toPng(F,{backgroundColor:Qt.bgPrimary,pixelRatio:2,width:Hc,height:$c,skipFonts:!1,filter:xs=>{if(!(xs instanceof Element))return !0;let zc=window.getComputedStyle(xs),Uc=parseInt(zc.zIndex,10);return !(!isNaN(Uc)&&Uc>=50||zc.position==="fixed")}}),Zi=document.createElement("a");Zi.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Zi.href=cf,Zi.click();}finally{F.style.overflow=Ea,F.style.height=Ot,F.style.width=oo,R.style.overflow=lr,_&&(_.style.overflow=qt,_.style.height="",_.scrollTop=we,_.scrollLeft=Pe),Q.style.overflow=Wa,Q.style.height="",Q.style.width=Xo,Q.scrollTop=bt,Q.scrollLeft=Ze;}},[Qt]),tf=useCallback(async()=>{await Ae.exportToPDF(me);},[me]),af=useCallback(async()=>{let F=new Date,R=we=>String(we).padStart(2,"0"),_=`${F.getFullYear()}-${R(F.getMonth()+1)}-${R(F.getDate())}_${R(F.getHours())}${R(F.getMinutes())}`,Q=c?c.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ae.exportToExcel(me,`${Q}_${_}.xlsx`);},[me,c]),rf=useCallback(()=>{let F=Ae.exportToCSV(me),R=new Blob([F],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[me]),of=useCallback(()=>{let F=Ae.exportToJSON(me),R=new Blob([F],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(R),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[me]),nf=useCallback(()=>{Ae.exportToMSProject(me,"Gantt Project","project.xml");},[me]),sf=F=>{F.preventDefault(),de(true);},qo=useRef(false),[Xi,Rc]=useState(false),Fn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let F=Ir.current,R=ro.current?.querySelector(".gantt-grid-scroll");if(!F||!R)return;let _=()=>{if(qo.current)return;qo.current=true;let Ze=F.scrollTop;z(Ze),R.scrollTop=Ze,requestAnimationFrame(()=>{qo.current=false;});},Q=()=>{if(qo.current)return;qo.current=true;let Ze=R.scrollTop;z(Ze),F.scrollTop=Ze,requestAnimationFrame(()=>{qo.current=false;});},we=Ze=>{if(J&&R){let Ot=R.parentElement?.getBoundingClientRect()?.left||0,qt=Ze.clientX-Ot,Wa=200,lr=fs+Ec,oo=window.innerWidth*Fc,Xo=Math.max(lr,oo);qt>=Wa&&qt<=Xo&&Y(qt);}if(Xi&&F){let Ea=Ze.clientX-Fn.current.x,Ot=Ze.clientY-Fn.current.y;F.scrollLeft=Fn.current.scrollLeft-Ea,F.scrollTop=Fn.current.scrollTop-Ot;}},Pe=()=>{de(false),Rc(false);},bt=Ze=>{if(Ze.button!==0)return;let Ea=Ze.target;Ea.closest("[data-task-bar]")||Ea.closest("[data-dependency-line]")||Ea.closest("button")||Ea.closest('[role="button"]')||Ea.tagName==="rect"&&Ea.getAttribute("data-clickable")==="true"||(Rc(true),Fn.current={x:Ze.clientX,y:Ze.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},Ze.preventDefault());};return F.addEventListener("scroll",_),R.addEventListener("scroll",Q),F.addEventListener("mousedown",bt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Pe),()=>{F.removeEventListener("scroll",_),R.removeEventListener("scroll",Q),F.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Pe);}},[J,Xi,fs]);let Oc=useRef(false),lf=useRef(null);return useLayoutEffect(()=>{if(Oc.current||me.length===0||!Ir.current)return;Oc.current=true,lf.current=Yo;let F=Ir.current,R=new Date,_=Ye==="day"?60:Ye==="week"?20:8,Q=(R.getTime()-Yo.getTime())/(1e3*60*60*24),we=F.clientWidth,bt=Q*_*D-we/2;Q>=0&&we>0&&(F.scrollLeft=Math.max(0,bt));},[me.length,Yo,Ye,D]),jsx(un.Provider,{value:Ga,children:jsx(ol.Provider,{value:z0,children:jsxs("div",{ref:En,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:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(ei,{theme:Qt,timeScale:Ye,onTimeScaleChange:Je,zoom:D,onZoomChange:j,currentTheme:xe,onThemeChange:ae,rowDensity:H,onRowDensityChange:le,showThemeSelector:p,showCreateTaskButton:v&&Me?.canCreateTask!==false&&!Me?.canCreateSubtaskOnly,createTaskLabel:C,onCreateTask:N,taskFilter:Be,onTaskFilterChange:K,hideCompleted:he,onHideCompletedChange:ee,toolbarRightContent:B,wbsLevel:se,onWbsLevelChange:Nc,maxWbsDepth:Va,viewMode:Oe,onViewModeChange:Ce,projectForecast:S,onExportPNG:l?ef:void 0,onExportPDF:l?tf:void 0,onExportExcel:l?af:void 0,onExportCSV:l?rf:void 0,onExportJSON:l?of:void 0,onExportMSProject:l?nf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:Rt,showDependencies:it,onShowDependenciesChange:Et,highlightWeekends:nt,onHighlightWeekendsChange:dt,showBaseline:He,onShowBaselineChange:F=>{F&&Oe!=="oracle"&&Ce("oracle"),!F&&Oe==="oracle"&&Ce("execution");},onCopySnapshotLink:ct})}),jsxs("div",{ref:ro,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:bs,className:"gantt-grid-scroll flex-shrink-0",style:{width:H0,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(oi,{tasks:Mc,theme:Qt,rowHeight:hs,availableUsers:i,templates:Pc,onTaskClick:M,onTaskDblClick:Ac,onTaskContextMenu:ke,onTaskToggle:V0,scrollTop:L,columns:jo,onToggleColumn:U0,onColumnResize:W0,onTaskUpdate:Ko,onTaskIndent:G0,onTaskOutdent:_0,onTaskMove:K0,onMultiTaskDelete:Ki,onTaskDuplicate:Y0,onTaskCreate:q0,onTaskRename:X0,onCreateSubtask:Yi,onOpenTaskModal:M?F=>M(F):void 0,onDeleteRequest:(F,R)=>Se({taskId:F,taskName:R}),onTaskReparent:j0,scrollContainerRef:bs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Qt.border,zIndex:15},onMouseDown:sf}),jsx("div",{ref:Ir,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Xi?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(gi,{tasks:Mc,theme:Qt,rowHeight:hs,timeScale:Ye,startDate:Yo,endDate:qi,zoom:D,locale:x,templates:Pc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:M,onTaskDblClick:Ac,onTaskContextMenu:Q0,onTaskDateChange:J0,onDependencyCreate:Ic,onDependencyDelete:Bc,showBaseline:He,showCriticalPath:Ne,showDependencies:it,highlightWeekends:nt,canEditTask:Me?.canEditTask})})]}),Re.task&&jsx(gn,{isOpen:Re.isOpen,x:Re.x,y:Re.y,theme:Qt,onClose:()=>je({isOpen:false,x:0,y:0,task:null}),items:(()=>{let F=Re.task;if(!F)return [];let R=Ae.findTaskById(me,F.id)||F,_=R.subtasks&&R.subtasks.length>0,Q=Me?.canCreateTask!==false,we=Me?.canDeleteTask!==false;if(_){let Ot=[],qt=Me?.canDuplicateTask!==false;return Q&&Ot.push({id:"addSubtask",label:Ga.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{Te?Te(R):Yi(R.id);}}),qt&&Ot.push({id:"duplicate",label:Ga.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Ge(Wa=>Kn(Wa,[R.id]).tasks),je({isOpen:false,x:0,y:0,task:null});}}),we&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:Ga.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{Se({taskId:R.id,taskName:R.name});}})),Ot}let Pe=Me?.canUpdateTask!==false,bt=Me?.canDuplicateTask!==false,Ze=[];return Pe&&Ze.push({id:"edit",label:Ga.contextMenu?.editTask||"Edit Task",icon:jt.Pencil,onClick:()=>{re?re(R):St(R);}}),Q&&Ze.push({id:"addSubtask",label:Ga.contextMenu?.addSubtask||"Add Subtask",icon:jt.Add,onClick:()=>{Te?Te(R):Yi(R.id);}}),Ze.length>0&&Pe&&Ze.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(Ze.push({id:"markIncomplete",label:Ga.contextMenu?.markIncomplete||"Mark Incomplete",icon:jt.MarkIncomplete,onClick:()=>{$?$(R):Ko(R.id,{status:"todo",progress:0});},disabled:R.status==="todo"}),Ze.push({id:"setInProgress",label:Ga.contextMenu?.setInProgress||"Set In Progress",icon:jt.SetInProgress,onClick:()=>{Z?Z(R):Ko(R.id,{status:"in-progress"});},disabled:R.status==="in-progress"}),Ze.push({id:"markComplete",label:Ga.contextMenu?.markComplete||"Mark Complete",icon:jt.MarkComplete,onClick:()=>{Ko(R.id,{status:"completed",progress:100});},disabled:R.status==="completed"})),(bt||Pe&&R.startDate&&R.endDate)&&Ze.length>0&&Ze.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),bt&&Ze.push({id:"duplicate",label:Ga.contextMenu?.duplicateTask||"Duplicate Task",icon:jt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(R):Ge(Ot=>Kn(Ot,[R.id]).tasks),je({isOpen:false,x:0,y:0,task:null});}}),Pe&&R.startDate&&R.endDate&&Ze.push({id:"split",label:Ga.contextMenu?.splitTask||"Split Task",icon:jt.Split,onClick:()=>{let Ot=R.startDate.getTime(),qt=R.endDate.getTime(),Wa=Ot+(qt-Ot)/2,lr=new Date(Wa);Z0(R,lr);}}),we&&(Ze.length>0&&Ze.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ze.push({id:"delete",label:Ga.contextMenu?.deleteTask||"Delete Task",icon:jt.Delete,onClick:()=>{Se({taskId:R.id,taskName:R.name});}})),Ze})()}),jsx(Xr,{task:gt,isOpen:!!gt,onClose:()=>St(null),onTaskUpdate:F=>{gt&&(Ko(gt.id,F),St(null));},theme:xe==="light"?"light":"dark",locale:x==="es"?"es":"en",availableUsers:i,availableTasks:t}),jsx(AnimatePresence,{children:Yt&&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:()=>Se(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:F=>F.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:[Ga.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:x==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},children:[x==="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:['"',Yt.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:()=>Se(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Qt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=Qt.hoverBg;},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent";},children:x==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ki([Yt.taskId]),Se(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:F=>{F.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),x==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(hi,{tasks:me,theme:Qt,config:f,onTasksUpdate:Ge,onTaskUpdate:Ko,onTaskCreate:F=>{Ge(R=>[...R,F]);},onTaskDelete:F=>{Ki([F]);},onDependencyCreate:(F,R)=>{let _=Ae.findTaskById(me,F);_&&Ic(_,R);},onDependencyDelete:Bc})]})})})});function Uv(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 Wv(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 d=parseInt(a[1],10),p=parseInt(a[2],10);return d*60+p}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var fd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],bd=[{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 um({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:p="dark",customStatuses:l=[],availableTags:c=[],onCreateTag:i,attachments:m=[],onUploadAttachments:g,onDeleteAttachment:h,defaultStatus:b}){let w=[...fd,...l.filter(D=>!fd.some(j=>j.id===D.id))],f=et[p]||et.dark,[x,k]=useState(false),[v,C]=useState(false),[N,E]=useState(false),[T,B]=useState(false),[O,I]=useState({top:0,left:0}),[G,S]=useState(null),[ce,M]=useState(new Date),[q,ke]=useState({top:0,left:0}),[_e,P]=useState(false),[V,re]=useState([]),[Te,$]=useState(false),[Z,X$1]=useState(""),fe=useRef(null),Fe=useRef(null),Ke=useRef(null),qe=useRef(null),ot=useRef(null),[ne,ut]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[]}),[Me,ct]=useState({});useEffect(()=>{a?(ut({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#2E94FF",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&P(true)):(ut({name:"",description:"",progress:0,status:b||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),P(false),re([]));},[a,e,b]),useEffect(()=>{let D=j=>{fe.current&&!fe.current.contains(j.target)&&k(false),Fe.current&&!Fe.current.contains(j.target)&&C(false),Ke.current&&!Ke.current.contains(j.target)&&E(false),qe.current&&!qe.current.contains(j.target)&&B(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let Dt=()=>{let D={};return ne.name.trim()||(D.name="El nombre es requerido"),ne.startDate&&ne.endDate&&ne.startDate>ne.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),ct(D),Object.keys(D).length===0},Tt=async D=>{if(D.preventDefault(),!!Dt())try{let j=d==="create"&&V.length>0?{...ne,pendingFiles:V}:ne;await s(j),re([]),t();}catch(j){console.error("Error submitting task:",j);}},xe=(D,j)=>{ut(se=>{let ye={...se,[D]:j};if(D==="status"){let W=j;W==="todo"?ye.progress=0:W==="in-progress"?(se.progress===0||se.progress===100)&&(ye.progress=50):W==="completed"||W==="closed"?ye.progress=100:(W==="in-review"||W==="review")&&(ye.progress=75);}if(D==="progress"){let W=typeof j=="number"?j:parseInt(j,10);W===100&&se.status!=="completed"?ye.status="completed":W>0&&W<100&&se.status==="todo"?ye.status="in-progress":W===0&&se.status!=="todo"&&(ye.status="todo");}return ye}),Me[D]&&ct(se=>{let ye={...se};return delete ye[D],ye});},rt=w.find(D=>D.id===ne.status)??fd[0],Ye=bd.find(D=>D.id===ne.priority)??bd[1],Je=Mo.find(D=>D.value===ne.color)??Mo[0],H=p==="dark",le={backgroundColor:H?"#141414":f.bgSecondary,border:`1px solid ${H?"#262626":f.borderLight}`,color:f.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-50",style:{backgroundColor:H?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl pointer-events-auto overflow-hidden","data-theme":p,style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,WebkitBackdropFilter:H?"blur(16px)":void 0,border:`1px solid ${f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 32px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:rt.color||f.accent}}),jsx("span",{style:{fontSize:13,fontWeight:500,color:f.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=f.hoverBg,D.currentTarget.style.color=f.textPrimary;},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=f.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Tt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",style:{fontFamily:"Inter, sans-serif"},children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:ne.name,onChange:D=>xe("name",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:22,fontWeight:700,fontFamily:"Inter, sans-serif",opacity:ne.name?1:void 0},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Me.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Me.name]})]}),jsx("div",{children:jsx("textarea",{value:ne.description||"",onChange:D=>xe("description",D.target.value),className:"w-full bg-transparent border-none focus:outline-none focus:ring-0 resize-none",style:{color:f.textSecondary,fontSize:13,fontFamily:"Inter, sans-serif"},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${f.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!x),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...le,borderColor:rt.color,backgroundColor:`${rt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:rt.color}}),jsx("span",{style:{color:rt.color},children:rt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:rt.color}})]}),jsx(AnimatePresence,{children:x&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:w.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("status",D.id),k(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ne.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:Fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&C(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Ye.color}}),jsx("span",{children:Ye.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:bd.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("priority",D.id),C(false);},children:[jsx("span",{children:D.icon}),D.label,ne.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:Ke,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&E(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[ne.assignees&&ne.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ne.assignees.slice(0,3).map((D,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:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},j))}),ne.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ne.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:N&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let j=ne.assignees?.some(se=>se.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{let se=j?(ne.assignees||[]).filter(ye=>ye.name!==D.name):[...ne.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(ye=>ye[0]).join("").toUpperCase().slice(0,2),color:f.accent}];xe("assignees",se);},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:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.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:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:qe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)B(false);else {if(qe.current){let D=qe.current.getBoundingClientRect(),j=window.innerHeight,se=120,W=j-D.bottom<se?D.top-se-8:D.bottom+8;I({top:W,left:D.left});}B(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ne.color}}),jsx("span",{children:Je.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(It,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>B(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:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Mo.slice(0,18).map(D=>{let j=ne.color===D.value;return jsx("button",{type:"button",onClick:se=>{se.preventDefault(),se.stopPropagation(),xe("color",D.value),B(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:j?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),c.length>0||i?jsx(lo,{selectedTags:ne.tags||[],availableTags:c,onChange:D=>xe("tags",D),onCreateTag:i,theme:f,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ne.isMilestone)if(G==="start")S(null);else {if(ot.current){let D=ot.current.getBoundingClientRect(),j=window.innerHeight,se=320,W=j-D.bottom<se?D.top-se-8:D.bottom+8;ke({top:W,left:D.left});}S("start"),M(ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:n||ne.isMilestone,children:ne.startDate?ne.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ne.isMilestone)if(G==="end")S(null);else {if(ot.current){let D=ot.current.getBoundingClientRect(),j=window.innerHeight,se=320,W=j-D.bottom<se?D.top-se-8:D.bottom+8;ke({top:W,left:D.left});}S("end"),M(ne.endDate||ne.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ne.isMilestone?.5:1,cursor:ne.isMilestone?"not-allowed":"pointer"},disabled:n||ne.isMilestone,children:ne.endDate?ne.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:G&&jsxs(It,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(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:`${q.top}px`,left:`${q.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,j=new Date(D);j.setDate(D.getDate()+1);let se=new Date(D);se.setDate(D.getDate()+7);let ye=new Date(D);return ye.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:se},{label:"2 semanas",date:ye}].map((te,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{G==="start"?(xe("startDate",te.date),(!ne.endDate||te.date>ne.endDate)&&xe("endDate",te.date),S("end")):(xe("endDate",te.date),(!ne.startDate||te.date<ne.startDate)&&xe("startDate",te.date),S(null));},children:te.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{xe("startDate",void 0),xe("endDate",void 0),S(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:()=>M(new Date(ce.getFullYear(),ce.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ce.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>M(new Date(ce.getFullYear(),ce.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,j)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},j))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=ce.getFullYear(),j=ce.getMonth(),se=new Date(D,j,1).getDay(),ye=new Date(D,j+1,0).getDate(),W=new Date,te=[];for(let Ce=se-1;Ce>=0;Ce--)te.push({day:new Date(D,j,-Ce).getDate(),date:new Date(D,j-1,new Date(D,j,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=ye;Ce++)te.push({day:Ce,date:new Date(D,j,Ce),isCurrentMonth:true});let Oe=42-te.length;for(let Ce=1;Ce<=Oe;Ce++)te.push({day:Ce,date:new Date(D,j+1,Ce),isCurrentMonth:false});return te.map((Ce,He)=>{let Ne=Ce.date.toDateString()===W.toDateString(),ze=ne.startDate?.toDateString()===Ce.date.toDateString(),it=ne.endDate?.toDateString()===Ce.date.toDateString(),st=ne.startDate&&ne.endDate&&Ce.date>=ne.startDate&&Ce.date<=ne.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ce.isCurrentMonth?ze||it?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:ze?f.accent:it?"#7C3AED":st?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!ze&&!it?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{G==="start"?(xe("startDate",Ce.date),ne.endDate&&Ce.date>ne.endDate&&xe("endDate",Ce.date),S("end")):(xe("endDate",Ce.date),ne.startDate&&Ce.date<ne.startDate&&xe("startDate",Ce.date),S(null));},children:Ce.day},He)})})()})]})]})]})})]}),Me.endDate&&jsx("span",{className:"text-xs text-red-400",children:Me.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:f.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ne.progress,onChange:D=>xe("progress",parseInt(D.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,accentColor:ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981"}20`,color:ne.progress<30?"#EF4444":ne.progress<70?"#F59E0B":"#10B981",fontFamily:"JetBrains Mono, monospace"},children:[ne.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>P(!_e),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:f.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${_e?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:_e&&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:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ne.effortMinutes?Uv(ne.effortMinutes):"",onChange:D=>{let j=Wv(D.target.value);xe("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(g||m.length>0||d==="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:f.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:f.textTertiary},children:["Adjuntos ",d==="create"?V.length>0&&`(${V.length})`:m.length>0&&`(${m.length})`]})]}),d==="create"?jsx(zr,{cardId:"pending",attachments:V.map((D,j)=>({id:`pending-${j}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>re(j=>[...j,...D]),onDelete:D=>{let j=parseInt(D.replace("pending-",""),10);re(se=>se.filter((ye,W)=>W!==j));},maxSizeMB:10,maxFiles:20}):jsx(zr,{cardId:a?.id||"new",attachments:m,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:h,maxSizeMB:10,maxFiles:20}),d==="create"&&V.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[V.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ne.isMilestone,onChange:D=>xe("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ne.dependencies&&ne.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ne.dependencies.map(D=>{let j=r.find(se=>se.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[j?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let se=(ne.dependencies||[]).filter(ye=>ye!==D);xe("dependencies",se);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{$(!Te),X$1("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$(false),X$1("");}}),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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"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 ${f.border}`},children:jsx("input",{type:"text",value:Z,onChange:D=>X$1(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>Z===""||D.name.toLowerCase().includes(Z.toLowerCase())).map(D=>{let j=ne.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let se=ne.dependencies||[],ye;j?ye=se.filter(W=>W!==D.id):ye=[...se,D.id],xe("dependencies",ye);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${f.accent}10`:"transparent"},onMouseEnter:se=>{j||(se.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:se=>{se.currentTarget.style.backgroundColor=j?`${f.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?f.accent:"transparent",borderColor:j?f.accent:f.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:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${f.border}`,fontFamily:"Inter, sans-serif"},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 rounded-lg transition-colors",style:{color:f.textSecondary,fontSize:13},onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:f.accent,color:"#FFF",fontSize:13},onMouseEnter:D=>!n&&(D.currentTarget.style.opacity="0.9"),onMouseLeave:D=>!n&&(D.currentTarget.style.opacity="1"),children:n?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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var pm=`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,39 +406,39 @@ 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 pm(e){return `CURRENT TASKS:
410
- ${mm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
409
+ If ambiguous, ask for clarification in the message field.`;function mm(e){return `CURRENT TASKS:
410
+ ${gm(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function mm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ao(e,t){let a=mm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let p=d.name.toLowerCase();return n.every(l=>p.includes(l))})}function bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let h=new Date(r),b=h.getDay(),w=g-b;return w<=0&&(w+=7),h.setDate(h.getDate()+w),h}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),h=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?h.setDate(h.getDate()+m):g==="week"||g==="semana"||g==="semanas"?h.setDate(h.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&h.setMonth(h.getMonth()+m),h}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,h=parseInt(d[3],10);return new Date(h,g,m)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=p[l[2].toLowerCase()],h=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(h,g,m)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=c[i[1].toLowerCase()],g=parseInt(i[2],10),h=i[3]?parseInt(i[3],10):r.getFullYear();if(m!==void 0)return new Date(h,m,g)}return null}function hd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function yd(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 gm(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 fm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),c=r[2].trim(),i=ao(t,l),m=bd(c);if(!i)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:i.id,taskName:i.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,h=new Date(m);return h.setDate(h.getDate()+g),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:m,endDate:h},message:`Moved "${i.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),c=o[2].trim(),i=ao(t,l),m=hd(c);if(!i)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(i.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:g},message:`Extended "${i.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),c=s[2].trim(),i=ao(t,l),m=yd(c);return i?m===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:m},message:`Set "${i.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),c=n[2].trim(),i=ao(t,l);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:c},message:`Renamed "${i.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let l=d[1].trim(),c=d[2].trim(),i=ao(t,l),m=ao(t,c);return i?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:i.id,dependencyTo:m.id,message:`Linked "${i.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let l=p[1].trim(),c=ao(t,l);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function bm(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function Uv(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 Wv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function xi(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let i=a.find(m=>m.id===c);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>xi(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),p=n(e.endDate),l=e.metadata?.isMilestone===true||d&&p&&Math.abs(p.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:p,progress:e.progress||0,status:Uv(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function hm(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:Wv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function ym(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>xi(r,e,t))}var xd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},vd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Carga Equipo",blockers:"Bloqueantes"},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"}},vi={en:xd,es:vd};function wd(e){return vi[e]||vi.en}function wi(e,t){let a=wd(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 kd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function xm(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 vm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let p=xm(e),l=kd[0],c=kd.find(g=>g.value===p)??l,i=c.icon,m=g=>{switch(xm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(i,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(i,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:kd.map(g=>{let h=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",p===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(h,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Cd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function km({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let c=i=>{d.current&&!d.current.contains(i.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let p=Cd.find(c=>c.value===e)??Cd[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",p.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:p.label[l]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",p.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:p.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Cd.map(c=>jsxs("button",{onClick:i=>{i.stopPropagation(),t(c.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===c.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[l]})]},c.value))})]})}function Zn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Td(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Dm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[p,l]=useState(""),c=useRef(null),i=useRef(null);useEffect(()=>{let b=w=>{c.current&&!c.current.contains(w.target)&&(d(false),l(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&i.current&&i.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())),g=b=>e.some(w=>w.name===b),h=b=>{if(a){if(g(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:Zn(b.name),color:b.color||Td(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,w]);}d(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)},`${b.name}-${w}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:c,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Td(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)},`${b.name}-${w}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:i,type:"text",value:p,onChange:b=>l(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.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((b,w)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${w}`))}),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:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let w=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),h(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:w?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{w||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{w||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Zn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),w&&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"}})})]},b.id)})})]})]})}function Fm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:p}){let[l,c]=useState(false),[i,m]=useState(o),[g,h]=useState(()=>{let E=o==="start"?e:t;if(E){let T=E instanceof Date?E:new Date(E);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),w=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let E=T=>{b.current&&!b.current.contains(T.target)&&c(false);};return l&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[l]),useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let x=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):p||"-",k=useCallback(()=>{let E=g.getFullYear(),T=g.getMonth(),B=new Date(E,T,1),I=new Date(E,T+1,0).getDate(),G=B.getDay(),S=[],M=new Date(E,T,0).getDate();for(let ke=G-1;ke>=0;ke--)S.push({date:new Date(E,T-1,M-ke),isCurrentMonth:false});for(let ke=1;ke<=I;ke++)S.push({date:new Date(E,T,ke),isCurrentMonth:true});let q=42-S.length;for(let ke=1;ke<=q;ke++)S.push({date:new Date(E,T+1,ke),isCurrentMonth:false});return S},[g]),v=E=>{if(r)o==="start"?a(E,f||void 0):a(w||void 0,E),c(false);else if(i==="start"){let T=f&&E>f?E:f;a(E,T||void 0),m("end");}else {let T=w&&E<w?E:w;a(T||void 0,E),c(false);}},C=()=>{let E=new Date,T=new Date(E);T.setDate(E.getDate()+1);let B=new Date(E);B.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let O=new Date(E);O.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let G=new Date(E);G.setDate(E.getDate()+14);let S=new Date(E);return S.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:B,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:O,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let E=r&&o==="start"?w:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(E)})]})}let N=r&&o==="start"?w:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:E=>{E.stopPropagation(),c(!l);let T=o==="start"?w:f;T&&h(new Date(T.getFullYear(),T.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(N)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((E,T)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>v(E.date),children:[jsx("span",{children:E.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},T)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(w||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:i==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>h(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k().map((E,T)=>{let B=E.date.toDateString()===new Date().toDateString(),O=w?.toDateString()===E.date.toDateString(),I=f?.toDateString()===E.date.toDateString(),G=O||I,S=!r&&w&&f&&E.date>=w&&E.date<=f;return jsx("button",{onClick:()=>v(new Date(E.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),B&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",I&&!O&&"bg-[#7C3AED] text-white",S&&!G&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!G&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},T)})})]})]})]})]})}function Ti({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let p=e?e instanceof Date?e:new Date(e):null;return jsx(Fm,{startDate:s==="start"?p:n||null,endDate:s==="end"?p:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function wn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ni(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,p]=useState(false),l=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let i=l.current??0,m=e,g=m-i,h=r/o;p(true);for(let b=1;b<=o;b++){let w=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),k=Math.round(i+g*x);n(k),b===o&&(p(false),n(m));},h*b);c.current.push(w);}return l.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Pm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),p=useRef(null),l=useRef(null),c=useCallback(g=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current),s(g),d(0);let h=Date.now();l.current=setInterval(()=>{let b=Date.now()-h,w=Math.min(b/a*100,100);d(w);},16),p.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),d(0);},a);},[a,e]),i=useCallback(()=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:i}}function Lm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=wn(),{displayValue:p,isAnimating:l}=Ni(e,{enabled:o,duration:300,steps:6}),c=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),h=m.clientX-g.left,b=Math.round(h/g.width*100),w=Math.max(0,Math.min(100,b));w!==e&&(t(w),s&&d());},i=p??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:c,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",i===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",l&&"transition-none"),style:{width:`${i}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",l&&"font-medium scale-105"),children:[i,"%"]})]})}function Rm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,p]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{p(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},i=m=>{m.key==="Enter"?c():m.key==="Escape"&&(p(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:d,onChange:m=>p(m.target.value),onBlur:c,onKeyDown:i,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Hm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:p=true}){let[l,c]=useState(false),[i,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:h,triggerFlash:b}=wn(),{displayValue:w,isAnimating:f}=Ni(e,{enabled:d&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let v=parseFloat(i);if(!isNaN(v)){let C=v;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),p&&b());}c(false);},k=v=>{v.key==="Enter"?x():v.key==="Escape"&&(m(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:w!==void 0?w:r}):l?jsx("input",{ref:g,type:"number",value:i,onChange:v=>m(v.target.value),onBlur:x,onKeyDown:k,onClick:v=>v.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:v=>{v.stopPropagation(),c(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",w===void 0&&(a?"text-white/30":"text-gray-400"),h&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:w!==void 0?w:r})}function zm({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),p=useRef(null);return useEffect(()=>{let l=c=>{p.current&&!p.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),d(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(l),d(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function Wm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:p,startChange:l,cancelChange:c}=Pm(t,{delay:s}),i=g=>{g.stopPropagation(),!r&&t&&(o?d?c():l(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:i,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&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:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${p/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),c();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function _m({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function T2(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 N2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),p=parseInt(a[2],10);return d*60+p}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),p=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+p}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:p="hours",hourlyRate:l=0}){let[c,i]=useState(false),[m,g]=useState(""),h=useRef(null),{isFlashing:b,triggerFlash:w}=wn(),f=p==="financial"&&l>0,x=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:T2(e,r);useEffect(()=>{c&&h.current&&(h.current.focus(),h.current.select());},[c]),useEffect(()=>{if(e){let N=Math.floor(e/60),E=e%60;N>0&&E>0?g(`${N}h ${E}m`):N>0?g(`${N}h`):g(`${E}m`);}else g("");},[e,c]);let k=()=>{let N=N2(m);N!==e&&(t?.(N),n&&w()),i(false);},v=N=>{N.key==="Enter"?k():N.key==="Escape"&&i(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:x})]}):c?jsx("input",{ref:h,type:"text",value:m,onChange:N=>g(N.target.value),onBlur:k,onKeyDown:v,onClick:N=>N.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:N=>{N.stopPropagation(),i(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:x})]})}function qm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function Jm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:p="hours",hourlyRate:l=0}){let c=a==="es",i=p==="financial"&&l>0,m=P=>i?`$${Math.round(P*l).toLocaleString("en-US")}`:`${P}h`,[g,h]=useState(false),[b,w]=useState(false),[f,x]=useState(null),k=useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,E=Math.round(v/60*10)/10,T=Math.round(C/60*10)/10,B=Math.round(N/60*10)/10,O=C>0?v/C*100:0,I=O>100?Math.round((v-C)/60*10)/10:0,G=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";useEffect(()=>{if(!b&&!f)return;let P=V=>{k.current&&!k.current.contains(V.target)&&(w(false),x(null));};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[b,f]);let S=P=>{if(P.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){w(V=>!V),x(null);return}d&&d(e);},ce=P=>{w(false),x(P);},M=async(P,V)=>{f==="log"&&r&&P?r(e,P,V):f==="estimate"&&o?o(e,P):f==="quoted"&&s&&s(e,P),x(null);},q=r||o||s||d,ke=[{mode:"log",icon:Clock,label:c?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:c?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:c?"T. Ofertado":"Quoted time",show:!!s}].filter(P=>P.show),_e=f==="estimate"?C:f==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:P=>P.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:S,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:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&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:ke.map(P=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(P.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:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsx(AnimatePresence,{children:f&&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(Or,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:M,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:P=>P.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(E)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),I>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",m(I)," ",c?"Exceso":"Over"]})]}),C>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(O,100)}%`,backgroundColor:G,borderRadius:2,transition:"width 0.3s"}})}),N>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[c?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(B)})]})]}),q&&jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&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:ke.map(P=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(P.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:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsx(AnimatePresence,{children:f&&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(Or,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:M,onClose:()=>x(null)})})})})]})}function Qm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF2D20]/15 text-[#FF2D20]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#3BF06E]/15 text-[#3BF06E]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:u("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:u("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var M2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function eg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",M2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function q2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function X2(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 og({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:p,onColumnSort:l,availableUsers:c=[],onOpenTimeLog:i,onReportBlocker:m,onCopyTaskLink:g}){let h=useRef(null),b=r==="es"?ag.es:ag.en;if(useEffect(()=>{let v=N=>{h.current&&!h.current.contains(N.target)&&t();},C=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],T=N.some(B=>B.name===C.name)?N.filter(B=>B.name!==C.name):[...N,{name:C.name,initials:q2(C.name),color:C.color||X2(C.name),avatar:C.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),i&&v.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{i(e.task),t();}}),m&&v.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&v.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},f=()=>{if(!e.columnId)return [];let v=[];return l&&(v.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),p&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{p(e.columnId),t();}})),v},x=e.type==="task"?w():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:h,style:k,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(v=>v.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},v.id):v.submenu?jsx(J2,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(v.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function J2({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var ag={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var pg={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"}),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"})},g1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function gg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[p,l]=useState(""),[c,i]=useState(null),m=useRef(null),g=d==="es"?mg.es:mg.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let v=()=>{if(!m.current)return;let C=m.current.getBoundingClientRect(),E=window.innerHeight-C.top-20;i(Math.max(300,E));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let C=E=>{m.current&&!m.current.contains(E.target)&&t();},N=E=>{E.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",N),m._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(v),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let h=v=>g.columns[v]||v,b=v=>{if(v==="name")return;let C=a.map(N=>N.id===v?{...N,visible:!N.visible}:N);o(C);},w=(v,C)=>{let N=a.find(T=>T.type===v&&(!C||T.customFieldId===C));if(N){b(N.id);return}let E={id:C||v,type:v,label:C?r.find(T=>T.id===C)?.name||v:h(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,E]);},f=g1.filter(v=>h(v).toLowerCase().includes(p.toLowerCase())),x=r.filter(v=>v.name.toLowerCase().includes(p.toLowerCase())),k=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...c?{maxHeight:`${c}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:p,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",k);},onFocus:v=>{v.currentTarget.style.borderColor=k,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(T=>T.type===v&&!T.customFieldId),N=C?.visible??false,E=v==="name";return jsxs("button",{onClick:()=>{E||(C?b(C.id):w(v));},disabled:E,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:E?.4:1,cursor:E?"not-allowed":"pointer"},onMouseEnter:T=>{E||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.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?k:"transparent",border:N?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:pg[v]}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:h(v)})]},v)})})]}),x.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:x.map(v=>{let N=a.find(E=>E.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>w(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:E=>{E.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:E=>{E.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?k:"transparent",border:N?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:pg[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:v.name})]},v.id)})})]})]})]})}var mg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var C1=[{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 hg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,p]=useState("text"),[l,c]=useState([""]),i=o==="es"?bg.es:bg.en;useEffect(()=>{e&&(n(""),p("text"),c([""]));},[e]),useEffect(()=>{let w=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,t]);let m=()=>{if(!s.trim())return;let w={name:s.trim(),type:d};d==="dropdown"&&(w.options=l.filter(f=>f.trim())),a(w),t();},g=()=>{c([...l,""]);},h=(w,f)=>{let x=[...l];x[w]=f,c(x);},b=w=>{l.length>1&&c(l.filter((f,x)=>x!==w));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:i.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.fieldName}),jsx("input",{type:"text",value:s,onChange:w=>n(w.target.value),placeholder:i.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:C1.map(w=>jsxs("button",{onClick:()=>p(w.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===w.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===w.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:w.icon}),jsx("span",{className:u("text-xs",d===w.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:i.types[w.type]})]},w.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.options}),jsxs("div",{className:"space-y-2",children:[l.map((w,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:w,onChange:x=>h(f,x.target.value),placeholder:`${i.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>b(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),i.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:i.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:i.create})]})]})]}):null}var bg={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 vg={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 wg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),p=useRef(null),l=useRef(0),c=s==="es"?vg.es:vg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-l.current<100||p.current&&!p.current.contains(b.target)&&d(false);},h=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h);}},[n]);let i=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),d(h=>!h);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,m&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:i.map(g=>{let h=e===g.value&&!t,b=()=>g.value==="all"?h?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",h&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(h?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),h&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function kg(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 Cg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title: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"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,p=s>n&&n>0,l=p?"#FF2D20":d>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children: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:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",p?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:kg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:kg(n)})]}),n>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:l}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children: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:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,p=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var H1=[{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 Fg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Fg(r.subtasks,t+1));return a}function z1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),p=s.endDate.getTime()-n;if(p<=0)continue;let c=Math.max(0,Math.min(a.getTime()-n,p))/p*100;if(c<=0)continue;let i=(s.progress||0)/c;r+=i,o++;}return o>0?r/o:null}function U1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Nn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Nn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Tn(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 Pg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:p=[],toolbarRightContent:l}){let{theme:c="dark",locale:i="en",customTranslations:m,showSearch:g=true,showHierarchy:h=true,tableColumns:b,allowColumnCustomization:w=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:v,persistFilter:C=false,financialBlur:N,healthSidebar:E,lens:T="hours",hourlyRate:B=0,aggregateParentHours:O=false,showProjectTotals:I=false}=t,G=wi(i,m),S=c==="dark",ce=useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let y=localStorage.getItem(C);if(y){let L=JSON.parse(y);return {statusFilter:L.statusFilter||"all",hideCompleted:L.hideCompleted||!1}}}catch(y){console.error("Error loading persisted filter:",y);}return {statusFilter:"all",hideCompleted:false}},[C]),M=useMemo(()=>{function y(L){let z=0,J=0,de=0;for(let ge of L)if(ge.subtasks&&ge.subtasks.length>0){let Y=y(ge.subtasks);z+=Y.spent,J+=Y.allocated,de+=Y.quoted;}else z+=ge.timeLoggedMinutes??0,J+=ge.effortMinutes??0,de+=ge.soldEffortMinutes??0;return {spent:z,allocated:J,quoted:de}}return y(e)},[e]),q=useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:M.spent,totalHoursAllocatedMinutes:M.allocated}},[E,M]),[ke,_e]=useState(true),[P,V]=useState("position"),[re,Te]=useState("asc"),[$,Z]=useState(""),[X,fe]=useState(()=>ce().statusFilter),[Fe,Ke]=useState(()=>ce().hideCompleted),[qe,ot]=useState(b||H1),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState({isOpen:false,x:0,y:0,type:"task"}),[xe,rt]=useState(null),[Ye,Je]=useState(0),[H,le]=useState(0),D=useRef(null),[j,se]=useState(null),[ye,W]=useState(null);useEffect(()=>{b&&ot(b);},[b]),useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:X,hideCompleted:Fe}));}catch(y){console.error("Error persisting filter state:",y);}},[C,X,Fe]);let te=useMemo(()=>{let y=new Set;function L(z){for(let J of z)J.subtasks?.length&&(J.isExpanded!==false&&y.add(J.id),L(J.subtasks));}return L(e),y},[e]),Oe=useMemo(()=>qe.filter(y=>y.visible),[qe]),Ce=useCallback(y=>{a.onTaskToggleExpand?.(y);},[a]),He=useCallback(y=>{P===y?Te(L=>L==="asc"?"desc":"asc"):(V(y),Te("asc")),a.onSortChange?.({column:y,direction:re==="asc"?"desc":"asc"});},[P,re,a]),Ne=useCallback(y=>{ot(y),a.onColumnsChange?.(y);},[a]),ze=useCallback(y=>{let L=qe.map(z=>z.id===y?{...z,visible:false}:z);Ne(L);},[qe,Ne]),it=useCallback((y,L)=>{V(y),Te(L);},[]),st=useCallback((y,L,z)=>{x&&(y.preventDefault(),Tt({isOpen:true,x:y.clientX,y:y.clientY,type:L?"task":"header",task:L,columnId:z}));},[x]),nt=useCallback(()=>{Tt(y=>({...y,isOpen:false}));},[]),pt=useCallback((y,L)=>{if(!f)return;y.preventDefault(),y.stopPropagation();let z=qe.find(J=>J.id===L);z&&(rt(L),Je(y.clientX),le(z.width));},[qe,f]);useEffect(()=>{if(!xe)return;let y=z=>{let J=z.clientX-Ye,de=Math.max(50,H+J),ge=qe.map(Y=>Y.id===xe?{...Y,width:de}:Y);ot(ge);},L=()=>{xe&&a.onColumnsChange?.(qe),rt(null);};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",L),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",L);}},[xe,Ye,H,qe,a]);let Rt=useCallback((y,L)=>{if(L==="name"){y.preventDefault();return}se(L),y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",L),y.currentTarget instanceof HTMLElement&&(y.currentTarget.style.opacity="0.5");},[]),Et=useCallback(y=>{y.currentTarget instanceof HTMLElement&&(y.currentTarget.style.opacity="1"),se(null),W(null);},[]),dt=useCallback((y,L)=>{y.preventDefault(),L!=="name"&&(y.dataTransfer.dropEffect="move",W(L));},[]),mt=useCallback(()=>{W(null);},[]),Nt=useCallback((y,L)=>{if(y.preventDefault(),!j||j===L||L==="name")return;let z=[...qe],J=z.findIndex(Y=>Y.id===j),de=z.findIndex(Y=>Y.id===L);if(J===-1||de===-1)return;let ge=z.splice(J,1);ge[0]&&(z.splice(de,0,ge[0]),Ne(z),se(null),W(null));},[j,qe,Ne]),Lt=useCallback(async y=>{if(a.onCreateCustomField){let L={...y,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(L);}ct(false);},[a]),Ie=useCallback(y=>y.progress===100||y.status==="completed"?"completed":y.progress&&y.progress>0||y.status==="in-progress"?"in-progress":"todo",[]),Be=useMemo(()=>{let y=Fg(e);if($.trim()){let L=$.toLowerCase();y=y.filter(z=>z.name.toLowerCase().includes(L));}return X!=="all"&&(y=y.filter(L=>Ie(L)===X)),Fe&&(y=y.filter(L=>Ie(L)!=="completed")),y.sort((L,z)=>{let J,de;switch(P){case "name":J=L.name.toLowerCase(),de=z.name.toLowerCase();break;case "startDate":J=L.startDate?.getTime()||0,de=z.startDate?.getTime()||0;break;case "endDate":J=L.endDate?.getTime()||0,de=z.endDate?.getTime()||0;break;case "progress":J=L.progress||0,de=z.progress||0;break;case "status":J=L.status||"todo",de=z.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};J=ge[L.priority]??4,de=ge[z.priority]??4;break;case "position":return 0;default:return 0}return J<de?re==="asc"?-1:1:J>de?re==="asc"?1:-1:0}),y},[e,$,X,Fe,P,re,Ie]),K=useCallback((y,L)=>{let z=ge=>{a.onTaskUpdate?.({...y,...ge});},J=ge=>ge?y.customFields?.find(Re=>Re.fieldId===ge)?.value:void 0,de=(ge,Y)=>{if(!ge)return;let je=[...y.customFields||[]],gt=je.findIndex(St=>St.fieldId===ge);gt>=0?je[gt]={fieldId:ge,value:Y}:je.push({fieldId:ge,value:Y}),z({customFields:je});};switch(L.type){case "name":return null;case "status":return jsx(vm,{value:y.status||(y.progress===100?"completed":y.progress&&y.progress>0?"in-progress":"todo"),onChange:Y=>{z({status:Y,progress:Y==="completed"?100:Y==="in-progress"?50:0});},isDark:S,locale:i,translations:G.status});case "priority":return jsx(km,{value:y.priority,onChange:Y=>z({priority:Y}),isDark:S,locale:i});case "assignees":return jsx(Dm,{value:y.assignees||[],availableUsers:d,onChange:Y=>z({assignees:Y}),isDark:S,locale:i});case "startDate":return jsx(Ti,{value:y.startDate,onChange:Y=>z({startDate:Y}),isDark:S,locale:i,dateField:"start",startDate:y.startDate,endDate:y.endDate});case "endDate":return jsx(Ti,{value:y.endDate,onChange:Y=>z({endDate:Y}),isDark:S,locale:i,dateField:"end",startDate:y.startDate,endDate:y.endDate});case "progress":return jsx(Lm,{value:y.progress||0,onChange:Y=>{let Re=Y===100?"completed":Y>0?"in-progress":"todo";z({progress:Y,status:Re});},isDark:S});case "tags":return jsx(_m,{value:y.tags||[],isDark:S});case "text":return jsx(Rm,{value:J(L.customFieldId)||"",onChange:Y=>de(L.customFieldId,Y),isDark:S});case "number":return jsx(Hm,{value:J(L.customFieldId)||0,onChange:Y=>de(L.customFieldId,Y),isDark:S});case "date":let ge=J(L.customFieldId);return jsx(Ti,{value:ge?new Date(ge):void 0,onChange:Y=>de(L.customFieldId,Y),isDark:S,locale:i});case "dropdown":return jsx(zm,{value:J(L.customFieldId)||"",options:L.options||[],onChange:Y=>de(L.customFieldId,Y),isDark:S});case "checkbox":return jsx(Wm,{value:J(L.customFieldId)||false,onChange:Y=>de(L.customFieldId,Y),isDark:S});case "estimatedTime":{let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.estimatedTime,onChange:Re=>z({estimatedTime:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "quotedTime":{let Y=y.status==="completed"||y.progress===100,Re=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(mr,{value:y.quotedTime,onChange:je=>z({quotedTime:je}),isDark:S,locale:i,disabled:Y,isBlurred:Re,lens:T,hourlyRate:B})}case "elapsedTime":{let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.elapsedTime,onChange:Re=>z({elapsedTime:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "effortMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{allocated:Re}=Nn(y);return jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.effortMinutes,onChange:Re=>z({effortMinutes:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "timeLoggedMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{spent:Re}=Nn(y);return jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.timeLoggedMinutes,onChange:a.onLogTime?Re=>{a.onLogTime?.(y,Re);}:void 0,isDark:S,locale:i,placeholder:i==="es"?"Agregar":"Add",disabled:Y,lens:T,hourlyRate:B})}case "soldEffortMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{quoted:je}=Nn(y),gt=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(mr,{value:je>0?je:void 0,isDark:S,locale:i,disabled:true,isBlurred:gt,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100,Re=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(mr,{value:y.soldEffortMinutes,onChange:je=>z({soldEffortMinutes:je}),isDark:S,locale:i,disabled:Y,isBlurred:Re,lens:T,hourlyRate:B})}case "scheduleVariance":return jsx(qm,{startDate:y.startDate,endDate:y.endDate,scheduleVariance:y.scheduleVariance,isDark:S,locale:i});case "hoursBar":{if(O&&y.hasChildren){let{spent:Y,allocated:Re,quoted:je}=Nn(y),gt=Y>Re&&Re>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",S?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",gt?"text-[#FF453A]":S?"text-white/80":"text-gray-800"),children:Tn(Y)}),Re>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:S?"text-white/60":"text-gray-600",children:Tn(Re)})]}),je>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:S?"text-amber-400/70":"text-amber-600",children:Tn(je)})]})]})}return jsx(Jm,{task:y,isDark:S,locale:i,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:B})}case "teamLoad":return jsx(Qm,{task:y,isDark:S});case "blockers":return jsx(eg,{blockers:y.blockers,isDark:S,locale:i});default:return jsx("span",{className:u("text-sm",S?"text-white/60":"text-gray-500"),children:"-"})}},[a,S,i,d,G,O]),he=useCallback(y=>{let z={name:G.columns.name,status:G.columns.status,priority:G.columns.priority,assignees:G.columns.assignees,startDate:G.columns.startDate,endDate:G.columns.endDate,progress:G.columns.progress,tags:G.columns.tags||(i==="es"?"Etiquetas":"Tags"),estimatedTime:G.columns.estimatedTime||(i==="es"?"Estimado":"Estimated"),quotedTime:G.columns.quotedTime||(i==="es"?"Ofertado":"Quoted"),elapsedTime:G.columns.elapsedTime||(i==="es"?"Ejecutado":"Executed"),soldEffortMinutes:G.columns.soldEffortMinutes||(i==="es"?"Ofertado":"Quoted"),effortMinutes:G.columns.effortMinutes||(i==="es"?"Estimado":"Estimated"),timeLoggedMinutes:G.columns.timeLoggedMinutes||(i==="es"?"Ejecutado":"Executed"),scheduleVariance:G.columns.scheduleVariance||(i==="es"?"Prog / Var":"Sched / Var"),hoursBar:G.columns.hoursBar||(i==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:G.columns.teamLoad||(i==="es"?"Carga Equipo":"Team Load"),blockers:G.columns.blockers||(i==="es"?"Bloqueantes":"Blockers")}[y.type]||y.label;return typeof z=="string"?z:String(z||y.type)},[G,i]),ee=useMemo(()=>{let z=Oe.reduce((de,ge)=>de+ge.width,0)+(w?48:0),J={};for(let de of Oe)J[de.id]=`${de.width/z*100}%`;return J},[Oe,w]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:[G.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",S?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",S?"text-white":"text-gray-900"),children:G.empty.noTasks}),jsx("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:G.empty.addFirstTask})]})}):jsxs("div",{ref:D,className:u(S?"bg-[#0D0D0D]":"bg-white",xe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",S?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:[Be.length," ",G.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",S?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:$,onChange:y=>Z(y.target.value),placeholder:G.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",S?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),jsx(wg,{value:X,hideCompleted:Fe,onChange:fe,onHideCompletedChange:Ke,isDark:S,locale:i}),q?.enabled&&q.data&&!ke&&jsx("button",{onClick:()=>_e(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",S?"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:i==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),k&&v&&jsxs(motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:G.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",S?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Oe.map(y=>{let L=y.id!=="name",z=ye===y.id&&j!==y.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",S?"text-white/60":"text-gray-500",L&&"cursor-grab",j===y.id&&"opacity-50",z&&(S?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:ee[y.id],minWidth:y.minWidth},draggable:L,onDragStart:L?J=>Rt(J,y.id):void 0,onDragEnd:L?Et:void 0,onDragOver:L?J=>dt(J,y.id):void 0,onDragLeave:L?mt:void 0,onDrop:L?J=>Nt(J,y.id):void 0,onContextMenu:J=>st(J,void 0,y.id),children:[L&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",S?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),y.sortable?jsxs("button",{draggable:false,onClick:()=>He(y.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[he(y),jsx(ArrowUpDown,{className:u("w-3 h-3",P===y.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:he(y)}),f&&y.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",xe===y.id&&"bg-[#007BFF]"),onMouseDown:J=>pt(J,y.id)})]},y.id)}),w&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:y=>{y.stopPropagation(),ut(L=>!L);},className:u("p-0.5 rounded transition-colors",S?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ne&&(S?"bg-white/[0.05]":"bg-gray-200")),title:i==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(gg,{isOpen:ne,onClose:()=>ut(false),columns:qe,customFields:p,onColumnsChange:Ne,onCreateCustomField:()=>{ut(false),ct(true);},isDark:S,locale:i})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Be.map((y,L)=>{let z=te.has(y.id),J=Math.min(L*.01,.2),de=y.hasChildren&&y.level===0,ge=y.subtasks?.length||0;if(de){let{spent:Y,allocated:Re,quoted:je}=Nn(y),gt=z1(y),St=U1(y);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:J},className:u("flex items-center border-y cursor-pointer",S?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>Ce(y.id),children:Oe.map(Yt=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:ee[Yt.id],minWidth:Yt.minWidth},children:Yt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Se=>{Se.stopPropagation(),Ce(y.id);},className:u("p-0.5 rounded flex-shrink-0",S?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:z?jsx(ChevronDown,{className:u("w-4 h-4",S?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",S?"text-white/40":"text-gray-500")})}),z?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"}}),y.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"},children:y.wbsCode}),jsx("span",{title:y.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",S?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:y.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",S?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",i==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),gt!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",gt>=1?"text-[#32D74B]":gt>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",gt.toFixed(2)]}),St>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[i==="es"?"Conflicto":"Conflict",": ",St]})]}):Yt.type==="timeLoggedMinutes"?jsx(mr,{value:Y>0?Y:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):Yt.type==="soldEffortMinutes"?jsx(mr,{value:je>0?je:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):Yt.type==="effortMinutes"?jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):K(y,Yt)},Yt.id))},y.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:J},className:u("flex items-center border-b transition-colors",S?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(y),onDoubleClick:()=>a.onTaskDoubleClick?.(y),onContextMenu:Y=>st(Y,y),children:[Oe.map(Y=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:ee[Y.id],minWidth:Y.minWidth},children:Y.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&y.level>0&&jsx("div",{style:{width:`${y.level*24}px`},className:"flex-shrink-0"}),h&&y.hasChildren&&jsx("button",{onClick:Re=>{Re.stopPropagation(),Ce(y.id);},className:u("p-0.5 rounded flex-shrink-0",S?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:z?jsx(ChevronDown,{className:u("w-4 h-4",S?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",S?"text-white/60":"text-gray-400")})}),h&&!y.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(y.wbsCode||y.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[y.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",S?"text-[#007BFF]":"text-blue-600"),children:y.wbsCode}),y.taskCode&&jsx("span",{className:u("text-[10px] font-mono",S?"text-white/40":"text-gray-400"),children:y.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",S?"text-white":"text-gray-900",y.progress===100&&(S?"line-through text-white/30":"line-through text-gray-400")),children:y.name}),y.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${y.tags[0].color}20`,color:y.tags[0].color},children:y.tags[0].name})]})]}):K(y,Y)},Y.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},y.id)})}),I&&Be.length>0&&(()=>{let{spent:y,allocated:L,quoted:z}=M,J=L-y,de=J<0,ge=de?`+${Tn(Math.abs(J))} ${i==="es"?"EXCEDIDO":"OVER"}`:`-${Tn(J)} ${i==="es"?"AHORRADO":"SAVED"}`,Y=T==="financial"&&B>0,Re=St=>Y?`$${(St/60*B).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Tn(St),je=Y?Math.abs(J/60*B):0,gt=Y?`${de?"+":"-"}$${je.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${de?i==="es"?"EXCEDIDO":"OVER":i==="es"?"AHORRADO":"SAVED"}`:ge;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",S?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:S?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Oe.map(St=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:ee[St.id],minWidth:St.minWidth},children:St.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:i==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):St.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Re(y)}),jsx("span",{className:u("text-[11px]",S?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",S?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Re(L)}),L>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",de?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y?gt:ge})]}):St.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:z>0?Re(z):"\u2013"}):St.type==="effortMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:L>0?Re(L):"\u2013"}):St.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:y>0?Re(y):"\u2013"}):jsx("span",{className:u("text-[11px]",S?"text-white/30":"text-gray-300"),children:"\u2013"})},St.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Be.length===0&&$&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",S?"text-white/30":"text-gray-400")}),jsx("p",{className:u(S?"text-white/60":"text-gray-600"),children:G.empty.noResults})]})})]})}),q?.enabled&&q.data&&ke&&jsx(Cg,{data:q.data,isDark:S,locale:i,onClose:()=>_e(false)})]}),jsx(og,{state:Dt,onClose:nt,isDark:S,locale:i,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ze,onColumnSort:it,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(hg,{isOpen:Me,onClose:()=>ct(false),onSave:Lt,isDark:S,locale:i})]})}var Mg=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Ag=[{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"}],Lg=[{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 Hd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},zd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Ud={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"},Mi={dark:Hd,light:zd,neutral:Ud};function Ig(e){return Mi[e]||Mi.dark}var Wd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Vd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Ai={en:Wd,es:Vd};function rs(e){return Ai[e]||Ai.en}function Li(e,t){let a=rs(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Bg(e){let t=rs(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Rg(e,t=0,a=true){let r=rs(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function ns(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function _d(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function Hg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Wg=26,q1=22,X1=10;function zg(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function jd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Vg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function Ug(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function J1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:p,spanCols:l,lane:c,isStart:i,isEnd:m}=e,g=p.progress===100||p.status==="completed",h=p.isCriticalPath,b=i&&m?"rounded":i?"rounded-l":m?"rounded-r":"",w=m?jd(p.effortMinutes,n,d):null,f=m?Vg(p,n,d):null,x=m?p.blockers?.find(k=>k.severity==="critical"):null;return jsxs(motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":h?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${c*Wg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${q1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:h?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:i?"3px":void 0,borderLeftColor:i?h?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[h&&i&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:p.name}),m&&(w||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[w&&jsxs("span",{children:[s.labels.estimate,": ",w]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),x&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",x.type]}),p.progress>0&&p.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${p.progress}%`}})]})}function Gg({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:p=[],onCreateTag:l,attachmentsByTask:c,comments:i,onAddComment:m,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:b,onTaskOpen:w,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:v,onLogTime:C,onUpdateEstimate:N,onUpdateSoldEffort:E,onStartTimer:T,onStopTimer:B,onDiscardTimer:O,blurFinancials:I=false,suppressDetailModal:G=false,lens:S="hours",hourlyRate:ce=0}){let{theme:M="dark",locale:q="en",customTranslations:ke,showBacklog:_e=true}=t,P=Li(q,ke),V=M==="dark"||M==="neutral",[re,Te]=useState(r||new Date),[$,Z]=useState(null),[X$1,fe]=useState(null),[Fe,Ke]=useState(null),[qe,ot]=useState({}),ne=3,ut=3,Me=useCallback(W=>{fe(W.id),G||Z(W),w?.(W.id);},[G,w]),[ct,Dt]=useState(null),Tt=useCallback(()=>{Te(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),xe=useCallback(()=>{Te(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),rt=useCallback(()=>{Te(new Date);},[]),Ye=useMemo(()=>{let W=re.getFullYear(),te=re.getMonth(),Oe=new Date(W,te,1),Ce=new Date(W,te+1,0),He=Oe.getDay(),Ne=Ce.getDate(),ze=ns(e),it=new Date;it.setHours(0,0,0,0);let st=[],nt=He,pt=new Date(W,te,0).getDate();for(let Et=nt-1;Et>=0;Et--){let dt=new Date(W,te-1,pt-Et);st.push({date:dt,isCurrentMonth:false,isToday:false,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(mt=>_d(dt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}for(let Et=1;Et<=Ne;Et++){let dt=new Date(W,te,Et),mt=dt.getTime()===it.getTime();st.push({date:dt,isCurrentMonth:true,isToday:mt,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(Nt=>_d(dt,Nt)).map(Nt=>({id:Nt.id,title:Nt.name,start:Nt.startDate,end:Nt.endDate,task:Nt}))});}let Rt=42-st.length;for(let Et=1;Et<=Rt;Et++){let dt=new Date(W,te+1,Et);st.push({date:dt,isCurrentMonth:false,isToday:false,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(mt=>_d(dt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}return st},[re,e]),Je=useMemo(()=>ns(e).filter(W=>!W.startDate||!W.endDate),[e]),H=useMemo(()=>{let W=ns(e),te=0,Oe=0,Ce=0,He=0,Ne=0;W.forEach(pt=>{pt.effortMinutes&&(te+=pt.effortMinutes),pt.soldEffortMinutes&&(Oe+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(Ce+=pt.scheduleVariance,He++),pt.soldEffortMinutes&&pt.effortMinutes&&(Ne+=pt.soldEffortMinutes-pt.effortMinutes);});let ze=Oe>0?Math.min(100,Math.round(te/Oe*100)):0,it=He>0?Math.round(Ce/He):0,nt=`${Ne<0?"-":"+"}${Ug(Ne,S,ce)}`;return {budgetUtil:ze,avgVariance:it,costDisplay:nt,hasCostData:Oe>0}},[e,S,ce]),le=useMemo(()=>{let W=[0,0,0,0,0,0];return Ye.forEach((te,Oe)=>{let Ce=Math.floor(Oe/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Ne=new Date(He.task.startDate),ze=te.date;Ne.getFullYear()===ze.getFullYear()&&Ne.getMonth()===ze.getMonth()&&Ne.getDate()===ze.getDate()&&Ce<W.length&&(W[Ce]-=He.task.soldEffortMinutes);}});}),W},[Ye]),D=useMemo(()=>{let W=ns(e),te=new Map,Oe=new Set,Ce=[0,0,0,0,0,0];if(Ye.length===0)return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:Ce};let He=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=He(Ye[0].date),ze=He(Ye[Ye.length-1].date),it=[];for(let nt of W){if(!nt.startDate||!nt.endDate)continue;let pt=He(nt.startDate),Rt=He(nt.endDate);if(pt.getTime()===Rt.getTime()||Rt<Ne||pt>ze)continue;let Et=pt<Ne?Ne:pt,dt=Rt>ze?ze:Rt,mt=zg(Et,Ne),Nt=zg(dt,Ne);mt<0||mt>41||Nt<0||Nt>41||mt!==Nt&&(Oe.add(nt.id),it.push({task:nt,startIdx:mt,endIdx:Nt}));}it.sort((nt,pt)=>nt.startIdx!==pt.startIdx?nt.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(nt.endIdx-nt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:nt,startIdx:pt,endIdx:Rt}of it){let Et=Math.floor(pt/7),dt=Math.floor(Rt/7),mt=He(nt.startDate),Nt=He(nt.endDate),Lt=false;for(let Ie=Et;Ie<=dt;Ie++){let Be=Ie===Et?pt%7:0,K=Ie===dt?Rt%7:6,he=K-Be+1,ee=0,y=st[Ie]??[];for(st[Ie]||(st[Ie]=y);ee<y.length&&(y[ee]??-1)>=Be;)ee++;if(ee>=X1){Lt=true;break}ee>=y.length?y.push(K):y[ee]=K,Ce[Ie]=Math.max(Ce[Ie]??0,ee+1);let L=Ie===Et&&mt>=Ne,z=Ie===dt&&Nt<=ze,J=Ie*7+Be,de={taskId:nt.id,task:nt,rowIndex:Ie,startCol:Be,endCol:K,spanCols:he,lane:ee,isStart:L,isEnd:z};te.has(J)||te.set(J,[]),te.get(J).push(de);}Lt&&(Oe.delete(nt.id),te.forEach((Ie,Be)=>{let K=Ie.filter(he=>he.taskId!==nt.id);K.length===0?te.delete(Be):te.set(Be,K);}));}return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:Ce}},[Ye,e]),j=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],se=re.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ye=se.charAt(0).toUpperCase()+se.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",V?"text-white/30":"text-gray-600"),children:[P.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",V?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",V?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",V?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",V?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:P.labels.noEvents}),jsx("p",{className:u("text-sm",V?"text-white/30":"text-gray-600"),children:P.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",V?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",V?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",V?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",V?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",V?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Tt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",V?"text-white":"text-gray-900"),children:ye}),jsx("button",{onClick:xe,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",V?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:rt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",V?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:P.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:j.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",V?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",V?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>fe(null),children:Ye.map((W,te)=>{let Oe=te%7===6,Ce=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Oe&&(V?"border-r border-[#222]":"border-r border-gray-200"),!Ce&&(V?"border-b border-[#222]":"border-b border-gray-200"),V?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&V&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!V&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?V?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?V?"text-white/60":"text-gray-900":V?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Ne=(D.maxLanesPerRow[He]??0)*Wg,ze=D.segmentsByCell.get(te);return Ne===0&&!ze?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:ze?.map(it=>jsx(J1,{segment:it,isDark:V,blurFinancials:I,isSelected:X$1===it.taskId,t:P,lens:S,hourlyRate:ce,onClick:()=>{Me(it.task),a.onEventClick?.({id:it.task.id,title:it.task.name,start:it.task.startDate,end:it.task.endDate,task:it.task});}},it.taskId))})})(),(()=>{let He=W.events.filter(Ne=>Ne.task.isMilestone&&!D.multiDayTaskIds.has(Ne.id));return He.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:ze=>{ze.stopPropagation(),Me(Ne.task);}},Ne.id)),He.length>4&&jsxs("span",{className:u("text-[8px] font-mono",V?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];W.events.forEach(ze=>{ze.task.blockers?.forEach(it=>{(it.severity==="warning"||it.severity==="critical")&&He.push({taskId:ze.id,type:it.type,severity:it.severity,variance:ze.task.scheduleVariance});});});let Ne=He[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[P.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${P.labels.delay})`:""]})]})}):null})(),(()=>{let He=W.events.filter(st=>!D.multiDayTaskIds.has(st.id)),Ne=qe[te]||ne,ze=He.slice(0,Ne),it=He.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[ze.map(st=>jsxs(motion.button,{onClick:()=>{Me(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?V?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":V?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:V?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",st.task.isMilestone?V?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":V?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),it>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),ot(nt=>({...nt,[te]:Ne+ut}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",it," ",q==="es"?"m\xE1s":"more"]}),Ne>ne&&He.length>ne&&jsx("button",{onClick:st=>{st.stopPropagation(),ot(nt=>({...nt,[te]:ne}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Ne=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:ze=>{ze.stopPropagation(),Dt(ct===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ct===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",V?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",ct===te&&"rotate-45")})}),jsx(AnimatePresence,{children:ct===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Dt(null)}),jsx(motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",V?"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(Ao,{onSubmit:ze=>{a.onTaskCreate?.({name:ze.name,startDate:ze.startDate||W.date,endDate:ze.endDate||W.date,priority:ze.priority,assignees:ze.assignee?[ze.assignee]:void 0}),Dt(null);},onCancel:()=>Dt(null),availableUsers:t.availableUsers,isDark:V,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Ne=le[He];if(!Ne||Ne===0)return null;let ze=Ug(Ne,S,ce);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",I&&"blur-sm select-none"),children:[P.labels.cashOut,": ",Ne<0?"-":"+",ze]})})()]},te)})})})]}),_e&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",V?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",V?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:P.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",V?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",V?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",V?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",V?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxs("button",{onClick:()=>{Me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",V?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",V?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",V?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",V?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",V?"text-white/25":"text-gray-400",I&&"blur-sm select-none"),children:[jd(W.effortMinutes,S,ce)&&jsxs("span",{children:[P.labels.estimate,": ",jd(W.effortMinutes,S,ce)]}),(()=>{let te=Vg(W,S,ce);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(Hg,{task:W,isDark:V})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,Oe)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Oe))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:P.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",V?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:["\u25C8 ",P.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",V?"text-white/40":"text-gray-500"),children:P.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",V?"text-white/60":"text-gray-700",I&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",V?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:P.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":V?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",P.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:P.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",I&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!G&&jsx(Xr,{task:$,isOpen:!!$,onClose:()=>Z(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),Z(W);},theme:M==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:p,onCreateTag:l,attachments:$?c?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ns(e).filter(W=>W.id!==$?.id),comments:i?.filter(W=>W.taskId===$?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:E,onTimerStart:T,onTimerStop:B,onTimerDiscard:O,blurFinancials:I}),jsx(AnimatePresence,{children:Fe&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ke(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",V?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",V?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",V?"text-white/90":"text-gray-900"),children:Fe.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ke(null),className:u("p-1 rounded",V?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Fe.events.map(W=>jsxs("button",{onClick:()=>{Ke(null),Me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",V?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(Hg,{task:W.task,isDark:V}),jsx("span",{className:u("text-sm truncate flex-1",V?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var Kd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Yd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},qd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Ri={dark:Kd,light:Yd,neutral:qd};function _g(e){return Ri[e]||Ri.dark}function Z1({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[p,l]=useState(false),c=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),i=useMemo(()=>{let g=c.length,h=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,b=c.map(f=>f.priority).filter(Boolean),w=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:h,priorities:b,labels:w}},[c]),m=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:i.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"]})]}),p&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[i.uniqueAssignees," assignees"]})]}),i.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:[i.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:c.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:c.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:h=>{h.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var Kg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function is(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 ls(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 Yg(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function qg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let p=useMemo(()=>({...Kg,...n}),[n]),[l,c]=useState(new Set),i=useRef(null),m=useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let v=k.timestamp.toISOString().split("T")[0],C=x.get(v);C?C.push(k):x.set(v,[k]);}),Array.from(x.entries()).sort((k,v)=>v[0].localeCompare(k[0])).map(([k,v])=>({date:new Date(k),events:v.sort((C,N)=>N.timestamp.getTime()-C.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:g,uniqueTypes:h}=useMemo(()=>{let x=new Set,k=new Set;return e.forEach(v=>{x.add(v.userId),k.add(v.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),b=x=>{c(k=>{let v=new Set(k);return v.has(x)?v.delete(x):v.add(x),v});},w=x=>{let v=new Date().getTime()-x.getTime(),C=Math.floor(v/6e4),N=Math.floor(v/36e5),E=Math.floor(v/864e5);return C<1?"just now":C<60?`${C}m ago`:N<24?`${N}h ago`:E<7?`${E}d ago`:x.toLocaleDateString()},f=useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return useEffect(()=>{if(s&&i.current){let x=i.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",p.compact&&"compact",d),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:x=>{let k=x.target.value;a({...t,types:k?[k]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),h.map(x=>jsxs("option",{value:x,children:[ls(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let k=x.target.value;a({...t,users:k?[k]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(x=>jsx("option",{value:x,children:x},x))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:i,children:m.map(x=>jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&x.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:x.events.map((k,v)=>{let C=l.has(k.id),N=s===k.id,E=Yg(k.type);return jsxs("div",{"data-event-id":k.id,className:u("history-timeline-event",C&&"expanded",N&&"selected"),onClick:()=>o?.(k),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:p.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ls(k.type)})}),v<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),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:[p.showAvatars&&k.userAvatar&&jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsx("span",{className:"history-timeline-event-action",children:is(k)})]})]}),jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?w(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(k.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([T,B])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},T)),k.metadata&&Object.keys(k.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(k.metadata).map(([T,B])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},T))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function Jg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:p,className:l}){let c=[.5,1,1.5,2,3],i=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:i&&ls(i.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:i&&is(i)}),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:i&&i.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,h)=>jsx("div",{className:u("history-replay-progress-marker",h===e.currentIndex&&"active"),style:{left:`${h/(e.totalEvents-1)*100}%`},onClick:()=>d(h),title:is(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>p(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:i&&i.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Xd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Jd(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 Qg(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 Zg(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function nw(e,t,a,r,o,s=100){let n=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(p=>[p.id,p]));for(let p=0;p<s;p++){let l=1-p/s;n.forEach(c=>{let i=a/2,m=r/2;c.vx+=(i-c.x)*o.centerForce*l,c.vy+=(m-c.y)*o.centerForce*l,n.forEach(g=>{if(c.id===g.id)return;let h=c.x-g.x,b=c.y-g.y,w=Math.sqrt(h*h+b*b)||1,f=o.chargeStrength*l/(w*w);c.vx+=h/w*f,c.vy+=b/w*f;});}),t.forEach(c=>{let i=d.get(typeof c.source=="string"?c.source:c.source.id),m=d.get(typeof c.target=="string"?c.target:c.target.id);if(!i||!m)return;let g=m.x-i.x,h=m.y-i.y,b=Math.sqrt(g*g+h*h)||1,w=(b-o.linkDistance)/b*o.forceStrength*l;i.vx+=g*w,i.vy+=h*w,m.vx-=g*w,m.vy-=h*w;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function e0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:p}){let l=useRef(null),[c,i]=useState([]),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(1),[v,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let S=nw(e,t,a.width,a.height,a,150);i(S);},[e,t,a]);let N=useCallback((S,ce)=>{a.enableDragging&&(ce.stopPropagation(),g(S));},[a.enableDragging]),E=useCallback(S=>{if(!m||!l.current)return;let M=l.current.getBoundingClientRect(),q=(S.clientX-M.left-v.x)/x,ke=(S.clientY-M.top-v.y)/x;i(_e=>_e.map(P=>P.id===m?{...P,x:q,y:ke,fx:q,fy:ke}:P));},[m,x,v]),T=useCallback(()=>{g(null);},[]),B=useCallback((S,ce)=>{ce.stopPropagation(),d?.({type:"node-click",node:S,position:{x:ce.clientX,y:ce.clientY}});},[d]),O=useCallback((S,ce)=>{ce.stopPropagation(),d?.({type:"edge-click",edge:S,position:{x:ce.clientX,y:ce.clientY}});},[d]),I=useCallback(S=>{let ce=c.find(M=>M.id===S);return ce?{x:ce.x,y:ce.y}:{x:0,y:0}},[c]),G=useCallback(S=>{if(S.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return S.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ce=S.card.priority;return ce==="URGENT"?"#ef4444":ce==="HIGH"?"#f59e0b":ce==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return S.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",p),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",p),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(S=>Math.min(S+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(S=>Math.max(S-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(S=>S.type))).map(S=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Xd(S)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Qg(S)," ",Jd(S)]})]},S))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(S=>{let ce=I(typeof S.source=="string"?S.source:S.source.id),M=I(typeof S.target=="string"?S.target:S.target.id),q=Zg(S.type),ke=w===S.id,_e=S.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ke&&"hovered",_e&&"critical"),onMouseEnter:()=>f(S.id),onMouseLeave:()=>f(null),onClick:P=>O(S,P),children:[jsx("line",{x1:ce.x,y1:ce.y,x2:M.x,y2:M.y,stroke:Xd(S.type),strokeWidth:_e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsx("text",{x:(ce.x+M.x)/2,y:(ce.y+M.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Jd(S.type)})]},S.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(S=>{let ce=h===S.id,M=S.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",ce&&"hovered",M&&"critical"),transform:`translate(${S.x}, ${S.y})`,onMouseDown:q=>N(S.id,q),onMouseEnter:()=>b(S.id),onMouseLeave:()=>b(null),onClick:q=>B(S,q),children:[jsx("circle",{r:M?a.nodeSize*1.2:a.nodeSize,fill:G(S),stroke:M?"#fbbf24":"#ffffff",strokeWidth:M?3:2,opacity:ce?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:S.card.title.length>20?S.card.title.substring(0,20)+"...":S.card.title})]},S.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 r0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,p]=useState(false),[l,c]=useState(null),[i,m]=useState(null),g=useRef(null),h=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=k=>{k.key==="Escape"&&!h&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,h]);let b=()=>{h||(n(""),c(null),m(null),t());},w=async()=>{if(!(!s.trim()||h)){p(true),c(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){c(x instanceof Error?x.message:"Failed to generate plan");}finally{p(false);}}},f=()=>{i&&(a(i),b());};return e?jsxs(It,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:x=>x.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:h,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:i?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!"})]}),i.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:i.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((x,k)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},k))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((x,k)=>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:x.title}),x.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},k)),i.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:x=>n(x.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:h}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((x,k)=>jsx("button",{onClick:()=>n(x),disabled:h,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:x},k))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:h&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,disabled:h,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"}),i?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:w,disabled:!s.trim()||h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:h?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Qd={"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 iw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},lw={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 dw(e,t,a){let r=Qd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ds(e){return `$${e.toFixed(4)}`}var Zd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=dw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,m)=>i+m.cost,0),s=a.reduce((i,m)=>i+m.inputTokens,0),n=a.reduce((i,m)=>i+m.outputTokens,0),d=a.filter(i=>i.success),p=a.reduce((i,m)=>i+m.duration,0),l={},c={};return a.forEach(i=>{l[i.feature]=(l[i.feature]||0)+1,c[i.feature]=(c[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:c,averageDuration:r>0?p/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,p=Math.max(0,o-d),l=d/o*100;return {used:d,limit:o,remaining:p,percentUsed:l,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Uo=new Zd;function s0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Uo.getStats()),[s,n]=useState(Uo.checkLimit(a));if(useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Uo.getStats()),n(Uo.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),useEffect(()=>{let p=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let d=Uo.getRecentOperations(5);return jsxs(It,{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: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:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ds(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,l])=>{let c=r.costsByFeature[p]||0,i=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${i}%`}})})]},p)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(p.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.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 d0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[p,l]=useState(""),[c,i]=useState(""),[m,g]=useState(false),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(null),v=useRef(null),C=m||o;useEffect(()=>{e&&v.current&&v.current.focus();},[e]),useEffect(()=>{let O=I=>{I.key==="Escape"&&!C&&N();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,C]);let N=()=>{C||(d(""),l(""),i(""),b(null),f(null),k(null),t());},E=async()=>{if(!(!n.trim()||C)){g(true),b(null),f(null),k(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:c||void 0});f(O.tasks.tasks),k({from_cache:O.from_cache,tokens_used:O.tokens_used,mock_mode:O.mock_mode,similarity:O.similarity,tokens_saved:O.tokens_saved});}catch(O){b(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{w&&(a(w),N());};if(!e)return null;let B=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(It,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:O=>O.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:N,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:w?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:[x?.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"}),x?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",B,"% 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:[x?.tokens_used||0," tokens"]}),x?.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:[x.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:[w.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:w.map((O,I)=>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:["#",I+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:O.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"})]}),O.start," \u2192 ",O.end]}),jsxs("span",{children:[O.duration," days"]}),O.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",O.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${O.priority==="high"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:O.priority})]})},O.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:v,value:n,onChange:O=>d(O.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:O=>l(O.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:O=>i(O.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]})]}),h&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:h}),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((O,I)=>jsx("button",{onClick:()=>d(O),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:O},I))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:N,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),w?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:E,disabled:!n.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(w=>{t&&Cs(()=>Promise.resolve(t(w)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,k)=>{console.warn(`Retry attempt ${x} after ${k}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(w,f,x)=>{r(k=>{let v=k.cards.find(O=>O.id===w);if(!v)return k;let C=v.columnId,N={...v,columnId:f,position:x},E=k.cards.map(O=>O.id===w?N:O),T=k.columns.map(O=>{if(O.id===C)return {...O,cardIds:O.cardIds.filter(I=>I!==w)};if(O.id===f){let I=E.filter(G=>G.columnId===f).sort((G,S)=>G.position-S.position);return {...O,cardIds:I.map(G=>G.id)}}return O}),B={...k,cards:E,columns:T};return o(B),B});},[o]),n=useCallback(async(w,f)=>{r(x=>{let k=x.cards.map(C=>C.id===w?{...C,...f}:C),v={...x,cards:k};return o(v),v});},[o]),d=useCallback(async w=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...w,id:f},v=x.columns.map(N=>N.id===w.columnId?{...N,cardIds:[...N.cardIds,f]}:N),C={...x,cards:[...x.cards,k],columns:v};return o(C),C});},[o]),p=useCallback(async w=>{r(f=>{let x=f.cards.find(N=>N.id===w);if(!x)return f;let k=f.cards.filter(N=>N.id!==w),v=f.columns.map(N=>N.id===x.columnId?{...N,cardIds:N.cardIds.filter(E=>E!==w)}:N),C={...f,cards:k,columns:v};return o(C),C});},[o]),l=useCallback(async w=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...w,id:f,cardIds:[]},v={...x,columns:[...x.columns,k]};return o(v),v});},[o]),c=useCallback(async(w,f)=>{r(x=>{let k=x.columns.map(C=>C.id===w?{...C,...f}:C),v={...x,columns:k};return o(v),v});},[o]),i=useCallback(async w=>{r(f=>{let x=f.cards.filter(C=>C.columnId!==w),k=f.columns.filter(C=>C.id!==w),v={...f,cards:x,columns:k};return o(v),v});},[o]),m=useCallback(w=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(w),f},[d]),g=useCallback(w=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(w),f},[l]),h=useCallback(()=>{r(w=>{let f={...w,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:p,onColumnCreate:l,onColumnUpdate:c,onColumnDelete:i},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:p,deleteColumn:i,clearBoard:h}}}function u0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Hi({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(p,l,c={})=>{s.addCard({title:l,columnId:p,position:r.cards.filter(i=>i.columnId===p).length,...c});},addColumn:(p,l)=>{let c=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;s.addColumn({title:p,position:l??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var cs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},m0={by:"none",order:"asc"};function g0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...cs,...e}),[s,n]=useState({...m0,...t}),d=useCallback(b=>{o(w=>({...w,...b}));},[]),p=useCallback(b=>{n(w=>({...w,...b}));},[]),l=useCallback(()=>{o(cs),n(m0);},[]),c=useCallback(()=>{a&&o({...cs,assignees:[a]});},[a]),i=useCallback(()=>{o({...cs,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...cs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),h=useCallback(b=>{let w=[...b];if(r.search){let f=r.search.toLowerCase();w=w.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),k=String(f.getMonth()+1).padStart(2,"0"),v=String(f.getDate()).padStart(2,"0"),C=`${x}-${k}-${v}`;w=w.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let E=N.endDate||N.dueDate;if(!E)return false;let T;if(typeof E=="string")T=E.split("T")[0]||E;else {let B=E.getUTCFullYear(),O=String(E.getUTCMonth()+1).padStart(2,"0"),I=String(E.getUTCDate()).padStart(2,"0");T=`${B}-${O}-${I}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let B=new Date(C+"T00:00:00"),O=new Date(T+"T00:00:00"),I=new Date(B);return I.setDate(I.getDate()+7),O>=B&&O<=I;case "custom":if(r.dateRange){let G=typeof E=="string"?new Date(E):E;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(w=w.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(w=w.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(w=w.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(w=w.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&w.sort((f,x)=>{let k=0;switch(s.by){case "created":let v=f.createdAt?new Date(f.createdAt).getTime():0,C=x.createdAt?new Date(x.createdAt).getTime():0;k=v-C;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=N[f.priority||"LOW"],T=N[x.priority||"LOW"];k=E-T;break;case "dueDate":let B=f.endDate||f.dueDate,O=x.endDate||x.dueDate;if(!B)return 1;if(!O)return -1;let I=typeof B=="string"?new Date(B).getTime():B.getTime(),G=typeof O=="string"?new Date(O).getTime():O.getTime();k=I-G;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let S=f.estimatedTime||0,ce=x.estimatedTime||0;k=S-ce;break;default:k=0;}return s.order==="asc"?k:-k}),w},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:p,resetFilters:l,filterMyTasks:c,filterOverdue:i,filterHighPriority:m,applyFilters:h,hasActiveFilters:g}}var b0,h0;if(typeof window<"u")try{let e=vs("ai");b0=e.generateObject,h0=e.generateText;}catch{}function y0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(b0&&h0&&e.apiKey),n=useCallback(async i=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),p=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:p,onGenerateSubtasks:l,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function tc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function x0(e){let{cards:t}=e,[a,r]=tc(),o=useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),s=useCallback((i,m)=>{if(!m){r({selectedCardIds:[i],lastSelectedCardId:i});return}let g=m.ctrlKey||m.metaKey,h=m.shiftKey;if(g)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(h&&a.lastSelectedCardId){let b=t.find(f=>f.id===i),w=t.find(f=>f.id===a.lastSelectedCardId);if(b&&w&&b.columnId===w.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,B)=>T.position-B.position),x=f.findIndex(T=>T.id===a.lastSelectedCardId),k=f.findIndex(T=>T.id===i),[v,C]=x<k?[x,k]:[k,x],N=f.slice(v,C+1).map(T=>T.id),E=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:E,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),n=useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(i=>{a.selectedCardIds.includes(i)?n(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,n,r]),c=useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:p,toggleCard:l,getSelectedCards:c}}var v0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function w0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...v0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,w,f,x,k)=>{if(w.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:w,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,v]);},[o.minCardsPerStack,s]),p=useCallback(b=>{n(w=>w.filter(f=>f.id!==b));},[]),l=useCallback(b=>{n(w=>w.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),c=useCallback((b,w)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(w)?{...x,cardIds:[...x.cardIds,w]}:x));},[]),i=useCallback((b,w)=>{n(f=>f.map(x=>{if(x.id===b){let k=x.cardIds.filter(v=>v!==w);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(w=>w.columnId===b).sort((w,f)=>w.position-f.position),[s]),g=useCallback(async b=>{let w=t.filter(C=>C.columnId===b);if(w.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;w.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(N=>{x.has(N)||x.set(N,[]),x.get(N).push(C);});}),x.forEach((C,N)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:C.map(E=>E.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${N}"`,confidence:.85});});let k=new Map;w.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(N=>{k.has(N)||k.set(N,[]),k.get(N).push(C);});}),k.forEach((C,N)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:C.map(E=>E.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(w.forEach(C=>{C.priority&&(v.has(C.priority)||v.set(C.priority,[]),v.get(C.priority).push(C));}),v.forEach((C,N)=>{if(C.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";f.push({stack:{title:`${E} ${N} Priority`,cardIds:C.map(T=>T.id),columnId:b,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of w){let E=(await r.findSimilar(C,w)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let T=[C.id,...E.map(O=>O.card.id)],B=E.reduce((O,I)=>O+I.similarity,0)/E.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:B});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,N)=>N.confidence-C.confidence).slice(0,5)},[t,o,r]),h=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(w=>w.columnId)).forEach(async w=>{let f=await g(w),x=f[0];f.length>0&&x&&x.confidence>=.9&&h(x);});},[]),{stacks:s,createStack:d,deleteStack:p,toggleStack:l,addToStack:c,removeFromStack:i,getStacksForColumn:m,getSuggestions:g,applySuggestion:h,config:o}}var k0=createContext(null);function C0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(p=>{let{Column:l}=vs("@libxai/core");s.set(p.id,new l(p));}),t?.cards?.forEach(p=>{let{Card:l}=vs("@libxai/core");n.set(p.id,new l(p));});let d=null;if(t?.board){let{Board:p}=vs("@libxai/core");d=new p(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(k0.Provider,{value:{store:o},children:e})}function zi(){let e=useContext(k0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ps(){let e=zi(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(x=>{e.updateBoard(x);},[e]),p=useCallback(x=>{e.addColumn(x);},[e]),l=useCallback((x,k)=>{e.updateColumn(x,k);},[e]),c=useCallback(x=>{e.deleteColumn(x);},[e]),i=useCallback(x=>e.getColumn(x),[e]),m=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,k)=>{e.updateCard(x,k);},[e]),h=useCallback(x=>{e.deleteCard(x);},[e]),b=useCallback((x,k,v)=>{e.moveCard(x,k,v);},[e]),w=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:p,updateColumn:l,deleteColumn:c,getColumn:i,addCard:m,updateCard:g,deleteCard:h,moveCard:b,getCard:w,getCardsByColumn:f}}function N0(e){let{cards:t}=ps();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function D0(e="position",t="asc"){let{cards:a}=ps();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?d[o.priority]:0,l=s.priority?d[s.priority]:0;n=p-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Ui=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Dw=new Ui;function E0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:p}){let l=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),i=c.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:m,className:o,children:jsx("div",{style:g,children:i.map(h=>{let b=e[h.index];if(!b)return null;let w=p?p(b,h.index):h.index,f={position:"absolute",top:n?0:h.start,left:n?h.start:0,width:n?h.size:"100%",height:n?"100%":h.size};return jsx("div",{style:f,"data-index":h.index,children:r(b,h.index)},w)})})})}function F0(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 M0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:p,horizontal:l=true}){let c=useRef(null),i=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),m=i.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},h={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:g,className:s,children:jsx("div",{style:h,children:m.map(b=>{let w=e[b.index];if(!w)return null;let f=p?p(w,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:x,"data-index":b.index,children:o(w,b.index)},f)})})})}function A0(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 L0(e,t=10){return e>t}var nc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},sc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},ic={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},lc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},dc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},uc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},pc={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)"},mc={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)"},gc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},fc={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}},bc={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}},Wi={spacing:nc,borderRadius:sc,fontSize:ic,fontWeight:lc,lineHeight:dc,zIndex:cc,duration:uc,easing:pc,shadows:mc,opacity:gc,kanban:fc,gantt:bc};function I0(e,t,a){return e[t]??a}function hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Fw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function yc(e="asakaa"){let t=hc(Wi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Fw(o);a.push(` ${s}: ${n};`);}return `:root {
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function gm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function ao(e,t){let a=gm(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let p=d.name.toLowerCase();return n.every(l=>p.includes(l))})}function hd(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 m=new Date(r);return m.setDate(m.getDate()+1),m}if(a==="yesterday"||a==="ayer"){let m=new Date(r);return m.setDate(m.getDate()-1),m}if(a==="next week"||a==="la pr\xF3xima semana"){let m=new Date(r);return m.setDate(m.getDate()+7),m}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let h=new Date(r),b=h.getDay(),w=g-b;return w<=0&&(w+=7),h.setDate(h.getDate()+w),h}}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 m=parseInt(s[1],10),g=s[2].toLowerCase(),h=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?h.setDate(h.getDate()+m):g==="week"||g==="semana"||g==="semanas"?h.setDate(h.getDate()+m*7):(g==="month"||g==="mes"||g==="meses")&&h.setMonth(h.getMonth()+m),h}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let m=parseInt(d[1],10),g=parseInt(d[2],10)-1,h=parseInt(d[3],10);return new Date(h,g,m)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let m=parseInt(l[1],10),g=p[l[2].toLowerCase()],h=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(h,g,m)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},i=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let m=c[i[1].toLowerCase()],g=parseInt(i[2],10),h=i[3]?parseInt(i[3],10):r.getFullYear();if(m!==void 0)return new Date(h,m,g)}return null}function yd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function xd(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 fm(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 bm(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),c=r[2].trim(),i=ao(t,l),m=hd(c);if(!i)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!m)return {type:"move_task",taskId:i.id,taskName:i.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=i.startDate&&i.endDate?Math.round((i.endDate.getTime()-i.startDate.getTime())/(1e3*60*60*24)):1,h=new Date(m);return h.setDate(h.getDate()+g),{type:"move_task",taskId:i.id,taskName:i.name,updates:{startDate:m,endDate:h},message:`Moved "${i.name}" to ${m.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),c=o[2].trim(),i=ao(t,l),m=yd(c);if(!i)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!m||!i.endDate)return {type:"resize_task",taskId:i.id,taskName:i.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let g=new Date(i.endDate);return g.setDate(g.getDate()+m),{type:"resize_task",taskId:i.id,taskName:i.name,updates:{endDate:g},message:`Extended "${i.name}" by ${m} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),c=s[2].trim(),i=ao(t,l),m=xd(c);return i?m===null?{type:"set_progress",taskId:i.id,taskName:i.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:i.id,taskName:i.name,updates:{progress:m},message:`Set "${i.name}" progress to ${m}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),c=n[2].trim(),i=ao(t,l);return i?{type:"rename_task",taskId:i.id,taskName:i.name,updates:{name:c},message:`Renamed "${i.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let l=d[1].trim(),c=d[2].trim(),i=ao(t,l),m=ao(t,c);return i?m?{type:"link_tasks",taskId:m.id,taskName:m.name,dependencyFrom:i.id,dependencyTo:m.id,message:`Linked "${i.name}" \u2192 "${m.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let l=p[1].trim(),c=ao(t,l);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function hm(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 Vv(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 Gv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function vi(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let i=a.find(m=>m.id===c);return i?{name:i.name,initials:i.initials,color:i.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>vi(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),p=n(e.endDate),l=e.metadata?.isMilestone===true||d&&p&&Math.abs(p.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:p,progress:e.progress||0,status:Vv(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function ym(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:Gv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function xm(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>vi(r,e,t))}var vd={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"},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"}},wd={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:"Carga Equipo",blockers:"Bloqueantes"},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"}},wi={en:vd,es:wd};function kd(e){return wi[e]||wi.en}function ki(e,t){let a=kd(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 Cd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function vm(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 wm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let g=h=>{d.current&&!d.current.contains(h.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let p=vm(e),l=Cd[0],c=Cd.find(g=>g.value===p)??l,i=c.icon,m=g=>{switch(vm(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(i,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(i,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:m(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Cd.map(g=>{let h=g.icon;return jsxs("button",{onClick:b=>{b.stopPropagation(),t(g.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",p===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(h,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m(g.value)})]},g.value)})})]})}var Td=[{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 Cm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let c=i=>{d.current&&!d.current.contains(i.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let p=Td.find(c=>c.value===e)??Td[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",p.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:p.label[l]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",p.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:p.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Td.map(c=>jsxs("button",{onClick:i=>{i.stopPropagation(),t(c.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===c.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[l]})]},c.value))})]})}function Zn(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Sm({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,d]=useState(false),[p,l]=useState(""),c=useRef(null),i=useRef(null);useEffect(()=>{let b=w=>{c.current&&!c.current.contains(w.target)&&(d(false),l(""));};return n&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{n&&i.current&&i.current.focus();},[n]);let m=t.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())),g=b=>e.some(w=>w.name===b),h=b=>{if(a){if(g(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:Zn(b.name),color:b.color||Nd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,w]);}d(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Nd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)},`${b.name}-${w}`)),e.length>3&&jsxs("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:c,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),d(!n);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Nd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)},`${b.name}-${w}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:i,type:"text",value:p,onChange:b=>l(b.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.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((b,w)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Zn(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${w}`))}),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:o==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let w=g(b.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),h(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:w?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{w||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{w||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Zn(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),w&&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"}})})]},b.id)})})]})]})}function Pm({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:p}){let[l,c]=useState(false),[i,m]=useState(o),[g,h]=useState(()=>{let E=o==="start"?e:t;if(E){let T=E instanceof Date?E:new Date(E);return new Date(T.getFullYear(),T.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),w=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let E=T=>{b.current&&!b.current.contains(T.target)&&c(false);};return l&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[l]),useEffect(()=>{l&&m(r?o:"start");},[l,r,o]);let x=E=>E?E.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):p||"-",k=useCallback(()=>{let E=g.getFullYear(),T=g.getMonth(),B=new Date(E,T,1),I=new Date(E,T+1,0).getDate(),G=B.getDay(),S=[],M=new Date(E,T,0).getDate();for(let ke=G-1;ke>=0;ke--)S.push({date:new Date(E,T-1,M-ke),isCurrentMonth:false});for(let ke=1;ke<=I;ke++)S.push({date:new Date(E,T,ke),isCurrentMonth:true});let q=42-S.length;for(let ke=1;ke<=q;ke++)S.push({date:new Date(E,T+1,ke),isCurrentMonth:false});return S},[g]),v=E=>{if(r)o==="start"?a(E,f||void 0):a(w||void 0,E),c(false);else if(i==="start"){let T=f&&E>f?E:f;a(E,T||void 0),m("end");}else {let T=w&&E<w?E:w;a(T||void 0,E),c(false);}},C=()=>{let E=new Date,T=new Date(E);T.setDate(E.getDate()+1);let B=new Date(E);B.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let O=new Date(E);O.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let G=new Date(E);G.setDate(E.getDate()+14);let S=new Date(E);return S.setDate(E.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:B,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:O,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let E=r&&o==="start"?w:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(E)})]})}let N=r&&o==="start"?w:f;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{onClick:E=>{E.stopPropagation(),c(!l);let T=o==="start"?w:f;T&&h(new Date(T.getFullYear(),T.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:x(N)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[C().map((E,T)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>v(E.date),children:[jsx("span",{children:E.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},T)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(w||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:i==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>h(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>h(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(E=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:k().map((E,T)=>{let B=E.date.toDateString()===new Date().toDateString(),O=w?.toDateString()===E.date.toDateString(),I=f?.toDateString()===E.date.toDateString(),G=O||I,S=!r&&w&&f&&E.date>=w&&E.date<=f;return jsx("button",{onClick:()=>v(new Date(E.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),B&&"ring-2 ring-[#007BFF]",O&&"bg-[#007BFF] text-white",I&&!O&&"bg-[#7C3AED] text-white",S&&!G&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!G&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},T)})})]})]})]})]})}function Ni({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let p=e?e instanceof Date?e:new Date(e):null;return jsx(Pm,{startDate:s==="start"?p:n||null,endDate:s==="end"?p:d||null,onChange:(m,g)=>{t&&t(s==="start"?m:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function wn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Di(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,p]=useState(false),l=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let i=l.current??0,m=e,g=m-i,h=r/o;p(true);for(let b=1;b<=o;b++){let w=setTimeout(()=>{let f=b/o,x=1-Math.pow(1-f,3),k=Math.round(i+g*x);n(k),b===o&&(p(false),n(m));},h*b);c.current.push(w);}return l.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function Mm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),p=useRef(null),l=useRef(null),c=useCallback(g=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current),s(g),d(0);let h=Date.now();l.current=setInterval(()=>{let b=Date.now()-h,w=Math.min(b/a*100,100);d(w);},16),p.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),d(0);},a);},[a,e]),i=useCallback(()=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{p.current&&clearTimeout(p.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:i}}function Im({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=wn(),{displayValue:p,isAnimating:l}=Di(e,{enabled:o,duration:300,steps:6}),c=m=>{if(r||!t)return;m.stopPropagation();let g=m.currentTarget.getBoundingClientRect(),h=m.clientX-g.left,b=Math.round(h/g.width*100),w=Math.max(0,Math.min(100,b));w!==e&&(t(w),s&&d());},i=p??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",n&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:c,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",i===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",l&&"transition-none"),style:{width:`${i}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right tabular-nums font-mono",a?"text-white/60":"text-gray-500",l&&"font-medium scale-105"),children:[i,"%"]})]})}function Om({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,p]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{p(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},i=m=>{m.key==="Enter"?c():m.key==="Escape"&&(p(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:d,onChange:m=>p(m.target.value),onBlur:c,onKeyDown:i,onClick:m=>m.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:m=>{m.stopPropagation(),n(true);},className:u("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function zm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:p=true}){let[l,c]=useState(false),[i,m]=useState(e?.toString()||""),g=useRef(null),{isFlashing:h,triggerFlash:b}=wn(),{displayValue:w,isAnimating:f}=Di(e,{enabled:d&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{m(e?.toString()||"");},[e]);let x=()=>{let v=parseFloat(i);if(!isNaN(v)){let C=v;o!==void 0&&(C=Math.max(o,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),p&&b());}c(false);},k=v=>{v.key==="Enter"?x():v.key==="Escape"&&(m(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:w!==void 0?w:r}):l?jsx("input",{ref:g,type:"number",value:i,onChange:v=>m(v.target.value),onBlur:x,onKeyDown:k,onClick:v=>v.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:v=>{v.stopPropagation(),c(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",w===void 0&&(a?"text-white/30":"text-gray-400"),h&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:w!==void 0?w:r})}function Um({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),p=useRef(null);return useEffect(()=>{let l=c=>{p.current&&!p.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),d(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(l),d(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function Vm({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:p,startChange:l,cancelChange:c}=Mm(t,{delay:s}),i=g=>{g.stopPropagation(),!r&&t&&(o?d?c():l(!e):t(!e));},m=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:i,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",m?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&m&&"ring-green-500/50",d&&!m&&"ring-red-500/50",d&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[d&&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:m?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${p/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):m?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:g=>{g.stopPropagation(),c();},className:u("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function jm({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:u("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function D2(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 S2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),p=parseInt(a[2],10);return d*60+p}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),p=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+p}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function mr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false,lens:p="hours",hourlyRate:l=0}){let[c,i]=useState(false),[m,g]=useState(""),h=useRef(null),{isFlashing:b,triggerFlash:w}=wn(),f=p==="financial"&&l>0,x=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:D2(e,r);useEffect(()=>{c&&h.current&&(h.current.focus(),h.current.select());},[c]),useEffect(()=>{if(e){let N=Math.floor(e/60),E=e%60;N>0&&E>0?g(`${N}h ${E}m`):N>0?g(`${N}h`):g(`${E}m`);}else g("");},[e,c]);let k=()=>{let N=S2(m);N!==e&&(t?.(N),n&&w()),i(false);},v=N=>{N.key==="Enter"?k():N.key==="Escape"&&i(false);};if(d)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let C=f?DollarSign:Clock;return s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(C,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",(!e||e===0)&&(a?"text-white/30":"text-gray-400")),children:x})]}):c?jsx("input",{ref:h,type:"text",value:m,onChange:N=>g(N.target.value),onBlur:k,onKeyDown:v,onClick:N=>N.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:N=>{N.stopPropagation(),i(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(C,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:x})]})}function Xm({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en"}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let s=d=>d.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),n=()=>{if(a==null)return null;let d=o==="es";return a===0?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#3B9EFF",fontWeight:600},children:d?"En Tiempo":"On Track"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#FF2D20",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?s(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?s(t):"\u2014"]}),n()]})}function Qm({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,showSoldEffort:n,onOpenTimeLog:d,lens:p="hours",hourlyRate:l=0}){let c=a==="es",i=p==="financial"&&l>0,m=P=>i?`$${Math.round(P*l).toLocaleString("en-US")}`:`${P}h`,[g,h]=useState(false),[b,w]=useState(false),[f,x]=useState(null),k=useRef(null),v=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,E=Math.round(v/60*10)/10,T=Math.round(C/60*10)/10,B=Math.round(N/60*10)/10,O=C>0?v/C*100:0,I=O>100?Math.round((v-C)/60*10)/10:0,G=O>100?"#FF2D20":O>=80?"#FFD60A":"#3BF06E";useEffect(()=>{if(!b&&!f)return;let P=V=>{k.current&&!k.current.contains(V.target)&&(w(false),x(null));};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[b,f]);let S=P=>{if(P.stopPropagation(),r&&!o&&!s){x("log");return}if(r||o||s){w(V=>!V),x(null);return}d&&d(e);},ce=P=>{w(false),x(P);},M=async(P,V)=>{f==="log"&&r&&P?r(e,P,V):f==="estimate"&&o?o(e,P):f==="quoted"&&s&&s(e,P),x(null);},q=r||o||s||d,ke=[{mode:"log",icon:Clock,label:c?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:c?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:c?"T. Ofertado":"Quoted time",show:!!s}].filter(P=>P.show),_e=f==="estimate"?C:f==="quoted"?N:void 0;return C===0&&v===0&&N===0?jsxs("div",{ref:k,className:"relative flex items-center gap-2",onClick:P=>P.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),g&&q&&jsx("button",{onClick:S,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:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&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:ke.map(P=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(P.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:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsx(AnimatePresence,{children:f&&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(Or,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:M,onClose:()=>x(null)})})})})]}):jsxs("div",{ref:k,className:"relative flex items-center gap-2 w-full",onClick:P=>P.stopPropagation(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:m(E)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(T)]}),I>0&&jsxs("span",{className:"font-mono",style:{fontSize:10,color:"#FF2D20"},children:["+",m(I)," ",c?"Exceso":"Over"]})]}),C>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(O,100)}%`,backgroundColor:G,borderRadius:2,transition:"width 0.3s"}})}),N>0&&(s||n)&&jsxs("div",{className:"flex items-center gap-1",style:{marginTop:1},children:[jsxs("span",{className:"font-mono",style:{fontSize:9,color:t?"rgba(255,255,255,0.25)":"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:[c?"Ofertado":"Quoted",":"]}),jsx("span",{className:"font-mono",style:{fontSize:10,color:t?"rgba(255,255,255,0.4)":"#6B7280"},children:m(B)})]})]}),q&&jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",P.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:P=>{P.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",P.currentTarget.style.backgroundColor="transparent";},title:c?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&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:ke.map(P=>jsxs("button",{onClick:V=>{V.stopPropagation(),ce(P.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:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(P.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),P.label]},P.mode))})}),jsx(AnimatePresence,{children:f&&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(Or,{mode:f,locale:a,isDark:t,currentValue:_e||void 0,onSave:M,onClose:()=>x(null)})})})})]})}function Zm({task:e,isDark:t}){let a=e.assignees?.[0],r=e.teamLoad;if(!a&&!r)return jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"});let o=r?.percentage??0,s=r?.label||a?.name||"\u2014",n=o>=100?"bg-[#FF2D20]/15 text-[#FF2D20]":o>=80?"bg-[#FFD60A]/15 text-[#FFD60A]":"bg-[#3BF06E]/15 text-[#3BF06E]";return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[jsxs("div",{className:"flex items-center gap-2",children:[a&&(a.avatar?jsx("img",{src:a.avatar,alt:a.name,className:u("w-5 h-5 rounded-full object-cover ring-1",t?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center text-[9px] font-bold text-white ring-1",t?"ring-white/10":"ring-gray-200"),style:{backgroundColor:a.color||"#6B7280"},children:a.initials||a.name?.charAt(0)?.toUpperCase()||"?"})),jsx("span",{className:u("text-[11px] truncate",t?"text-white/60":"text-gray-600"),children:s})]}),r&&jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide w-fit",n),children:[o,"% LOAD"]})]})}var L2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function tg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",L2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function J2(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Q2(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 ng({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:p,onColumnSort:l,availableUsers:c=[],onOpenTimeLog:i,onReportBlocker:m,onCopyTaskLink:g}){let h=useRef(null),b=r==="es"?rg.es:rg.en;if(useEffect(()=>{let v=N=>{h.current&&!h.current.contains(N.target)&&t();},C=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",v),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",C);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let v=[];return o&&v.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),v.push({id:"sep1",label:"",icon:null,separator:true}),d&&(v.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),v.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&v.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(C=>({id:`assign-${C.id}`,label:C.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:C.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],T=N.some(B=>B.name===C.name)?N.filter(B=>B.name!==C.name):[...N,{name:C.name,initials:J2(C.name),color:C.color||Q2(C.name),avatar:C.avatarUrl}];d({...e.task,assignees:T}),t();}}))})),i&&v.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{i(e.task),t();}}),m&&v.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),g&&v.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),v.push({id:"sep2",label:"",icon:null,separator:true}),s&&v.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&v.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),v},f=()=>{if(!e.columnId)return [];let v=[];return l&&(v.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),v.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),p&&e.columnId!=="name"&&(v.push({id:"sep-hide",label:"",icon:null,separator:true}),v.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{p(e.columnId),t();}})),v},x=e.type==="task"?w():f(),k={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:h,style:k,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:x.map(v=>v.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},v.id):v.submenu?jsx(Z2,{item:v,isDark:a},v.id):jsxs("button",{onClick:v.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",v.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(v.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:v.icon}),v.label]},v.id))})}function Z2({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var rg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var mg={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"}),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"})},b1=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function fg({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[p,l]=useState(""),[c,i]=useState(null),m=useRef(null),g=d==="es"?gg.es:gg.en;if(useLayoutEffect(()=>{if(!e||!m.current)return;let v=()=>{if(!m.current)return;let C=m.current.getBoundingClientRect(),E=window.innerHeight-C.top-20;i(Math.max(300,E));};return requestAnimationFrame(v),window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[e]),useEffect(()=>{if(!e)return;let v=setTimeout(()=>{let C=E=>{m.current&&!m.current.contains(E.target)&&t();},N=E=>{E.key==="Escape"&&t();};document.addEventListener("mousedown",C),document.addEventListener("keydown",N),m._cleanup=()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(v),m._cleanup&&m._cleanup();}},[e,t]),!e)return null;let h=v=>g.columns[v]||v,b=v=>{if(v==="name")return;let C=a.map(N=>N.id===v?{...N,visible:!N.visible}:N);o(C);},w=(v,C)=>{let N=a.find(T=>T.type===v&&(!C||T.customFieldId===C));if(N){b(N.id);return}let E={id:C||v,type:v,label:C?r.find(T=>T.id===C)?.name||v:h(v),width:120,visible:true,sortable:true,resizable:true,customFieldId:C};o([...a,E]);},f=b1.filter(v=>h(v).toLowerCase().includes(p.toLowerCase())),x=r.filter(v=>v.name.toLowerCase().includes(p.toLowerCase())),k=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:m,style:{...c?{maxHeight:`${c}px`}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)"},className:"absolute right-0 top-full mt-1 w-64 rounded-xl z-50 flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:g.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",v.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent",v.currentTarget.style.color=n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:p,onChange:v=>l(v.target.value),placeholder:g.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:v=>{v&&v.style.setProperty("--focus-border",k);},onFocus:v=>{v.currentTarget.style.borderColor=k,v.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:v=>{v.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",v.currentTarget.style.background=n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:v=>v.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:g.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:f.map(v=>{let C=a.find(T=>T.type===v&&!T.customFieldId),N=C?.visible??false,E=v==="name";return jsxs("button",{onClick:()=>{E||(C?b(C.id):w(v));},disabled:E,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:E?.4:1,cursor:E?"not-allowed":"pointer"},onMouseEnter:T=>{E||(T.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:T=>{T.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?k:"transparent",border:N?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[v]}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:h(v)})]},v)})})]}),x.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:g.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:x.map(v=>{let N=a.find(E=>E.customFieldId===v.id)?.visible??false;return jsxs("button",{onClick:()=>w(v.type,v.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:E=>{E.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:E=>{E.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?k:"transparent",border:N?`1.5px solid ${k}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${k}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?k:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:mg[v.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:v.name})]},v.id)})})]})]})]})}var gg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var N1=[{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 yg({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,p]=useState("text"),[l,c]=useState([""]),i=o==="es"?hg.es:hg.en;useEffect(()=>{e&&(n(""),p("text"),c([""]));},[e]),useEffect(()=>{let w=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[e,t]);let m=()=>{if(!s.trim())return;let w={name:s.trim(),type:d};d==="dropdown"&&(w.options=l.filter(f=>f.trim())),a(w),t();},g=()=>{c([...l,""]);},h=(w,f)=>{let x=[...l];x[w]=f,c(x);},b=w=>{l.length>1&&c(l.filter((f,x)=>x!==w));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:u("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:i.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.fieldName}),jsx("input",{type:"text",value:s,onChange:w=>n(w.target.value),placeholder:i.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:N1.map(w=>jsxs("button",{onClick:()=>p(w.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===w.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===w.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:w.icon}),jsx("span",{className:u("text-xs",d===w.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:i.types[w.type]})]},w.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:i.options}),jsxs("div",{className:"space-y-2",children:[l.map((w,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:w,onChange:x=>h(f,x.target.value),placeholder:`${i.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>b(f),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),i.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:i.cancel}),jsx("button",{onClick:m,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:i.create})]})]})]}):null}var hg={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 wg={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 kg({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),p=useRef(null),l=useRef(0),c=s==="es"?wg.es:wg.en;useEffect(()=>{if(!n)return;let g=b=>{Date.now()-l.current<100||p.current&&!p.current.contains(b.target)&&d(false);},h=b=>{b.key==="Escape"&&d(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h);}},[n]);let i=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=e!=="all"||t;return jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),d(h=>!h);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",m&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,m&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:i.map(g=>{let h=e===g.value&&!t,b=()=>g.value==="all"?h?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",h&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(h?g.color:"text-gray-400","flex-shrink-0"),children:b()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),h&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Cg(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 Tg({data:e,isDark:t,locale:a="en",onClose:r}){let o=a==="es";return jsxs("div",{className:u("w-[220px] xl:w-[280px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[10px] font-mono uppercase tracking-wider font-bold",t?"text-white/40":"text-gray-500"),children:o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title: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"})})})]}),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let s=e.totalHoursSpentMinutes??0,n=e.totalHoursAllocatedMinutes??0,d=n>0?Math.min(Math.round(s/n*100),100):0,p=s>n&&n>0,l=p?"#FF2D20":d>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children: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:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",p?"text-[#FF2D20]":t?"text-white/80":"text-gray-800"),children:Cg(s)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cg(n)})]}),n>0&&jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:l}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children: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:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#FF2D20]/15 text-[#FF2D20]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let s=e.scheduleVarianceDays??0,n=s>0,d=s<0,p=e.scheduleVarianceLabel||(n?`+${s} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${s} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",n&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#FF2D20]/15 text-[#FF2D20]",!n&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((s,n)=>{let d=s.utilizationPercent>=100?"#FF2D20":s.utilizationPercent>=80?"#FFD60A":s.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[s.utilizationPercent,"%"]})]}),jsx("div",{className:u("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(s.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${s.name}-${n}`)})})]})]})}var U1=[{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 Pg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Pg(r.subtasks,t+1));return a}function W1(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),p=s.endDate.getTime()-n;if(p<=0)continue;let c=Math.max(0,Math.min(a.getTime()-n,p))/p*100;if(c<=0)continue;let i=(s.progress||0)/c;r+=i,o++;}return o>0?r/o:null}function V1(e){return e.subtasks?.length?e.subtasks.filter(t=>t.teamLoad&&t.teamLoad.percentage>=100).length:0}function Nn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Nn(o);t+=s.spent,a+=s.allocated,r+=s.quoted;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Tn(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 Mg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:p=[],toolbarRightContent:l}){let{theme:c="dark",locale:i="en",customTranslations:m,showSearch:g=true,showHierarchy:h=true,tableColumns:b,allowColumnCustomization:w=true,allowColumnResize:f=true,enableContextMenu:x=true,showCreateTaskButton:k=false,onCreateTask:v,persistFilter:C=false,financialBlur:N,healthSidebar:E,lens:T="hours",hourlyRate:B=0,aggregateParentHours:O=false,showProjectTotals:I=false}=t,G=ki(i,m),S=c==="dark",ce=useCallback(()=>{if(!C||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let y=localStorage.getItem(C);if(y){let L=JSON.parse(y);return {statusFilter:L.statusFilter||"all",hideCompleted:L.hideCompleted||!1}}}catch(y){console.error("Error loading persisted filter:",y);}return {statusFilter:"all",hideCompleted:false}},[C]),M=useMemo(()=>{function y(L){let z=0,J=0,de=0;for(let ge of L)if(ge.subtasks&&ge.subtasks.length>0){let Y=y(ge.subtasks);z+=Y.spent,J+=Y.allocated,de+=Y.quoted;}else z+=ge.timeLoggedMinutes??0,J+=ge.effortMinutes??0,de+=ge.soldEffortMinutes??0;return {spent:z,allocated:J,quoted:de}}return y(e)},[e]),q=useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:M.spent,totalHoursAllocatedMinutes:M.allocated}},[E,M]),[ke,_e]=useState(true),[P,V]=useState("position"),[re,Te]=useState("asc"),[$,Z]=useState(""),[X,fe]=useState(()=>ce().statusFilter),[Fe,Ke]=useState(()=>ce().hideCompleted),[qe,ot]=useState(b||U1),[ne,ut]=useState(false),[Me,ct]=useState(false),[Dt,Tt]=useState({isOpen:false,x:0,y:0,type:"task"}),[xe,rt]=useState(null),[Ye,Je]=useState(0),[H,le]=useState(0),D=useRef(null),[j,se]=useState(null),[ye,W]=useState(null);useEffect(()=>{b&&ot(b);},[b]),useEffect(()=>{if(!(!C||typeof window>"u"))try{localStorage.setItem(C,JSON.stringify({statusFilter:X,hideCompleted:Fe}));}catch(y){console.error("Error persisting filter state:",y);}},[C,X,Fe]);let te=useMemo(()=>{let y=new Set;function L(z){for(let J of z)J.subtasks?.length&&(J.isExpanded!==false&&y.add(J.id),L(J.subtasks));}return L(e),y},[e]),Oe=useMemo(()=>qe.filter(y=>y.visible),[qe]),Ce=useCallback(y=>{a.onTaskToggleExpand?.(y);},[a]),He=useCallback(y=>{P===y?Te(L=>L==="asc"?"desc":"asc"):(V(y),Te("asc")),a.onSortChange?.({column:y,direction:re==="asc"?"desc":"asc"});},[P,re,a]),Ne=useCallback(y=>{ot(y),a.onColumnsChange?.(y);},[a]),ze=useCallback(y=>{let L=qe.map(z=>z.id===y?{...z,visible:false}:z);Ne(L);},[qe,Ne]),it=useCallback((y,L)=>{V(y),Te(L);},[]),st=useCallback((y,L,z)=>{x&&(y.preventDefault(),Tt({isOpen:true,x:y.clientX,y:y.clientY,type:L?"task":"header",task:L,columnId:z}));},[x]),nt=useCallback(()=>{Tt(y=>({...y,isOpen:false}));},[]),pt=useCallback((y,L)=>{if(!f)return;y.preventDefault(),y.stopPropagation();let z=qe.find(J=>J.id===L);z&&(rt(L),Je(y.clientX),le(z.width));},[qe,f]);useEffect(()=>{if(!xe)return;let y=z=>{let J=z.clientX-Ye,de=Math.max(50,H+J),ge=qe.map(Y=>Y.id===xe?{...Y,width:de}:Y);ot(ge);},L=()=>{xe&&a.onColumnsChange?.(qe),rt(null);};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",L),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",L);}},[xe,Ye,H,qe,a]);let Rt=useCallback((y,L)=>{if(L==="name"){y.preventDefault();return}se(L),y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",L),y.currentTarget instanceof HTMLElement&&(y.currentTarget.style.opacity="0.5");},[]),Et=useCallback(y=>{y.currentTarget instanceof HTMLElement&&(y.currentTarget.style.opacity="1"),se(null),W(null);},[]),dt=useCallback((y,L)=>{y.preventDefault(),L!=="name"&&(y.dataTransfer.dropEffect="move",W(L));},[]),mt=useCallback(()=>{W(null);},[]),Nt=useCallback((y,L)=>{if(y.preventDefault(),!j||j===L||L==="name")return;let z=[...qe],J=z.findIndex(Y=>Y.id===j),de=z.findIndex(Y=>Y.id===L);if(J===-1||de===-1)return;let ge=z.splice(J,1);ge[0]&&(z.splice(de,0,ge[0]),Ne(z),se(null),W(null));},[j,qe,Ne]),Lt=useCallback(async y=>{if(a.onCreateCustomField){let L={...y,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(L);}ct(false);},[a]),Ie=useCallback(y=>y.progress===100||y.status==="completed"?"completed":y.progress&&y.progress>0||y.status==="in-progress"?"in-progress":"todo",[]),Be=useMemo(()=>{let y=Pg(e);if($.trim()){let L=$.toLowerCase();y=y.filter(z=>z.name.toLowerCase().includes(L));}return X!=="all"&&(y=y.filter(L=>Ie(L)===X)),Fe&&(y=y.filter(L=>Ie(L)!=="completed")),y.sort((L,z)=>{let J,de;switch(P){case "name":J=L.name.toLowerCase(),de=z.name.toLowerCase();break;case "startDate":J=L.startDate?.getTime()||0,de=z.startDate?.getTime()||0;break;case "endDate":J=L.endDate?.getTime()||0,de=z.endDate?.getTime()||0;break;case "progress":J=L.progress||0,de=z.progress||0;break;case "status":J=L.status||"todo",de=z.status||"todo";break;case "priority":let ge={urgent:0,high:1,medium:2,low:3,none:4};J=ge[L.priority]??4,de=ge[z.priority]??4;break;case "position":return 0;default:return 0}return J<de?re==="asc"?-1:1:J>de?re==="asc"?1:-1:0}),y},[e,$,X,Fe,P,re,Ie]),K=useCallback((y,L)=>{let z=ge=>{a.onTaskUpdate?.({...y,...ge});},J=ge=>ge?y.customFields?.find(Re=>Re.fieldId===ge)?.value:void 0,de=(ge,Y)=>{if(!ge)return;let je=[...y.customFields||[]],gt=je.findIndex(St=>St.fieldId===ge);gt>=0?je[gt]={fieldId:ge,value:Y}:je.push({fieldId:ge,value:Y}),z({customFields:je});};switch(L.type){case "name":return null;case "status":return jsx(wm,{value:y.status||(y.progress===100?"completed":y.progress&&y.progress>0?"in-progress":"todo"),onChange:Y=>{z({status:Y,progress:Y==="completed"?100:Y==="in-progress"?50:0});},isDark:S,locale:i,translations:G.status});case "priority":return jsx(Cm,{value:y.priority,onChange:Y=>z({priority:Y}),isDark:S,locale:i});case "assignees":return jsx(Sm,{value:y.assignees||[],availableUsers:d,onChange:Y=>z({assignees:Y}),isDark:S,locale:i});case "startDate":return jsx(Ni,{value:y.startDate,onChange:Y=>z({startDate:Y}),isDark:S,locale:i,dateField:"start",startDate:y.startDate,endDate:y.endDate});case "endDate":return jsx(Ni,{value:y.endDate,onChange:Y=>z({endDate:Y}),isDark:S,locale:i,dateField:"end",startDate:y.startDate,endDate:y.endDate});case "progress":return jsx(Im,{value:y.progress||0,onChange:Y=>{let Re=Y===100?"completed":Y>0?"in-progress":"todo";z({progress:Y,status:Re});},isDark:S});case "tags":return jsx(jm,{value:y.tags||[],isDark:S});case "text":return jsx(Om,{value:J(L.customFieldId)||"",onChange:Y=>de(L.customFieldId,Y),isDark:S});case "number":return jsx(zm,{value:J(L.customFieldId)||0,onChange:Y=>de(L.customFieldId,Y),isDark:S});case "date":let ge=J(L.customFieldId);return jsx(Ni,{value:ge?new Date(ge):void 0,onChange:Y=>de(L.customFieldId,Y),isDark:S,locale:i});case "dropdown":return jsx(Um,{value:J(L.customFieldId)||"",options:L.options||[],onChange:Y=>de(L.customFieldId,Y),isDark:S});case "checkbox":return jsx(Vm,{value:J(L.customFieldId)||false,onChange:Y=>de(L.customFieldId,Y),isDark:S});case "estimatedTime":{let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.estimatedTime,onChange:Re=>z({estimatedTime:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "quotedTime":{let Y=y.status==="completed"||y.progress===100,Re=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(mr,{value:y.quotedTime,onChange:je=>z({quotedTime:je}),isDark:S,locale:i,disabled:Y,isBlurred:Re,lens:T,hourlyRate:B})}case "elapsedTime":{let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.elapsedTime,onChange:Re=>z({elapsedTime:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "effortMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{allocated:Re}=Nn(y);return jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.effortMinutes,onChange:Re=>z({effortMinutes:Re}),isDark:S,locale:i,disabled:Y,lens:T,hourlyRate:B})}case "timeLoggedMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{spent:Re}=Nn(y);return jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100;return jsx(mr,{value:y.timeLoggedMinutes,onChange:a.onLogTime?Re=>{a.onLogTime?.(y,Re);}:void 0,isDark:S,locale:i,placeholder:i==="es"?"Agregar":"Add",disabled:Y,lens:T,hourlyRate:B})}case "soldEffortMinutes":{if(O&&y.subtasks&&y.subtasks.length>0){let{quoted:je}=Nn(y),gt=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(mr,{value:je>0?je:void 0,isDark:S,locale:i,disabled:true,isBlurred:gt,lens:T,hourlyRate:B})}let Y=y.status==="completed"||y.progress===100,Re=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(mr,{value:y.soldEffortMinutes,onChange:je=>z({soldEffortMinutes:je}),isDark:S,locale:i,disabled:Y,isBlurred:Re,lens:T,hourlyRate:B})}case "scheduleVariance":return jsx(Xm,{startDate:y.startDate,endDate:y.endDate,scheduleVariance:y.scheduleVariance,isDark:S,locale:i});case "hoursBar":{if(O&&y.hasChildren){let{spent:Y,allocated:Re,quoted:je}=Nn(y),gt=Y>Re&&Re>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",S?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",gt?"text-[#FF453A]":S?"text-white/80":"text-gray-800"),children:Tn(Y)}),Re>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:S?"text-white/60":"text-gray-600",children:Tn(Re)})]}),je>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:S?"text-amber-400/70":"text-amber-600",children:Tn(je)})]})]})}return jsx(Qm,{task:y,isDark:S,locale:i,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:T,hourlyRate:B})}case "teamLoad":return jsx(Zm,{task:y,isDark:S});case "blockers":return jsx(tg,{blockers:y.blockers,isDark:S,locale:i});default:return jsx("span",{className:u("text-sm",S?"text-white/60":"text-gray-500"),children:"-"})}},[a,S,i,d,G,O]),he=useCallback(y=>{let z={name:G.columns.name,status:G.columns.status,priority:G.columns.priority,assignees:G.columns.assignees,startDate:G.columns.startDate,endDate:G.columns.endDate,progress:G.columns.progress,tags:G.columns.tags||(i==="es"?"Etiquetas":"Tags"),estimatedTime:G.columns.estimatedTime||(i==="es"?"Estimado":"Estimated"),quotedTime:G.columns.quotedTime||(i==="es"?"Ofertado":"Quoted"),elapsedTime:G.columns.elapsedTime||(i==="es"?"Ejecutado":"Executed"),soldEffortMinutes:G.columns.soldEffortMinutes||(i==="es"?"Ofertado":"Quoted"),effortMinutes:G.columns.effortMinutes||(i==="es"?"Estimado":"Estimated"),timeLoggedMinutes:G.columns.timeLoggedMinutes||(i==="es"?"Ejecutado":"Executed"),scheduleVariance:G.columns.scheduleVariance||(i==="es"?"Prog / Var":"Sched / Var"),hoursBar:G.columns.hoursBar||(i==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:G.columns.teamLoad||(i==="es"?"Carga Equipo":"Team Load"),blockers:G.columns.blockers||(i==="es"?"Bloqueantes":"Blockers")}[y.type]||y.label;return typeof z=="string"?z:String(z||y.type)},[G,i]),ee=useMemo(()=>{let z=Oe.reduce((de,ge)=>de+ge.width,0)+(w?48:0),J={};for(let de of Oe)J[de.id]=`${de.width/z*100}%`;return J},[Oe,w]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:[G.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",S?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",S?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",S?"text-white":"text-gray-900"),children:G.empty.noTasks}),jsx("p",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:G.empty.addFirstTask})]})}):jsxs("div",{ref:D,className:u(S?"bg-[#0D0D0D]":"bg-white",xe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",S?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",S?"text-white/60":"text-gray-600"),children:[Be.length," ",G.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",S?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:$,onChange:y=>Z(y.target.value),placeholder:G.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",S?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),jsx(kg,{value:X,hideCompleted:Fe,onChange:fe,onHideCompletedChange:Ke,isDark:S,locale:i}),q?.enabled&&q.data&&!ke&&jsx("button",{onClick:()=>_e(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",S?"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:i==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),k&&v&&jsxs(motion.button,{onClick:v,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:G.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[9px] font-bold uppercase tracking-wider sticky top-0 z-10",S?"border-[#222] bg-[#1A1A1A] font-mono":"border-gray-200 bg-gray-50"),children:[Oe.map(y=>{let L=y.id!=="name",z=ye===y.id&&j!==y.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",S?"text-white/60":"text-gray-500",L&&"cursor-grab",j===y.id&&"opacity-50",z&&(S?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:ee[y.id],minWidth:y.minWidth},draggable:L,onDragStart:L?J=>Rt(J,y.id):void 0,onDragEnd:L?Et:void 0,onDragOver:L?J=>dt(J,y.id):void 0,onDragLeave:L?mt:void 0,onDrop:L?J=>Nt(J,y.id):void 0,onContextMenu:J=>st(J,void 0,y.id),children:[L&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",S?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),y.sortable?jsxs("button",{draggable:false,onClick:()=>He(y.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[he(y),jsx(ArrowUpDown,{className:u("w-3 h-3",P===y.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:he(y)}),f&&y.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",xe===y.id&&"bg-[#007BFF]"),onMouseDown:J=>pt(J,y.id)})]},y.id)}),w&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-0.5",children:[jsx("button",{onClick:y=>{y.stopPropagation(),ut(L=>!L);},className:u("p-0.5 rounded transition-colors",S?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ne&&(S?"bg-white/[0.05]":"bg-gray-200")),title:i==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(fg,{isOpen:ne,onClose:()=>ut(false),columns:qe,customFields:p,onColumnsChange:Ne,onCreateCustomField:()=>{ut(false),ct(true);},isDark:S,locale:i})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Be.map((y,L)=>{let z=te.has(y.id),J=Math.min(L*.01,.2),de=y.hasChildren&&y.level===0,ge=y.subtasks?.length||0;if(de){let{spent:Y,allocated:Re,quoted:je}=Nn(y),gt=W1(y),St=V1(y);return jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:J},className:u("flex items-center border-y cursor-pointer",S?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>Ce(y.id),children:Oe.map(Yt=>jsx("div",{className:"flex items-center px-4 py-2.5",style:{width:ee[Yt.id],minWidth:Yt.minWidth},children:Yt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Se=>{Se.stopPropagation(),Ce(y.id);},className:u("p-0.5 rounded flex-shrink-0",S?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:z?jsx(ChevronDown,{className:u("w-4 h-4",S?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",S?"text-white/40":"text-gray-500")})}),z?jsx(FolderOpen,{className:"w-4 h-4 flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4 flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"}}),y.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0",style:{color:S?"#FFD60A":"#B45309"},children:y.wbsCode}),jsx("span",{title:y.name,className:u("text-[11px] font-semibold uppercase tracking-wide truncate",S?"text-white":"text-gray-800"),style:{fontFamily:"Inter, system-ui, sans-serif",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:y.name}),jsxs("span",{className:u("text-[10px] font-mono px-2 py-0.5 rounded-full flex-shrink-0",S?"text-white/30 bg-white/[0.05]":"text-gray-500 bg-gray-200"),children:["(",ge," ",i==="es"?ge===1?"Tarea":"Tareas":ge===1?"Item":"Items",")"]}),gt!==null&&jsxs("span",{className:u("text-[10px] font-mono flex-shrink-0",gt>=1?"text-[#32D74B]":gt>=.8?"text-[#FFD60A]":"text-[#FF453A]"),children:["Avg SPI: ",gt.toFixed(2)]}),St>0&&jsxs("span",{className:"text-[10px] font-mono text-[#FF453A] flex-shrink-0",children:[i==="es"?"Conflicto":"Conflict",": ",St]})]}):Yt.type==="timeLoggedMinutes"?jsx(mr,{value:Y>0?Y:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):Yt.type==="soldEffortMinutes"?jsx(mr,{value:je>0?je:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):Yt.type==="effortMinutes"?jsx(mr,{value:Re>0?Re:void 0,isDark:S,locale:i,disabled:true,lens:T,hourlyRate:B}):K(y,Yt)},Yt.id))},y.id)}return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:J},className:u("flex items-center border-b transition-colors",S?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(y),onDoubleClick:()=>a.onTaskDoubleClick?.(y),onContextMenu:Y=>st(Y,y),children:[Oe.map(Y=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:ee[Y.id],minWidth:Y.minWidth},children:Y.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&y.level>0&&jsx("div",{style:{width:`${y.level*24}px`},className:"flex-shrink-0"}),h&&y.hasChildren&&jsx("button",{onClick:Re=>{Re.stopPropagation(),Ce(y.id);},className:u("p-0.5 rounded flex-shrink-0",S?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:z?jsx(ChevronDown,{className:u("w-4 h-4",S?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",S?"text-white/60":"text-gray-400")})}),h&&!y.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(y.wbsCode||y.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[y.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",S?"text-[#007BFF]":"text-blue-600"),children:y.wbsCode}),y.taskCode&&jsx("span",{className:u("text-[10px] font-mono",S?"text-white/40":"text-gray-400"),children:y.taskCode})]}),jsx("span",{className:u("truncate font-bold text-[13px]",S?"text-white":"text-gray-900",y.progress===100&&(S?"line-through text-white/30":"line-through text-gray-400")),children:y.name}),y.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${y.tags[0].color}20`,color:y.tags[0].color},children:y.tags[0].name})]})]}):K(y,Y)},Y.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},y.id)})}),I&&Be.length>0&&(()=>{let{spent:y,allocated:L,quoted:z}=M,J=L-y,de=J<0,ge=de?`+${Tn(Math.abs(J))} ${i==="es"?"EXCEDIDO":"OVER"}`:`-${Tn(J)} ${i==="es"?"AHORRADO":"SAVED"}`,Y=T==="financial"&&B>0,Re=St=>Y?`$${(St/60*B).toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`:Tn(St),je=Y?Math.abs(J/60*B):0,gt=Y?`${de?"+":"-"}$${je.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})} ${de?i==="es"?"EXCEDIDO":"OVER":i==="es"?"AHORRADO":"SAVED"}`:ge;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-10",S?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:S?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Oe.map(St=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:ee[St.id],minWidth:St.minWidth},children:St.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:i==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):St.type==="hoursBar"?jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Re(y)}),jsx("span",{className:u("text-[11px]",S?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",S?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Re(L)}),L>0&&jsx("span",{className:u("text-[10px] font-semibold ml-1",de?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y?gt:ge})]}):St.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:z>0?Re(z):"\u2013"}):St.type==="effortMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:L>0?Re(L):"\u2013"}):St.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",S?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:y>0?Re(y):"\u2013"}):jsx("span",{className:u("text-[11px]",S?"text-white/30":"text-gray-300"),children:"\u2013"})},St.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Be.length===0&&$&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",S?"text-white/30":"text-gray-400")}),jsx("p",{className:u(S?"text-white/60":"text-gray-600"),children:G.empty.noResults})]})})]})}),q?.enabled&&q.data&&ke&&jsx(Tg,{data:q.data,isDark:S,locale:i,onClose:()=>_e(false)})]}),jsx(ng,{state:Dt,onClose:nt,isDark:S,locale:i,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ze,onColumnSort:it,availableUsers:d,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink}),jsx(yg,{isOpen:Me,onClose:()=>ct(false),onSave:Lt,isDark:S,locale:i})]})}var Ag=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true}],Lg=[{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"}],Ig=[{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 zd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Ud={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#2E94FF"},Wd={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"},Ai={dark:zd,light:Ud,neutral:Wd};function Bg(e){return Ai[e]||Ai.dark}var Vd={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Gd={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Li={en:Vd,es:Gd};function rs(e){return Li[e]||Li.en}function Ii(e,t){let a=rs(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Rg(e){let t=rs(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Og(e,t=0,a=true){let r=rs(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function ns(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function jd(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function zg({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var Vg=26,J1=22,Q1=10;function Ug(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Kd(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function Gg(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function Wg(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function Z1({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:d=0}){let{task:p,spanCols:l,lane:c,isStart:i,isEnd:m}=e,g=p.progress===100||p.status==="completed",h=p.isCriticalPath,b=i&&m?"rounded":i?"rounded-l":m?"rounded-r":"",w=m?Kd(p.effortMinutes,n,d):null,f=m?Gg(p,n,d):null,x=m?p.blockers?.find(k=>k.severity==="critical"):null;return jsxs(motion.button,{onClick:k=>{k.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",b,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":h?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${c*Vg}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${J1}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:h?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:i?"3px":void 0,borderLeftColor:i?h?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[h&&i&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:p.name}),m&&(w||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[w&&jsxs("span",{children:[s.labels.estimate,": ",w]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),x&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",x.type]}),p.progress>0&&p.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${p.progress}%`}})]})}function _g({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:p=[],onCreateTag:l,attachmentsByTask:c,comments:i,onAddComment:m,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:b,onTaskOpen:w,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,timerState:v,onLogTime:C,onUpdateEstimate:N,onUpdateSoldEffort:E,onStartTimer:T,onStopTimer:B,onDiscardTimer:O,blurFinancials:I=false,suppressDetailModal:G=false,lens:S="hours",hourlyRate:ce=0}){let{theme:M="dark",locale:q="en",customTranslations:ke,showBacklog:_e=true}=t,P=Ii(q,ke),V=M==="dark"||M==="neutral",[re,Te]=useState(r||new Date),[$,Z]=useState(null),[X$1,fe]=useState(null),[Fe,Ke]=useState(null),[qe,ot]=useState({}),ne=3,ut=3,Me=useCallback(W=>{fe(W.id),G||Z(W),w?.(W.id);},[G,w]),[ct,Dt]=useState(null),Tt=useCallback(()=>{Te(new Date(re.getFullYear(),re.getMonth()-1,1));},[re]),xe=useCallback(()=>{Te(new Date(re.getFullYear(),re.getMonth()+1,1));},[re]),rt=useCallback(()=>{Te(new Date);},[]),Ye=useMemo(()=>{let W=re.getFullYear(),te=re.getMonth(),Oe=new Date(W,te,1),Ce=new Date(W,te+1,0),He=Oe.getDay(),Ne=Ce.getDate(),ze=ns(e),it=new Date;it.setHours(0,0,0,0);let st=[],nt=He,pt=new Date(W,te,0).getDate();for(let Et=nt-1;Et>=0;Et--){let dt=new Date(W,te-1,pt-Et);st.push({date:dt,isCurrentMonth:false,isToday:false,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(mt=>jd(dt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}for(let Et=1;Et<=Ne;Et++){let dt=new Date(W,te,Et),mt=dt.getTime()===it.getTime();st.push({date:dt,isCurrentMonth:true,isToday:mt,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(Nt=>jd(dt,Nt)).map(Nt=>({id:Nt.id,title:Nt.name,start:Nt.startDate,end:Nt.endDate,task:Nt}))});}let Rt=42-st.length;for(let Et=1;Et<=Rt;Et++){let dt=new Date(W,te+1,Et);st.push({date:dt,isCurrentMonth:false,isToday:false,isWeekend:dt.getDay()===0||dt.getDay()===6,events:ze.filter(mt=>jd(dt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}return st},[re,e]),Je=useMemo(()=>ns(e).filter(W=>!W.startDate||!W.endDate),[e]),H=useMemo(()=>{let W=ns(e),te=0,Oe=0,Ce=0,He=0,Ne=0;W.forEach(pt=>{pt.effortMinutes&&(te+=pt.effortMinutes),pt.soldEffortMinutes&&(Oe+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(Ce+=pt.scheduleVariance,He++),pt.soldEffortMinutes&&pt.effortMinutes&&(Ne+=pt.soldEffortMinutes-pt.effortMinutes);});let ze=Oe>0?Math.min(100,Math.round(te/Oe*100)):0,it=He>0?Math.round(Ce/He):0,nt=`${Ne<0?"-":"+"}${Wg(Ne,S,ce)}`;return {budgetUtil:ze,avgVariance:it,costDisplay:nt,hasCostData:Oe>0}},[e,S,ce]),le=useMemo(()=>{let W=[0,0,0,0,0,0];return Ye.forEach((te,Oe)=>{let Ce=Math.floor(Oe/7);te.events.forEach(He=>{if(He.task.startDate&&He.task.soldEffortMinutes){let Ne=new Date(He.task.startDate),ze=te.date;Ne.getFullYear()===ze.getFullYear()&&Ne.getMonth()===ze.getMonth()&&Ne.getDate()===ze.getDate()&&Ce<W.length&&(W[Ce]-=He.task.soldEffortMinutes);}});}),W},[Ye]),D=useMemo(()=>{let W=ns(e),te=new Map,Oe=new Set,Ce=[0,0,0,0,0,0];if(Ye.length===0)return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:Ce};let He=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=He(Ye[0].date),ze=He(Ye[Ye.length-1].date),it=[];for(let nt of W){if(!nt.startDate||!nt.endDate)continue;let pt=He(nt.startDate),Rt=He(nt.endDate);if(pt.getTime()===Rt.getTime()||Rt<Ne||pt>ze)continue;let Et=pt<Ne?Ne:pt,dt=Rt>ze?ze:Rt,mt=Ug(Et,Ne),Nt=Ug(dt,Ne);mt<0||mt>41||Nt<0||Nt>41||mt!==Nt&&(Oe.add(nt.id),it.push({task:nt,startIdx:mt,endIdx:Nt}));}it.sort((nt,pt)=>nt.startIdx!==pt.startIdx?nt.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(nt.endIdx-nt.startIdx));let st=[[],[],[],[],[],[]];for(let{task:nt,startIdx:pt,endIdx:Rt}of it){let Et=Math.floor(pt/7),dt=Math.floor(Rt/7),mt=He(nt.startDate),Nt=He(nt.endDate),Lt=false;for(let Ie=Et;Ie<=dt;Ie++){let Be=Ie===Et?pt%7:0,K=Ie===dt?Rt%7:6,he=K-Be+1,ee=0,y=st[Ie]??[];for(st[Ie]||(st[Ie]=y);ee<y.length&&(y[ee]??-1)>=Be;)ee++;if(ee>=Q1){Lt=true;break}ee>=y.length?y.push(K):y[ee]=K,Ce[Ie]=Math.max(Ce[Ie]??0,ee+1);let L=Ie===Et&&mt>=Ne,z=Ie===dt&&Nt<=ze,J=Ie*7+Be,de={taskId:nt.id,task:nt,rowIndex:Ie,startCol:Be,endCol:K,spanCols:he,lane:ee,isStart:L,isEnd:z};te.has(J)||te.set(J,[]),te.get(J).push(de);}Lt&&(Oe.delete(nt.id),te.forEach((Ie,Be)=>{let K=Ie.filter(he=>he.taskId!==nt.id);K.length===0?te.delete(Be):te.set(Be,K);}));}return {segmentsByCell:te,multiDayTaskIds:Oe,maxLanesPerRow:Ce}},[Ye,e]),j=q==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],se=re.toLocaleDateString(q==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),ye=se.charAt(0).toUpperCase()+se.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",V?"text-white/30":"text-gray-600"),children:[P.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",V?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",V?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",V?"bg-[#050505]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",V?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",V?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",V?"text-white/90":"text-gray-900"),children:P.labels.noEvents}),jsx("p",{className:u("text-sm",V?"text-white/30":"text-gray-600"),children:P.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",V?"bg-[#050505]":"bg-white",n),style:d,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",V?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",V?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",V?"text-white":"text-gray-900"),children:q==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",V?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Tt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",V?"text-white":"text-gray-900"),children:ye}),jsx("button",{onClick:xe,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",V?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",V?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:rt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",V?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:P.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",V?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:j.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",V?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",V?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>fe(null),children:Ye.map((W,te)=>{let Oe=te%7===6,Ce=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Oe&&(V?"border-r border-[#222]":"border-r border-gray-200"),!Ce&&(V?"border-b border-[#222]":"border-b border-gray-200"),V?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&V&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!V&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?V?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?V?"text-white/60":"text-gray-900":V?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let He=Math.floor(te/7),Ne=(D.maxLanesPerRow[He]??0)*Vg,ze=D.segmentsByCell.get(te);return Ne===0&&!ze?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:ze?.map(it=>jsx(Z1,{segment:it,isDark:V,blurFinancials:I,isSelected:X$1===it.taskId,t:P,lens:S,hourlyRate:ce,onClick:()=>{Me(it.task),a.onEventClick?.({id:it.task.id,title:it.task.name,start:it.task.startDate,end:it.task.endDate,task:it.task});}},it.taskId))})})(),(()=>{let He=W.events.filter(Ne=>Ne.task.isMilestone&&!D.multiDayTaskIds.has(Ne.id));return He.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[He.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:ze=>{ze.stopPropagation(),Me(Ne.task);}},Ne.id)),He.length>4&&jsxs("span",{className:u("text-[8px] font-mono",V?"text-white/30":"text-gray-400"),children:["+",He.length-4]})]})})(),(()=>{let He=[];W.events.forEach(ze=>{ze.task.blockers?.forEach(it=>{(it.severity==="warning"||it.severity==="critical")&&He.push({taskId:ze.id,type:it.type,severity:it.severity,variance:ze.task.scheduleVariance});});});let Ne=He[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[P.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${P.labels.delay})`:""]})]})}):null})(),(()=>{let He=W.events.filter(st=>!D.multiDayTaskIds.has(st.id)),Ne=qe[te]||ne,ze=He.slice(0,Ne),it=He.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[ze.map(st=>jsxs(motion.button,{onClick:()=>{Me(st.task),a.onEventClick?.(st);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",st.task.progress===100||st.task.status==="completed"?V?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":V?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:V?st.task.progress===100||st.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:st.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",st.task.isMilestone?V?"text-amber-400":"text-amber-600":st.task.isCriticalPath?"text-red-400":V?"text-[#1264FF]":"text-gray-400"),children:st.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:st.title})]},st.id)),it>0&&jsxs("button",{onClick:st=>{st.stopPropagation(),ot(nt=>({...nt,[te]:Ne+ut}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",it," ",q==="es"?"m\xE1s":"more"]}),Ne>ne&&He.length>ne&&jsx("button",{onClick:st=>{st.stopPropagation(),ot(nt=>({...nt,[te]:ne}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",V?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:q==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let He=te>=28,Ne=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:ze=>{ze.stopPropagation(),Dt(ct===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ct===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",V?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",ct===te&&"rotate-45")})}),jsx(AnimatePresence,{children:ct===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Dt(null)}),jsx(motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",V?"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(Ao,{onSubmit:ze=>{a.onTaskCreate?.({name:ze.name,startDate:ze.startDate||W.date,endDate:ze.endDate||W.date,priority:ze.priority,assignees:ze.assignee?[ze.assignee]:void 0}),Dt(null);},onCancel:()=>Dt(null),availableUsers:t.availableUsers,isDark:V,locale:q==="es"?"es":"en",defaultDate:W.date,dropdownDirection:He?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let He=Math.floor(te/7),Ne=le[He];if(!Ne||Ne===0)return null;let ze=Wg(Ne,S,ce);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",I&&"blur-sm select-none"),children:[P.labels.cashOut,": ",Ne<0?"-":"+",ze]})})()]},te)})})})]}),_e&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",V?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",V?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:P.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",V?"text-white/20":"text-gray-400"),children:Je.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Je.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",V?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",V?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",V?"text-white/20":"text-gray-400"),children:q==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Je.map(W=>jsxs("button",{onClick:()=>{Me(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",V?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",V?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",V?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",V?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",V?"text-white/25":"text-gray-400",I&&"blur-sm select-none"),children:[Kd(W.effortMinutes,S,ce)&&jsxs("span",{children:[P.labels.estimate,": ",Kd(W.effortMinutes,S,ce)]}),(()=>{let te=Gg(W,S,ce);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(zg,{task:W,isDark:V})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,Oe)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Oe))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:P.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",V?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",V?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",V?"text-white/40":"text-gray-500"),children:["\u25C8 ",P.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",V?"text-white/40":"text-gray-500"),children:P.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",V?"text-white/60":"text-gray-700",I&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",V?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:P.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":V?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",P.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",V?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",V?"text-white/25":"text-gray-400"),children:P.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",I&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!G&&jsx(Xr,{task:$,isOpen:!!$,onClose:()=>Z(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),Z(W);},theme:M==="dark"?"dark":"light",locale:q,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:p,onCreateTag:l,attachments:$?c?.get($.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:ns(e).filter(W=>W.id!==$?.id),comments:i?.filter(W=>W.taskId===$?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:m,currentUser:g,mentionableUsers:h,onUploadCommentAttachments:b,enableTimeTracking:f,timeTrackingSummary:x,timeEntries:k,isTimerRunning:v?.isRunning,timerElapsedSeconds:v?.elapsedSeconds,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:E,onTimerStart:T,onTimerStop:B,onTimerDiscard:O,blurFinancials:I}),jsx(AnimatePresence,{children:Fe&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ke(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",V?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",V?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",V?"text-white/90":"text-gray-900"),children:Fe.date.toLocaleDateString(q==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ke(null),className:u("p-1 rounded",V?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Fe.events.map(W=>jsxs("button",{onClick:()=>{Ke(null),Me(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",V?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(zg,{task:W.task,isDark:V}),jsx("span",{className:u("text-sm truncate flex-1",V?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var Yd={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},qd={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},Xd={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Oi={dark:Yd,light:qd,neutral:Xd};function jg(e){return Oi[e]||Oi.dark}function tw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[p,l]=useState(false),c=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),i=useMemo(()=>{let g=c.length,h=new Set(c.flatMap(f=>f.assignedUserIds||[])).size,b=c.map(f=>f.priority).filter(Boolean),w=new Set(c.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:h,priorities:b,labels:w}},[c]),m=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",d),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:m,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:i.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"]})]}),p&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[i.uniqueAssignees," assignees"]})]}),i.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:[i.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:c.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:c.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:h=>{h.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var Yg={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function is(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 ls(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 qg(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Xg({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let p=useMemo(()=>({...Yg,...n}),[n]),[l,c]=useState(new Set),i=useRef(null),m=useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let x=new Map;return e.forEach(k=>{let v=k.timestamp.toISOString().split("T")[0],C=x.get(v);C?C.push(k):x.set(v,[k]);}),Array.from(x.entries()).sort((k,v)=>v[0].localeCompare(k[0])).map(([k,v])=>({date:new Date(k),events:v.sort((C,N)=>N.timestamp.getTime()-C.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:g,uniqueTypes:h}=useMemo(()=>{let x=new Set,k=new Set;return e.forEach(v=>{x.add(v.userId),k.add(v.type);}),{uniqueUsers:Array.from(x),uniqueTypes:Array.from(k)}},[e]),b=x=>{c(k=>{let v=new Set(k);return v.has(x)?v.delete(x):v.add(x),v});},w=x=>{let v=new Date().getTime()-x.getTime(),C=Math.floor(v/6e4),N=Math.floor(v/36e5),E=Math.floor(v/864e5);return C<1?"just now":C<60?`${C}m ago`:N<24?`${N}h ago`:E<7?`${E}d ago`:x.toLocaleDateString()},f=useMemo(()=>{let x=0;return t.types&&t.types.length>0&&x++,t.users&&t.users.length>0&&x++,t.dateRange&&x++,t.searchTerm&&x++,x},[t]);return useEffect(()=>{if(s&&i.current){let x=i.current.querySelector(`[data-event-id="${s}"]`);x&&x.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",d),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",p.compact&&"compact",d),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:x=>{let k=x.target.value;a({...t,types:k?[k]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),h.map(x=>jsxs("option",{value:x,children:[ls(x)," ",x.replace("_"," ")]},x))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:x=>{let k=x.target.value;a({...t,users:k?[k]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(x=>jsx("option",{value:x,children:x},x))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:x=>a({...t,searchTerm:x.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:i,children:m.map(x=>jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&x.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:x.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[x.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:x.events.map((k,v)=>{let C=l.has(k.id),N=s===k.id,E=qg(k.type);return jsxs("div",{"data-event-id":k.id,className:u("history-timeline-event",C&&"expanded",N&&"selected"),onClick:()=>o?.(k),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:p.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ls(k.type)})}),v<x.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),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:[p.showAvatars&&k.userAvatar&&jsx("img",{src:k.userAvatar,alt:k.userName||k.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:k.userName||k.userId}),jsx("span",{className:"history-timeline-event-action",children:is(k)})]})]}),jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?w(k.timestamp):k.timestamp.toLocaleString()})]}),Object.keys(k.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),b(k.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(k.changes).map(([T,B])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(B.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(B.to)})]})]},T)),k.metadata&&Object.keys(k.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(k.metadata).map(([T,B])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(B)})]},T))]})]})]})]},k.id)})})]},x.date?.toISOString()||"all"))})]})}function Qg({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:p,className:l}){let c=[.5,1,1.5,2,3],i=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),m=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:i&&ls(i.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:i&&is(i)}),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:i&&i.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>d(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${m}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,h)=>jsx("div",{className:u("history-replay-progress-marker",h===e.currentIndex&&"active"),style:{left:`${h/(e.totalEvents-1)*100}%`},onClick:()=>d(h),title:is(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:c.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>p(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:i&&i.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Jd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function Qd(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function Zg(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 e0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function iw(e,t,a,r,o,s=100){let n=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(p=>[p.id,p]));for(let p=0;p<s;p++){let l=1-p/s;n.forEach(c=>{let i=a/2,m=r/2;c.vx+=(i-c.x)*o.centerForce*l,c.vy+=(m-c.y)*o.centerForce*l,n.forEach(g=>{if(c.id===g.id)return;let h=c.x-g.x,b=c.y-g.y,w=Math.sqrt(h*h+b*b)||1,f=o.chargeStrength*l/(w*w);c.vx+=h/w*f,c.vy+=b/w*f;});}),t.forEach(c=>{let i=d.get(typeof c.source=="string"?c.source:c.source.id),m=d.get(typeof c.target=="string"?c.target:c.target.id);if(!i||!m)return;let g=m.x-i.x,h=m.y-i.y,b=Math.sqrt(g*g+h*h)||1,w=(b-o.linkDistance)/b*o.forceStrength*l;i.vx+=g*w,i.vy+=h*w,m.vx-=g*w,m.vy-=h*w;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function t0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:p}){let l=useRef(null),[c,i]=useState([]),[m,g]=useState(null),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(1),[v,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let S=iw(e,t,a.width,a.height,a,150);i(S);},[e,t,a]);let N=useCallback((S,ce)=>{a.enableDragging&&(ce.stopPropagation(),g(S));},[a.enableDragging]),E=useCallback(S=>{if(!m||!l.current)return;let M=l.current.getBoundingClientRect(),q=(S.clientX-M.left-v.x)/x,ke=(S.clientY-M.top-v.y)/x;i(_e=>_e.map(P=>P.id===m?{...P,x:q,y:ke,fx:q,fy:ke}:P));},[m,x,v]),T=useCallback(()=>{g(null);},[]),B=useCallback((S,ce)=>{ce.stopPropagation(),d?.({type:"node-click",node:S,position:{x:ce.clientX,y:ce.clientY}});},[d]),O=useCallback((S,ce)=>{ce.stopPropagation(),d?.({type:"edge-click",edge:S,position:{x:ce.clientX,y:ce.clientY}});},[d]),I=useCallback(S=>{let ce=c.find(M=>M.id===S);return ce?{x:ce.x,y:ce.y}:{x:0,y:0}},[c]),G=useCallback(S=>{if(S.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return S.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ce=S.card.priority;return ce==="URGENT"?"#ef4444":ce==="HIGH"?"#f59e0b":ce==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return S.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",p),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:u("relationships-graph",p),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(S=>Math.min(S+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(x*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>k(S=>Math.max(S-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{k(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(S=>S.type))).map(S=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Jd(S)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Zg(S)," ",Qd(S)]})]},S))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${v.x}, ${v.y}) scale(${x})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(S=>{let ce=I(typeof S.source=="string"?S.source:S.source.id),M=I(typeof S.target=="string"?S.target:S.target.id),q=e0(S.type),ke=w===S.id,_e=S.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ke&&"hovered",_e&&"critical"),onMouseEnter:()=>f(S.id),onMouseLeave:()=>f(null),onClick:P=>O(S,P),children:[jsx("line",{x1:ce.x,y1:ce.y,x2:M.x,y2:M.y,stroke:Jd(S.type),strokeWidth:_e?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:q?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsx("text",{x:(ce.x+M.x)/2,y:(ce.y+M.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Qd(S.type)})]},S.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(S=>{let ce=h===S.id,M=S.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",ce&&"hovered",M&&"critical"),transform:`translate(${S.x}, ${S.y})`,onMouseDown:q=>N(S.id,q),onMouseEnter:()=>b(S.id),onMouseLeave:()=>b(null),onClick:q=>B(S,q),children:[jsx("circle",{r:M?a.nodeSize*1.2:a.nodeSize,fill:G(S),stroke:M?"#fbbf24":"#ffffff",strokeWidth:M?3:2,opacity:ce?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:S.card.title.length>20?S.card.title.substring(0,20)+"...":S.card.title})]},S.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 o0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,p]=useState(false),[l,c]=useState(null),[i,m]=useState(null),g=useRef(null),h=d||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let x=k=>{k.key==="Escape"&&!h&&b();};if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,h]);let b=()=>{h||(n(""),c(null),m(null),t());},w=async()=>{if(!(!s.trim()||h)){p(true),c(null),m(null);try{let x=await r(s.trim());m(x);}catch(x){c(x instanceof Error?x.message:"Failed to generate plan");}finally{p(false);}}},f=()=>{i&&(a(i),b());};return e?jsxs(It,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),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:x=>x.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:b,disabled:h,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:i?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!"})]}),i.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:i.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",i.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:i.columns.map((x,k)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:x.title},k))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",i.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.cards.slice(0,10).map((x,k)=>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:x.title}),x.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:x.description})]}),x.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${x.priority==="URGENT"?"bg-red-500/20 text-red-400":x.priority==="HIGH"?"bg-orange-500/20 text-orange-400":x.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:x.priority})]})},k)),i.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",i.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:x=>n(x.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:h}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((x,k)=>jsx("button",{onClick:()=>n(x),disabled:h,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:x},k))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:h&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:b,disabled:h,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"}),i?jsx("button",{onClick:f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:w,disabled:!s.trim()||h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:h?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Zd={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var dw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},cw={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 uw(e,t,a){let r=Zd[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ds(e){return `$${e.toFixed(4)}`}var ec=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=uw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(i=>i.timestamp>=t.start&&i.timestamp<=t.end));let r=a.length,o=a.reduce((i,m)=>i+m.cost,0),s=a.reduce((i,m)=>i+m.inputTokens,0),n=a.reduce((i,m)=>i+m.outputTokens,0),d=a.filter(i=>i.success),p=a.reduce((i,m)=>i+m.duration,0),l={},c={};return a.forEach(i=>{l[i.feature]=(l[i.feature]||0)+1,c[i.feature]=(c[i.feature]||0)+i.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:c,averageDuration:r>0?p/r:0,successRate:r>0?d.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let d=this.operations.filter(c=>c.timestamp>=n).length,p=Math.max(0,o-d),l=d/o*100;return {used:d,limit:o,remaining:p,percentUsed:l,isExceeded:d>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Uo=new ec;function i0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Uo.getStats()),[s,n]=useState(Uo.checkLimit(a));if(useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(Uo.getStats()),n(Uo.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),useEffect(()=>{let p=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let d=Uo.getRecentOperations(5);return jsxs(It,{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: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:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ds(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,l])=>{let c=r.costsByFeature[p]||0,i=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(c)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${i}%`}})})]},p)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.map(p=>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:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ds(p.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function c0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[p,l]=useState(""),[c,i]=useState(""),[m,g]=useState(false),[h,b]=useState(null),[w,f]=useState(null),[x,k]=useState(null),v=useRef(null),C=m||o;useEffect(()=>{e&&v.current&&v.current.focus();},[e]),useEffect(()=>{let O=I=>{I.key==="Escape"&&!C&&N();};if(e)return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,C]);let N=()=>{C||(d(""),l(""),i(""),b(null),f(null),k(null),t());},E=async()=>{if(!(!n.trim()||C)){g(true),b(null),f(null),k(null);try{let O=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:c||void 0});f(O.tasks.tasks),k({from_cache:O.from_cache,tokens_used:O.tokens_used,mock_mode:O.mock_mode,similarity:O.similarity,tokens_saved:O.tokens_saved});}catch(O){b(O instanceof Error?O.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{w&&(a(w),N());};if(!e)return null;let B=x?.similarity?((x.similarity||0)*100).toFixed(0):"0";return jsxs(It,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:O=>O.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:N,disabled:C,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:w?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:[x?.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"}),x?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",B,"% 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:[x?.tokens_used||0," tokens"]}),x?.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:[x.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:[w.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:w.map((O,I)=>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:["#",I+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:O.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"})]}),O.start," \u2192 ",O.end]}),jsxs("span",{children:[O.duration," days"]}),O.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",O.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${O.priority==="high"?"bg-red-500/20 text-red-400":O.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:O.priority})]})},O.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:v,value:n,onChange:O=>d(O.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:C}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:O=>l(O.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:O=>i(O.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:C})]})]}),h&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:h}),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((O,I)=>jsx("button",{onClick:()=>d(O),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:O},I))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:N,disabled:C,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),w?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:E,disabled:!n.trim()||C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function zi({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(w=>{t&&Cs(()=>Promise.resolve(t(w)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,x,k)=>{console.warn(`Retry attempt ${x} after ${k}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(w,f,x)=>{r(k=>{let v=k.cards.find(O=>O.id===w);if(!v)return k;let C=v.columnId,N={...v,columnId:f,position:x},E=k.cards.map(O=>O.id===w?N:O),T=k.columns.map(O=>{if(O.id===C)return {...O,cardIds:O.cardIds.filter(I=>I!==w)};if(O.id===f){let I=E.filter(G=>G.columnId===f).sort((G,S)=>G.position-S.position);return {...O,cardIds:I.map(G=>G.id)}}return O}),B={...k,cards:E,columns:T};return o(B),B});},[o]),n=useCallback(async(w,f)=>{r(x=>{let k=x.cards.map(C=>C.id===w?{...C,...f}:C),v={...x,cards:k};return o(v),v});},[o]),d=useCallback(async w=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...w,id:f},v=x.columns.map(N=>N.id===w.columnId?{...N,cardIds:[...N.cardIds,f]}:N),C={...x,cards:[...x.cards,k],columns:v};return o(C),C});},[o]),p=useCallback(async w=>{r(f=>{let x=f.cards.find(N=>N.id===w);if(!x)return f;let k=f.cards.filter(N=>N.id!==w),v=f.columns.map(N=>N.id===x.columnId?{...N,cardIds:N.cardIds.filter(E=>E!==w)}:N),C={...f,cards:k,columns:v};return o(C),C});},[o]),l=useCallback(async w=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(x=>{let k={...w,id:f,cardIds:[]},v={...x,columns:[...x.columns,k]};return o(v),v});},[o]),c=useCallback(async(w,f)=>{r(x=>{let k=x.columns.map(C=>C.id===w?{...C,...f}:C),v={...x,columns:k};return o(v),v});},[o]),i=useCallback(async w=>{r(f=>{let x=f.cards.filter(C=>C.columnId!==w),k=f.columns.filter(C=>C.id!==w),v={...f,cards:x,columns:k};return o(v),v});},[o]),m=useCallback(w=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(w),f},[d]),g=useCallback(w=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(w),f},[l]),h=useCallback(()=>{r(w=>{let f={...w,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:p,onColumnCreate:l,onColumnUpdate:c,onColumnDelete:i},setBoard:r,helpers:{addCard:m,addColumn:g,deleteCard:p,deleteColumn:i,clearBoard:h}}}function p0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=zi({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(p,l,c={})=>{s.addCard({title:l,columnId:p,position:r.cards.filter(i=>i.columnId===p).length,...c});},addColumn:(p,l)=>{let c=r.columns.length>0?Math.max(...r.columns.map(i=>i.position)):0;s.addColumn({title:p,position:l??c+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var cs={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},g0={by:"none",order:"asc"};function f0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...cs,...e}),[s,n]=useState({...g0,...t}),d=useCallback(b=>{o(w=>({...w,...b}));},[]),p=useCallback(b=>{n(w=>({...w,...b}));},[]),l=useCallback(()=>{o(cs),n(g0);},[]),c=useCallback(()=>{a&&o({...cs,assignees:[a]});},[a]),i=useCallback(()=>{o({...cs,dateFilter:"overdue"});},[]),m=useCallback(()=>{o({...cs,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),h=useCallback(b=>{let w=[...b];if(r.search){let f=r.search.toLowerCase();w=w.filter(x=>x.title.toLowerCase().includes(f)||x.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,x=f.getFullYear(),k=String(f.getMonth()+1).padStart(2,"0"),v=String(f.getDate()).padStart(2,"0"),C=`${x}-${k}-${v}`;w=w.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let E=N.endDate||N.dueDate;if(!E)return false;let T;if(typeof E=="string")T=E.split("T")[0]||E;else {let B=E.getUTCFullYear(),O=String(E.getUTCMonth()+1).padStart(2,"0"),I=String(E.getUTCDate()).padStart(2,"0");T=`${B}-${O}-${I}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let B=new Date(C+"T00:00:00"),O=new Date(T+"T00:00:00"),I=new Date(B);return I.setDate(I.getDate()+7),O>=B&&O<=I;case "custom":if(r.dateRange){let G=typeof E=="string"?new Date(E):E;return G>=r.dateRange.start&&G<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(w=w.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(w=w.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(k=>r.assignees.includes(k)))),r.labels.length>0&&(w=w.filter(f=>f.labels&&f.labels.some(x=>r.labels.includes(x)))),r.columns.length>0&&(w=w.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&w.sort((f,x)=>{let k=0;switch(s.by){case "created":let v=f.createdAt?new Date(f.createdAt).getTime():0,C=x.createdAt?new Date(x.createdAt).getTime():0;k=v-C;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=N[f.priority||"LOW"],T=N[x.priority||"LOW"];k=E-T;break;case "dueDate":let B=f.endDate||f.dueDate,O=x.endDate||x.dueDate;if(!B)return 1;if(!O)return -1;let I=typeof B=="string"?new Date(B).getTime():B.getTime(),G=typeof O=="string"?new Date(O).getTime():O.getTime();k=I-G;break;case "title":k=f.title.localeCompare(x.title);break;case "estimate":let S=f.estimatedTime||0,ce=x.estimatedTime||0;k=S-ce;break;default:k=0;}return s.order==="asc"?k:-k}),w},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:p,resetFilters:l,filterMyTasks:c,filterOverdue:i,filterHighPriority:m,applyFilters:h,hasActiveFilters:g}}var h0,y0;if(typeof window<"u")try{let e=vs("ai");h0=e.generateObject,y0=e.generateText;}catch{}function x0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(h0&&y0&&e.apiKey),n=useCallback(async i=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",i),{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: ${i}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(m){let g=m instanceof Error?m:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),d=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",i.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(m){let g=m instanceof Error?m:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),p=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(m){let g=m instanceof Error?m:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",i.title),[{title:`Subtask 1 for: ${i.title}`,position:i.position+.1,columnId:i.columnId},{title:`Subtask 2 for: ${i.title}`,position:i.position+.2,columnId:i.columnId}]}catch(m){let g=m instanceof Error?m:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async i=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",i.title),{hours:8,confidence:.75}}catch(m){let g=m instanceof Error?m:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:p,onGenerateSubtasks:l,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function ac(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function v0(e){let{cards:t}=e,[a,r]=ac(),o=useCallback(i=>a.selectedCardIds.includes(i),[a.selectedCardIds]),s=useCallback((i,m)=>{if(!m){r({selectedCardIds:[i],lastSelectedCardId:i});return}let g=m.ctrlKey||m.metaKey,h=m.shiftKey;if(g)a.selectedCardIds.includes(i)?r({selectedCardIds:a.selectedCardIds.filter(b=>b!==i),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});else if(h&&a.lastSelectedCardId){let b=t.find(f=>f.id===i),w=t.find(f=>f.id===a.lastSelectedCardId);if(b&&w&&b.columnId===w.columnId){let f=t.filter(T=>T.columnId===b.columnId).sort((T,B)=>T.position-B.position),x=f.findIndex(T=>T.id===a.lastSelectedCardId),k=f.findIndex(T=>T.id===i),[v,C]=x<k?[x,k]:[k,x],N=f.slice(v,C+1).map(T=>T.id),E=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:E,lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});}else r({selectedCardIds:[i],lastSelectedCardId:i});},[t,a,r]),n=useCallback(i=>{r({selectedCardIds:a.selectedCardIds.filter(m=>m!==i),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=useCallback(()=>{r({selectedCardIds:t.map(i=>i.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(i=>{a.selectedCardIds.includes(i)?n(i):r({selectedCardIds:[...a.selectedCardIds,i],lastSelectedCardId:i});},[a,n,r]),c=useCallback(()=>t.filter(i=>a.selectedCardIds.includes(i.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:p,toggleCard:l,getSelectedCards:c}}var w0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function k0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...w0,...a}),[a]),[s,n]=useState([]),d=useCallback((b,w,f,x,k)=>{if(w.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let v={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:b,cardIds:w,columnId:f,strategy:x,color:k,isExpanded:true,position:s.filter(C=>C.columnId===f).length,createdAt:new Date};n(C=>[...C,v]);},[o.minCardsPerStack,s]),p=useCallback(b=>{n(w=>w.filter(f=>f.id!==b));},[]),l=useCallback(b=>{n(w=>w.map(f=>f.id===b?{...f,isExpanded:!f.isExpanded}:f));},[]),c=useCallback((b,w)=>{n(f=>f.map(x=>x.id===b&&!x.cardIds.includes(w)?{...x,cardIds:[...x.cardIds,w]}:x));},[]),i=useCallback((b,w)=>{n(f=>f.map(x=>{if(x.id===b){let k=x.cardIds.filter(v=>v!==w);return k.length<o.minCardsPerStack?null:{...x,cardIds:k}}return x}).filter(x=>x!==null));},[o.minCardsPerStack]),m=useCallback(b=>s.filter(w=>w.columnId===b).sort((w,f)=>w.position-f.position),[s]),g=useCallback(async b=>{let w=t.filter(C=>C.columnId===b);if(w.length<o.minCardsPerStack*2)return [];let f=[],x=new Map;w.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(N=>{x.has(N)||x.set(N,[]),x.get(N).push(C);});}),x.forEach((C,N)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:C.map(E=>E.id),columnId:b,strategy:"labels",color:"#3b82f6"},reason:`${C.length} cards with label "${N}"`,confidence:.85});});let k=new Map;w.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(N=>{k.has(N)||k.set(N,[]),k.get(N).push(C);});}),k.forEach((C,N)=>{C.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:C.map(E=>E.id),columnId:b,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let v=new Map;if(w.forEach(C=>{C.priority&&(v.has(C.priority)||v.set(C.priority,[]),v.get(C.priority).push(C));}),v.forEach((C,N)=>{if(C.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";f.push({stack:{title:`${E} ${N} Priority`,cardIds:C.map(T=>T.id),columnId:b,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let C of w){let E=(await r.findSimilar(C,w)).filter(T=>T.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let T=[C.id,...E.map(O=>O.card.id)],B=E.reduce((O,I)=>O+I.similarity,0)/E.length;f.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:b,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:B});}}return f.filter(C=>C.confidence>=o.autoStackConfidenceThreshold).sort((C,N)=>N.confidence-C.confidence).slice(0,5)},[t,o,r]),h=useCallback(b=>{d(b.stack.title,b.stack.cardIds,b.stack.columnId,b.stack.strategy,b.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(w=>w.columnId)).forEach(async w=>{let f=await g(w),x=f[0];f.length>0&&x&&x.confidence>=.9&&h(x);});},[]),{stacks:s,createStack:d,deleteStack:p,toggleStack:l,addToStack:c,removeFromStack:i,getStacksForColumn:m,getSuggestions:g,applySuggestion:h,config:o}}var C0=createContext(null);function T0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(p=>{let{Column:l}=vs("@libxai/core");s.set(p.id,new l(p));}),t?.cards?.forEach(p=>{let{Card:l}=vs("@libxai/core");n.set(p.id,new l(p));});let d=null;if(t?.board){let{Board:p}=vs("@libxai/core");d=new p(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(C0.Provider,{value:{store:o},children:e})}function Ui(){let e=useContext(C0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ps(){let e=Ui(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let d=useCallback(x=>{e.updateBoard(x);},[e]),p=useCallback(x=>{e.addColumn(x);},[e]),l=useCallback((x,k)=>{e.updateColumn(x,k);},[e]),c=useCallback(x=>{e.deleteColumn(x);},[e]),i=useCallback(x=>e.getColumn(x),[e]),m=useCallback(x=>{e.addCard(x);},[e]),g=useCallback((x,k)=>{e.updateCard(x,k);},[e]),h=useCallback(x=>{e.deleteCard(x);},[e]),b=useCallback((x,k,v)=>{e.moveCard(x,k,v);},[e]),w=useCallback(x=>e.getCard(x),[e]),f=useCallback(x=>e.getCardsByColumn(x),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:p,updateColumn:l,deleteColumn:c,getColumn:i,addCard:m,updateCard:g,deleteCard:h,moveCard:b,getCard:w,getCardsByColumn:f}}function D0(e){let{cards:t}=ps();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function S0(e="position",t="asc"){let{cards:a}=ps();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?d[o.priority]:0,l=s.priority?d[s.priority]:0;n=p-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Wi=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Gc.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Ew=new Wi;function F0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:p}){let l=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),i=c.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:m,className:o,children:jsx("div",{style:g,children:i.map(h=>{let b=e[h.index];if(!b)return null;let w=p?p(b,h.index):h.index,f={position:"absolute",top:n?0:h.start,left:n?h.start:0,width:n?h.size:"100%",height:n?"100%":h.size};return jsx("div",{style:f,"data-index":h.index,children:r(b,h.index)},w)})})})}function P0(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 A0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:p,horizontal:l=true}){let c=useRef(null),i=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),m=i.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},h={width:`${i.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:g,className:s,children:jsx("div",{style:h,children:m.map(b=>{let w=e[b.index];if(!w)return null;let f=p?p(w,b.index):b.index,x={position:"absolute",top:0,left:b.start,width:b.size,height:"100%"};return jsx("div",{style:x,"data-index":b.index,children:o(w,b.index)},f)})})})}function L0(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 I0(e,t=10){return e>t}var sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ic={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},lc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},dc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},cc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},uc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},pc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},mc={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)"},gc={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)"},fc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},bc={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}},hc={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}},Vi={spacing:sc,borderRadius:ic,fontSize:lc,fontWeight:dc,lineHeight:cc,zIndex:uc,duration:pc,easing:mc,shadows:gc,opacity:fc,kanban:bc,gantt:hc};function B0(e,t,a){return e[t]??a}function yc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?yc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Mw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function xc(e="asakaa"){let t=yc(Vi),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Mw(o);a.push(` ${s}: ${n};`);}return `:root {
414
414
  ${a.join(`
415
415
  `)}
416
- }`}function ms(e,t="asakaa"){let a=[],r=hc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
416
+ }`}function ms(e,t="asakaa"){let a=[],r=yc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
417
417
  ${a.join(`
418
418
  `)}
419
- }`}var Vi={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:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},xc={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:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},vc={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:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function wc(e=Vi,t="asakaa"){let a=yc(t),r=ms(e,t);return `${a}
419
+ }`}var Gi={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:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},vc={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:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},wc={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:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function kc(e=Gi,t="asakaa"){let a=xc(t),r=ms(e,t);return `${a}
420
420
 
421
- ${r}`}function B0(){return `/**
421
+ ${r}`}function R0(){return `/**
422
422
  * ASAKAA Design Tokens
423
423
  * Auto-generated from design-tokens.ts
424
424
  * Do not edit this file directly
425
425
  */
426
426
 
427
- ${wc(Vi)}
427
+ ${kc(Gi)}
428
428
 
429
429
  /* Light theme */
430
430
  [data-theme="light"] {
431
- ${ms(xc,"asakaa").split(`
431
+ ${ms(vc,"asakaa").split(`
432
432
  `).slice(1,-1).join(`
433
433
  `)}
434
434
  }
435
435
 
436
436
  /* Neutral theme */
437
437
  [data-theme="neutral"] {
438
- ${ms(vc,"asakaa").split(`
438
+ ${ms(wc,"asakaa").split(`
439
439
  `).slice(1,-1).join(`
440
440
  `)}
441
441
  }
442
- `}var Pw=({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 R0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=dn();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let p=n,l=p===r;return jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":l,title:d.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Pw,{theme:p})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:d.displayName})]},p)})})}
443
- export{s0 as AIUsageDashboard,lw as AI_FEATURES,Qd as AI_MODELS,Dl as AddCardButton,wl as AddColumnButton,zr as AttachmentUploader,C0 as BoardProvider,_s as BulkOperationsToolbar,$l as BurnDownChart,Lg as CUSTOM_FIELD_TYPES,Gg as CalendarBoard,Yr as Card,Al as CardDetailModal,Bl as CardDetailModalV2,Jg as CardHistoryReplay,qg as CardHistoryTimeline,e0 as CardRelationshipsGraph,Z1 as CardStack,_l as CardTemplateSelector,el as CircuitBreaker,tn as Column,ei as ColumnManager,Fl as CommandPalette,ql as ConfigMenu,gn as ContextMenu,_n as DEFAULT_SHORTCUTS,Mg as DEFAULT_TABLE_COLUMNS,Gl as DEFAULT_TEMPLATES,Mn as DateRangePicker,Ln as DependenciesSelector,qn as DependencyLine,Hl as DistributionCharts,ll as EditableColumnTitle,on as ErrorBoundary,Kl as ExportImportModal,Yl as FilterBar,um as GANTT_AI_SYSTEM_PROMPT,bi as GanttAIAssistant,sm as GanttBoard,un as GanttI18nContext,ui as GanttMilestone,Zs as GanttToolbar,d0 as GenerateGanttTasksDialog,r0 as GeneratePlanModal,Wl as GroupBySelector,gl as HealthBar,po as KanbanBoard,xl as KanbanToolbar,Wn as KanbanViewAdapter,Vl as KeyboardShortcutsHelp,Pg as ListView,jt as MenuIcons,Ui as PluginManager,So as PrioritySelector,fl as ProfitabilityReport,Ao as QuickTaskCreate,iw as RATE_LIMITS,Ag as STANDARD_FIELDS,zl as SwimlaneBoardView,cl as TagBadge,Du as TagList,lo as TagPicker,si as TaskBar,Xr as TaskDetailModal,cm as TaskFormModal,ri as TaskGrid,Zl as ThemeModal,Cp as ThemeProvider,R0 as ThemeSwitcher,Or as TimeInputPopover,ul as TimePill,pl as TimePopover,mi as Timeline,Fo as UserAssignmentSelector,Ol as VelocityChart,M0 as VirtualGrid,E0 as VirtualList,Uo as aiUsageTracker,sc as borderRadius,ks as calculatePosition,Kd as calendarDarkTheme,Wd as calendarEnTranslations,Vd as calendarEsTranslations,Yd as calendarLightTheme,qd as calendarNeutralTheme,Ri as calendarThemes,Ai as calendarTranslations,xi as cardToGanttTask,ym as cardsToGanttTasks,u as cn,ap as createKanbanView,bf as createRetryWrapper,Xl as darkTheme,Vi as darkTokenTheme,Ks as defaultTheme,Wi as designTokens,uc as duration,pc as easing,B0 as exportTokensToCSS,ao as findTaskByName,ic as fontSize,lc as fontWeight,ds as formatCost,qs as ganttEnTranslations,Np as ganttEsTranslations,hm as ganttTaskToCardUpdate,et as ganttThemes,bc as ganttTokens,ed as ganttTranslations,Ae as ganttUtils,yc as generateCSSVariables,wc as generateCompleteCSS,pf as generateInitialPositions,pm as generateTasksContext,ms as generateThemeVariables,_g as getCalendarTheme,rs as getCalendarTranslations,Ig as getListViewTheme,wd as getListViewTranslations,Bg as getMonthNames,I0 as getToken,Dp as getTranslations,Rg as getWeekdayNames,fc as kanbanTokens,Jl as lightTheme,xc as lightTokenTheme,dc as lineHeight,Hd as listViewDarkTheme,xd as listViewEnTranslations,vd as listViewEsTranslations,zd as listViewLightTheme,Ud as listViewNeutralTheme,Mi as listViewThemes,vi as listViewTranslations,Li as mergeCalendarTranslations,wi as mergeListViewTranslations,td as mergeTranslations,Ql as neutralTheme,vc as neutralTokenTheme,gc as opacity,fm as parseLocalCommand,bd as parseNaturalDate,hd as parseNaturalDuration,yd as parseProgress,gm as parseStatus,Dw as pluginManager,ff as retrySyncOperation,Cs as retryWithBackoff,mc as shadows,L0 as shouldVirtualizeGrid,nc as spacing,Bo as themes,y0 as useAI,u0 as useBoard,ps as useBoardCore,zi as useBoardStore,w0 as useCardStacking,hl as useDragState,N0 as useFilteredCards,g0 as useFilters,Er as useGanttI18n,Hi as useKanbanState,vp as useKeyboardShortcuts,x0 as useMultiSelect,tc as useSelectionState,D0 as useSortedCards,dn as useTheme,A0 as useVirtualGrid,F0 as useVirtualList,bm as validateAIResponse,Sl as withErrorBoundary,Ns as wouldCreateCircularDependency,cc as zIndex};//# sourceMappingURL=index.js.map
442
+ `}var Aw=({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 O0({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=dn();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let p=n,l=p===r;return jsxs("button",{onClick:()=>o(p),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":l,title:d.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(Aw,{theme:p})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:d.displayName})]},p)})})}
443
+ export{i0 as AIUsageDashboard,cw as AI_FEATURES,Zd as AI_MODELS,Sl as AddCardButton,kl as AddColumnButton,zr as AttachmentUploader,T0 as BoardProvider,js as BulkOperationsToolbar,Hl as BurnDownChart,Ig as CUSTOM_FIELD_TYPES,_g as CalendarBoard,Yr as Card,Ll as CardDetailModal,Rl as CardDetailModalV2,Qg as CardHistoryReplay,Xg as CardHistoryTimeline,t0 as CardRelationshipsGraph,tw as CardStack,jl as CardTemplateSelector,tl as CircuitBreaker,tn as Column,ti as ColumnManager,Pl as CommandPalette,Xl as ConfigMenu,gn as ContextMenu,_n as DEFAULT_SHORTCUTS,Ag as DEFAULT_TABLE_COLUMNS,_l as DEFAULT_TEMPLATES,Mn as DateRangePicker,Ln as DependenciesSelector,qn as DependencyLine,zl as DistributionCharts,dl as EditableColumnTitle,on as ErrorBoundary,Yl as ExportImportModal,ql as FilterBar,pm as GANTT_AI_SYSTEM_PROMPT,hi as GanttAIAssistant,im as GanttBoard,un as GanttI18nContext,pi as GanttMilestone,ei as GanttToolbar,c0 as GenerateGanttTasksDialog,o0 as GeneratePlanModal,Vl as GroupBySelector,fl as HealthBar,po as KanbanBoard,vl as KanbanToolbar,Wn as KanbanViewAdapter,Gl as KeyboardShortcutsHelp,Mg as ListView,jt as MenuIcons,Wi as PluginManager,So as PrioritySelector,bl as ProfitabilityReport,Ao as QuickTaskCreate,dw as RATE_LIMITS,Lg as STANDARD_FIELDS,Ul as SwimlaneBoardView,ul as TagBadge,Su as TagList,lo as TagPicker,ii as TaskBar,Xr as TaskDetailModal,um as TaskFormModal,oi as TaskGrid,ed as ThemeModal,Tp as ThemeProvider,O0 as ThemeSwitcher,Or as TimeInputPopover,pl as TimePill,ml as TimePopover,gi as Timeline,Fo as UserAssignmentSelector,$l as VelocityChart,A0 as VirtualGrid,F0 as VirtualList,Uo as aiUsageTracker,ic as borderRadius,ks as calculatePosition,Yd as calendarDarkTheme,Vd as calendarEnTranslations,Gd as calendarEsTranslations,qd as calendarLightTheme,Xd as calendarNeutralTheme,Oi as calendarThemes,Li as calendarTranslations,vi as cardToGanttTask,xm as cardsToGanttTasks,u as cn,rp as createKanbanView,hf as createRetryWrapper,Jl as darkTheme,Gi as darkTokenTheme,Ys as defaultTheme,Vi as designTokens,pc as duration,mc as easing,R0 as exportTokensToCSS,ao as findTaskByName,lc as fontSize,dc as fontWeight,ds as formatCost,Xs as ganttEnTranslations,Dp as ganttEsTranslations,ym as ganttTaskToCardUpdate,et as ganttThemes,hc as ganttTokens,td as ganttTranslations,Ae as ganttUtils,xc as generateCSSVariables,kc as generateCompleteCSS,mf as generateInitialPositions,mm as generateTasksContext,ms as generateThemeVariables,jg as getCalendarTheme,rs as getCalendarTranslations,Bg as getListViewTheme,kd as getListViewTranslations,Rg as getMonthNames,B0 as getToken,Sp as getTranslations,Og as getWeekdayNames,bc as kanbanTokens,Ql as lightTheme,vc as lightTokenTheme,cc as lineHeight,zd as listViewDarkTheme,vd as listViewEnTranslations,wd as listViewEsTranslations,Ud as listViewLightTheme,Wd as listViewNeutralTheme,Ai as listViewThemes,wi as listViewTranslations,Ii as mergeCalendarTranslations,ki as mergeListViewTranslations,ad as mergeTranslations,Zl as neutralTheme,wc as neutralTokenTheme,fc as opacity,bm as parseLocalCommand,hd as parseNaturalDate,yd as parseNaturalDuration,xd as parseProgress,fm as parseStatus,Ew as pluginManager,bf as retrySyncOperation,Cs as retryWithBackoff,gc as shadows,I0 as shouldVirtualizeGrid,sc as spacing,Bo as themes,x0 as useAI,p0 as useBoard,ps as useBoardCore,Ui as useBoardStore,k0 as useCardStacking,yl as useDragState,D0 as useFilteredCards,f0 as useFilters,Er as useGanttI18n,zi as useKanbanState,wp as useKeyboardShortcuts,v0 as useMultiSelect,ac as useSelectionState,S0 as useSortedCards,dn as useTheme,L0 as useVirtualGrid,P0 as useVirtualList,hm as validateAIResponse,El as withErrorBoundary,Ns as wouldCreateCircularDependency,uc as zIndex};//# sourceMappingURL=index.js.map
444
444
  //# sourceMappingURL=index.js.map